diff options
Diffstat (limited to 'gnuradio-core/src/lib/gengen/Makefile.am')
-rw-r--r-- | gnuradio-core/src/lib/gengen/Makefile.am | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am index b1a3b2613..a4330f103 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.am +++ b/gnuradio-core/src/lib/gengen/Makefile.am @@ -113,9 +113,35 @@ CODE_GENERATOR = \ include $(srcdir)/Makefile.gen -$(srcdir)/Makefile.gen $(GENERATED_H) $(GENERATED_I) $(GENERATED_CC): $(CODE_GENERATOR) +# Ensure parallel does the right thing. +# http://sources.redhat.com/automake/automake.html#Multiple-Outputs + +generate-stamp: $(CODE_GENERATOR) + @rm -f generate-tmp + @touch generate-tmp PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py touch $(srcdir)/Makefile.in + @mv -f generate-tmp $@ + + +$(srcdir)/Makefile.gen $(GENERATED_H) $(GENERATED_I) $(GENERATED_CC): generate-stamp +## Recover from the removal of $@ + @if test -f $@; then :; else \ + trap 'rm -rf generate-lock generate-stamp' 1 2 13 15; \ + if mkdir generate-lock 2>/dev/null; then \ +## This code is being executed by the first process. + rm -f generate-stamp; \ + $(MAKE) $(AM_MAKEFLAGS) generate-stamp; \ + rmdir generate-lock; \ + else \ +## This code is being executed by the follower processes. +## Wait until the first process is done. + while test -d generate-lock; do sleep 1; done; \ +## Succeed if and only if the first process succeeded. + test -f generate-stamp; exit $$?; \ + fi; \ + fi + BUILT_SOURCES = $(GENERATED_H) $(GENERATED_I) $(GENERATED_CC) |