On Thu, Jan 06, 2005 at 11:25:36AM -0500, Ken Smith wrote:
> If I understand the intent of your $(BUILDDIR) prerequisite, you may
> wish to make this an order-only dependency. (manual section 4.3)
> 
> Instead of
> 
> %.o : %.c $(BUILDDIR)
> 
> you can write
> 
> %.o : %.c | $(BUILDDIR)
> 
> to make $(BUILDDIR) an order dependency.

This causes another problem, however.  When a C or C++ file is
compiled after the order-only prerequisite is added, the output is
placed in the current directory and not the build directory.
Specifically, this rule:

%.o : %.c $(BUILDDIR)
    $(CC) -MMD -o $(BUILDDIR)/$@ -c $(CFLAGS) $< $(LIBS)

Produces compilation commands like these:

gcc -std=c99 -g -Wall -O0   -c -o vers.o vers.c
----------------------------------^

Note how the "$(BUILDDIR/" is not passed to the -o option.  Then when
the $(PROJ) target tries to link all of the object code together, it
can't find them because it is looking in $(BUILDDIR) directory.  I
don't understand this.

> Since you don't list "pc" anywhere in your makefile, I believe it must
> come from the pattern rules for building Pascal.  Try cancelling this
> particular pattern rule like this. (manual section 10.5.6)
> 
> %.o: %.p
> 
> You can delete all the internal pattern rules by saying this in your
> makefile. (manual section 10.7)
> 
> .SUFFIXES:

Emptying make of its default rules results in it thinking that the
project is up-to-date even when it is not.  If I issues a make
command, append an empty string into a source file, and rerun make
with the -r option or by adding the modifications that Ken suggested
above, make thinking that the project is still up-to-date and the
modified C file isn't rebuilt.

-- 

Regards,

Travis Spencer


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to