Open GoogleCodeExporter opened 9 years ago
Original comment by kkania@chromium.org
on 18 Jan 2013 at 5:32
The current make generator will generate a makefile similar to this for the
multi-output action:
one.cc: gen.py
python gen.py
two.cc: one.cc
one.o: one.cc
g++ -c one.cc
two.o: two.cc
g++ -c two.cc
.PHONY: test
test: one.o two.o
This doesn't work if two.cc changes from gen.py but one.cc doesn't. The
simplest way to fix this is to change
two.cc: one.cc
->
two.cc: one.cc FORCE_DO_CMD ;
--- a/pylib/gyp/generator/make.py
+++ b/pylib/gyp/generator/make.py
@@ -1704,7 +1704,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
# think these outputs haven't (couldn't have?) changed, and thus doesn't
# flag them as changed (i.e. include in '$?') when evaluating dependent
# rules, which in turn causes do_cmd() to skip running dependent commands.
- self.WriteLn('%s: ;' % (' '.join(outputs[1:])))
+ self.WriteLn('%s: FORCE_DO_CMD ;' % (' '.join(outputs[1:])))
self.WriteLn()
Technically, it only needs to be an order-only prerequisite, so we could do:
two.cc: FORCE_DO_CMD | one.cc ;
Original comment by kkania@chromium.org
on 21 Jan 2013 at 6:48
The above patch still doesn't fix the minor issue that the action is always
performed if gen.py is newer than one.cc. To fix that, we could so something
like:
action: gen.py
python gen.py && touch action
one.cc: action ;
two.cc: action ;
one.o: one.cc
g++ -c one.cc
two.o: two.cc
g++ -c two.cc
.PHONY: test
test: one.o two.o
This is a bit more complicated but fixes both problems and doesn't rely on
FORCE_DO_CMD.
Original comment by kkania@chromium.org
on 21 Jan 2013 at 7:57
Actually, the FORCE_DO_CMD stuff doesn't work. We'll have to use a separate
file or something like I mentioned above.
See
http://www.gnu.org/savannah-checkouts/gnu/automake/manual/html_node/Multiple-Out
puts.html
Original comment by kkania@chromium.org
on 23 Jan 2013 at 12:59
Here's a sample gyp test that repro's the problem:
https://codereview.chromium.org/12052022
Original comment by kkania@chromium.org
on 23 Jan 2013 at 1:10
Original comment by kkania@chromium.org
on 25 Jan 2013 at 12:50
Original issue reported on code.google.com by
kkania@chromium.org
on 18 Jan 2013 at 5:25