help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .SECONDEXPANSION Fails


From: Boris Kolpackov
Subject: Re: .SECONDEXPANSION Fails
Date: Wed, 10 May 2006 20:40:44 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

Hi David,

David Greene <address@hidden> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]