I am experiencing a weird issue with order-only prerequisites in GNU
Make v3.8. My expectation is based on the following statement from
section 4.2 Types of Prerequisites of the GNU Make manual: "Also, you
may still declare multiple lines of prerequisites for the same target:
they are appended appropriately."
Consider this dumbed down example (as viewed from a terminal):
-------------------Begin Example-------------------------------
%> cat Makefile.mk
d := temp
obj_$(d) := $(d)/obj
include Blah.mk
d := wtf
obj_$(d) := $(d)/obj
include Blah.mk
%> cat Blah.mk
VPATH := $(VPATH) $(d)
#This doesn't work
$(obj_$(d))/%.o: | $(obj_$(d))
$(obj_$(d))/%.o: %.c
touch $@
#This does work
#$(obj_$(d))/%.o: %.c | $(obj_$(d))
# touch $@
$(obj_$(d)):
mkdir $@
%> mkdir temp
%> mkdir wtf
%> touch temp/blah.c
%> gmake -f Makefile.mk temp/obj/blah.o
Touch temp/obj/blah.o
Cannot create temp/obj/blah.o: No such file or directory
gmake: ***[temp/obj/blah.o] Error 1
-------------------End Example-------------------------------
If you'll notice, the Blah.mk that is being included from the main
makefile has a section commented out where the order-only prerequisite
is combined with the implicit rule. That works as expected. From my
interpretation of the manual, it what is currently uncommented and
failing should also work. I should note that most of the time this does
work correctly. Not sure is it has to do with simply expanded variables
or what the deal is.
Josh
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make