Hi David,

David Greene <[EMAIL PROTECTED]> writes:

> %.o: $$(subst $(BUILDDIR),$(SRCDIR),$$*.c)
>       $(CC) -c $< -o $@

This rule does not work due to the directory splitting twist found in
GNU make. If you run your example with the -rd options, you will see
that make does not try this pattern with, say, '/tmp/build/code/main'
stem, but instead with 'main'. This is because GNU make has this
extra logic which splits the target into directory-part/file-part and
derives the stem only from the file-part if pattern does not have any
directory separators and matching file has directory part (I know,
it sounds convoluted). One way to disable this (mis)feature is to
add a directory separator to your pattern:

/%.o: $$(subst $(BUILDDIR),$(SRCDIR),/$$*.c)
        $(CC) -c $< -o $@


hth,
-boris
-- 
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding



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

Reply via email to