Hi Daniel, When gmake is finding the dependencies for all, it evaluates $(srcs_file) and $(objs). At that time, srcs.txt hasn't been generated so $(srcs) is the empty string. Therefore, during the first run of gmake, all depends only on srcs.txt. During the second run, srcs.txt already contains the names of the files you're after so $(objs) gets set to what you are expecting.
Can you tell me more about your issue? Why do you want to generate the list of sources this way? Ken On Fri, Nov 12, 2004 at 11:08:33AM +0100, [EMAIL PROTECTED] wrote: > For my project I would like to generate the list of source files before > starting the compilation. Example: > > srcs_file := srcs.txt > srcs = $(shell cat $(srcs_file) 2>/dev/null) > objs = $(srcs:%.c=%.o) > > all : $(srcs_file) $(objs) > > clean : > rm -f $(srcs_file) > rm -f $(srcs) $(objs) > > $(srcs_file) : > for f in foo.c bar.c; do touch $$f; echo $$f >> $@; done > > %.o : %.c > touch $@ > > The problem is, that only the second invocation of 'make' builds the targets > specified in 'objs'. This is probably because during the first invocation the > variable 'objs' has no value. > > Is there a way to avoid two invocations of make? > > Any help is appreciated. Regards, > Daniel > > > > _______________________________________________ > Help-make mailing list > [EMAIL PROTECTED] > http://lists.gnu.org/mailman/listinfo/help-make _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/help-make
