Per Jessen wrote:
I think I'm seeing something odd in 'make':
Makefile#1:
ALLDOMAIN:=alldomains.list #ALLDOMAIN:=$(shell mktemp alldomain.XXXXXX)
.PHONY: $(ALLDOMAIN) .SILENT: $(ALLDOMAIN)
$(ALLDOMAIN): <commands to produce the file> >$@
include $(ALLDOMAIN)
[...]
What am I doing wrong here?
I think make and this Makefile do not work in the way you expect them to work. When you enter "make alldomains", then make starts to parse the Makefile (see [1]) and after some time finds the include statement. The file alldomains.list does not exist on disk at that point, so it's content cannot be included. This is no immediate error for make (you should get a warning though, see [2]), it continues parsing the Makefile. At the end, it looks for a rule to generate the file to be included because make determined that it is a dependency. This rule exists, so make goes off and generates the file alldomains.list which will (according to your description) contain a rule called "alldomains". Finally, make now tries to execute the rule "alldomains" - however, you should note that at this point the content of the alldomains.list file has still not been included in the Makefile (make parses a Makefile only once). Therefore, make aborts and you should get an error message like "no rule to make target alldomains" (see [2]). If you have a look at the directory, then you should observe that the include file alldomains.list has been generated (see [3]). If you run "make alldomains" a second time, it will work because now the include file exists when make parses the Makefile and therefore it knows about the target (see [4]). Regards, Thomas $[1]> cat Makefile ALLDOMAIN := alldomains.list .PHONY: $(ALLDOMAIN) $(ALLDOMAIN): ; @echo "alldomains: ;" > $@ @echo -e "\t@echo \"hello, world!\"" >> $@ include $(ALLDOMAIN) $[2]> make alldomains Makefile:9: alldomains.list: No such file or directory make: *** No rule to make target `alldomains'. Stop. $[3]> ls alldomains.list Makefile $[4]> make alldomains hello, world! $> --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org