On Mon, 14 Apr 2008 14:59:14 +0200, Raphael Hertzog <[EMAIL PROTECTED]> said:
--8<---------------cut here---------------start------------->8--- 1 | ifeq "$(wildcard ../include/factory++.hpp)" "" 2 | CPPFLAGS=`pkg-config libfactory++ --cflags` 3 | else 4 | INCLUDE = .$(shell ln -sf ../include factory++) 5 | CPPFLAGS = -I$(INCLUDE) 6 | CXXFLAGS += -O0 -g 7 | test_factory.o: $(wildcard $(INCLUDE)/factory++/*.hpp) 8 | endif --8<---------------cut here---------------end--------------->8--- > While stracing the whole process, you'll discover that this shell > snippet is executed twice... the first time it creates a "factory++" > symlink pointing to ../include and the second time a symlink named > include inside ../include pointing to ../include. I can explain why it is executed twice. The commands run by calls to the `shell' function are run when the function calls are expanded. The expansion happens first on line 5: CPPFLAGS = -I$(INCLUDE) Then it happens on line 7: test_factory.o: $(wildcard $(INCLUDE)/factory++/*.hpp) This is because the variable is set using the recursively expanded method (using = ). Using a simply expanded variable (:=) INCLUDE := $(shell ln -sf ../include factory++) will expand the shell function only once. manoj -- The reason why worry kills more people than work is that more people worry than work. Manoj Srivastava <[EMAIL PROTECTED]> <http://www.debian.org/~srivasta/> 1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]