10-30-05 07:48 AM
Markus Dehmann <markus.dehmann@gmail.com> writes:
> In my Makefile, I include another, generated Makefile:
>
> include Makefile2
> Makefile2:
> generateMakefile.sh > $@
>
> That's no problem. But if the path for Makefile2 is created by a
> shell command, then that Makefile2 is created in an infinite loop,
> make does not stop anymore:
>
> MAKEFILE2 := $(shell mktemp -d /tmp/tmp.XXXXXX)/Makefile2
> include $(MAKEFILE2)
> $(MAKEFILE2):
> generateMakefile.sh > $@
>
> $ make
> Makefile:2: /tmp/tmp.wIqe0W/Makefile2: No such file or directory
> ./generateMakefile.sh > /tmp/tmp.wIqe0W/Makefile2
> Makefile:2: /tmp/tmp.LoxxQo/Makefile2: No such file or directory
> ./generateMakefile.sh > /tmp/tmp.LoxxQo/Makefile2
> Makefile:2: /tmp/tmp.Ipt1H6/Makefile2: No such file or directory
> ./generateMakefile.sh > /tmp/tmp.Ipt1H6/Makefile2
> Makefile:2: /tmp/tmp.hIgHFG/Makefile2: No such file or directory
> ./generateMakefile.sh > /tmp/tmp.hIgHFG/Makefile2
> [...]
>
> Why is that, and how can I fix it? I want that the generated Makefile
> is in a random tmp directory. I made a point of using the :=
> assignment, but it obviously doesn't help.
MAKEFILE2=dummy
all:
$(MAKE) real MAKEFILE2=$(shell mktemp -d /tmp/tmp.XXXXXX)/Makefile2
real:
@echo done real
-include $(MAKEFILE2)
$(MAKEFILE2):
generateMakefile.sh > $@
--
__Pascal Bourguignon__ http://www.informatimago.com/
The mighty hunter
Returns with gifts of plump birds,
Your foot just squashed one.
[ Post a follow-up to this message ]
|