the top level Makefile has this rule to build the object files in
languages/imcc:

$(IMCC_DIR)/%.o : $(IMCC_DIR)/%.c
        $(PERL) tools/dev/cc_flags.pl ./CFLAGS $(CC) -I$(IMCC_DIR) $(CFLAGS) -o $@ -c 
$<

the build fails at imcparser.o for me (the first object file)

Running make with some debug flags gives:

SuffFindDeps (languages/imcc/imcparser.o)
        trying languages/imcc/imcparser.c...got it
        applying .c -> .o to "languages/imcc/imcparser.o"
SuffFindDeps (languages/imcc/imc.h)
SuffFindDeps (languages/imcc/stacks.h)
SuffFindDeps (languages/imcc/cfg.h)
SuffFindDeps (languages/imcc/instructions.h)
SuffFindDeps (languages/imcc/debug.h)
SuffFindDeps (languages/imcc/sets.h)
SuffFindDeps (languages/imcc/symreg.h)
SuffFindDeps (languages/imcc/pbc.h)
SuffFindDeps (languages/imcc/optimizer.h)
SuffFindDeps (languages/imcc/parser.h)
SuffFindDeps (languages/imcc/imcparser.h)
SuffFindDeps (languages/imcc/imcc.y)
echo languages/imcc/imcc.y -d -o languages/imcc/imcparser.c
languages/imcc/imcc.y -d -o languages/imcc/imcparser.c
/export/home/nwc10/bin/perl5.00503 -e 'open(A,qq{>>$_}) or die foreach @ARGV' 
languages/imcc/imcc.y.flag languages/imcc/imcparser.c languages/imcc/imcparser.h
SuffFindDeps (languages/imcc/imcparser.c)
        trying languages/imcc/imcparser.y...not there
        trying languages/imcc/imcparser.l...not there
/export/home/nwc10/bin/perl5.00503 tools/dev/cc_flags.pl ./CFLAGS ccache gcc 
-I/usr/local/include -g  -Dan_Sugalski -Larry -Wall -Wstrict-prototypes 
-Wmissing-prototypes -Winline -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align 
-Wwrite-strings -Waggregate-return -Winline -W -Wno-unused -Wsign-compare  -I./include 
 -DHAS_JIT -DI386 -DHAVE_COMPUTED_GOTO -o languages/imcc/imcparser.o -c 
languages/imcc/imcparser.c
languages/imcc/imcparser.c
imcc.y:20: imc.h: No such file or directory
imcc.y:21: pbc.h: No such file or directory
imcc.y:22: parser.h: No such file or directory
*** Error code 1


Having a grovel around the FreeBSD make and GNU make documentation suggests
that $(IMCC_DIR)/%.o : $(IMCC_DIR)/%.c is a GNU make pattern rule, and
means nothing to FreeBSD. However, I'm not convinced that that rule is
even necessary, as IIRC the C compiler should be looking for include files
in the same directory as the source.

(yes. "should". It is probably not portable. IIRC I read somewhere that
trying to compile source code outside the current directory is not portable.
Or at least trying to use -c to direct the object file to somewhere other
than the same directory as the source would fail)


Aha. *This* patch fixes it:

--- languages/imcc/imcparser.c~ Tue Sep 30 22:06:02 2003
+++ languages/imcc/imcparser.c  Fri Oct 10 23:15:05 2003
@@ -209,7 +209,7 @@
 
 
 /* Copy the first part of user declarations.  */
-#line 1 "imcc.y"
+#line 1 "languages/imcc/imcc.y"
 
 /*
  * imcc.y


I don't think that we can put this in. So, to cut a long ramble short

1: FreeBSD make doesn't understand those % pattern rules
2: gcc 2.95 resets its idea of the source file directory on a #line
   directive, and as a consequence can't find other files to include
   in that directory"

Not sure how to solve this short of changing directory.

Nicholas Clark

Reply via email to