wangyu5 / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

Rebuilds non-incremental with some gmake versions (3.82?) #197

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It seems like gmake on at least Fedora 15 and openSuSE 11.4 behaves slightly 
differently so that gyp rebuilds are always non-incremental.

This is due to $(prereq_changed) always being true, which is due to a 
difference in how $? behaves for phony rules: in make on e.g. ubunutu, if the 
rule will otherwise not be run, FORCE_DO_CMD is not included in $?, while on 
openSuSE at least it seems to be.

Suggested patch:
--- pylib/gyp/generator/make.py (revision 890)
+++ pylib/gyp/generator/make.py (working copy)
@@ -279,7 +279,7 @@
 # so we can check their command lines.
 #   $? -- new prerequisites
 #   $| -- order-only dependencies
-prereq_changed = $(filter-out $|,$?)
+prereq_changed = $(filter-out FORCE_DO_CMD, $(filter-out $|,$?))

 # do_cmd: run a command via the above cmd_foo names, if necessary.
 # Should always run for a given target to handle command-line changes.

Make testcase --- make sure to touch foo.c && touch foo.o before using this.
all: foo.o

.PHONY: FORCE_DO_CMD
FORCE_DO_CMD:

%.o: %.c FORCE_DO_CMD
        echo "dollar-bar:" $|
        echo "dollar-question:" $?

On ubuntu 10.04, the output is:
echo "dollar-bar:" 
dollar-bar:
echo "dollar-question:" 
dollar-question:

While on Fedora 15/SuSE 11.4 it is:

echo "dollar-bar:" 
dollar-bar:
echo "dollar-question:" FORCE_DO_CMD
dollar-question: FORCE_DO_CMD

Original issue reported on code.google.com by morlov...@google.com on 2 Jun 2011 at 2:41

GoogleCodeExporter commented 9 years ago
Seems like this got fixed in r987:
http://codereview.chromium.org/7583040/

Original comment by morlov...@google.com on 9 Aug 2011 at 4:20