|
Home > Archive > Unix Programming > October 2005 > Makefile: infinite loop when including generated file!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Makefile: infinite loop when including generated file!
|
|
| Markus Dehmann 2005-10-29, 8:50 pm |
| 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.
Markus
| |
| Pascal Bourguignon 2005-10-30, 2: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.
|
|
|
|
|