Makefile given the target change without any rules
I was answering another question -
Dependency ordering error for multiuser work on SO and I posted the following makefile. The OP replied that if -j
it was not specified on the command line, it would not build the target dir1/out/file.bar
. In Perplexed, I verified that it works with -j2
but not with -j1
. I looked it over and I don't see what I missed. I thought I'd post it here in case anyone knows, as I am very curious ...
$(shell mkdir dir1 >& /dev/null; touch dir1/file.foo; \
mkdir dir2 >& /dev/null; touch dir2/file.foo)
OUTDIRS = dir1/out dir2/out
OUTPUTS = dir1/out/file.bar dir2/out/file.bar
.DEFAULT_GOAL := all
$(OUTPUTS) : | $(OUTDIRS)
$(OUTDIRS) :
@echo "making $@"
sleep 1
mkdir -p $@
@echo "done making $@"
%.bar : ../%.foo
@echo "copying $< to $@"
@cp $< $@
all : outputs
@echo "done $@"
outputs : $(OUTPUTS)
@echo "created all output files"
clean :
@rm -rf dir1 dir2
I am running make 3.81 and the OP was using 3.82. I tried working with make -d -j1 -r
, and got the following snippet:
Finished prerequisites of target file `dir1/out/file.bar'.
Must remake target `dir1/out/file.bar'.
Successfully remade target file `dir1/out/file.bar'.
Considering target file `dir2/out/file.bar'.
File `dir2/out/file.bar' does not exist.
Considering target file `dir2/out/../file.foo'.
Finished prerequisites of target file `dir2/out/../file.foo'.
No need to remake target `dir2/out/../file.foo'.
Pruning file `dir1/out'.
Pruning file `dir2/out'.
Finished prerequisites of target file `dir2/out/file.bar'.
Must remake target `dir2/out/file.bar'.
copying dir2/out/../file.foo to dir2/out/file.bar
Successfully remade target file `dir2/out/file.bar'.
It seems like it rewrote dir1 / out / file.bar, but it didn't run any targets / recipes to do it ... I'm wondering what I was missing ...
source to share
No one has answered this question yet
See similar questions:
or similar: