%% Paolo Gai <[EMAIL PROTECTED]> writes:
pg> myvar = $(shell cat goofy)
pg> all: goofy2
pg> make -C . test
pg> test: $(myvar) goofy
pg> @echo "end... did the Done message has been printed?"
pg> mygoofy:
pg> @echo Done!!!
pg> goofy: goofy2
pg> cp goofy2 goofy
pg> goofy2:
pg> echo mygoofy > goofy2
pg> When executed the first time, goofy will be created -after- the
pg> expansion of myvar. When executed the second time, the makefile will
pg> work, printing "Done!!!".
Yes. That's because variables and functions in a prerequisite context
are expanded when the makefile is read in, before any rules are run.
Read the GNU make manual section "How 'make' Reads a Makefile" to
understand this critical aspect of make.
The only way to do this is change it around so that the file contains
the variable setting itself, and use "include", something like this:
include goofy
all: test
clean:
rm goofy
test: $(myvar)
@echo "end... did the Done message has been printed?"
mygoofy:
@echo Done!!!
goofy:
echo 'myvar = mygoofy' > $@
--
-------------------------------------------------------------------------------
Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/help-make