bug-make
[Top][All Lists]
Advanced

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

Re: Problem with absolute path


From: Boris Kolpackov
Subject: Re: Problem with absolute path
Date: Tue, 20 Jul 2004 15:29:37 +0000 (UTC)
User-agent: nn/6.6.5+RFC1522

Juergen Schmidt <address@hidden> writes:

> has anybody an idea on this or can help me? 

I am not sure this will actually help you but here it goes.

GNU make makes some strange guesses (see make.c around line 99) when it 
comes to files in directories that do not exist. Consider for example
the following /tmp/makefile:


OUT=/tmp/out

.PHONY: all
all: $(OUT)/bin/foo

$(OUT)/obj/%.o: %.c
        mkdir -p $(@D)
        gcc -o $@ -c $<


$(OUT)/bin/%: $(OUT)/obj/%.o
        mkdir -p $(@D)
        gcc -o $@ $<

(A side note: when you are submitting your example and it has to use 
 absolute paths, make sure they all start from /tmp for a lot of people 
 (including myself) will be lazy to go and create /usr/local/maketest 
 just to try your example.)

foo.c is in /tmp, make is run from /tmp. This makefile exhibits two 
different behaviors depending on whether /tmp/out exists or not.

If /tmp/out exists (/tmp/out/bin and /tmp/out/obj do not exist) then 
everything works file. When /tmp/out does not exist make fails. I have
to idea about the logic behind this.

If you don't mind using non-main-line make you can get my -bk patchset
where this bug (IMO, anyway) is fixed:

http://kolpackov.net/projects/make/bk/

Also there is a generally better way to handle directory creation
which is described here (works in main-line make):

http://kolpackov.net/pipermail/notes/2004-January/000001.html


hth,
-boris







reply via email to

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