summaryrefslogtreecommitdiff
path: root/Makefile.par.gen
diff options
context:
space:
mode:
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>2009-03-14 02:28:41 +0000
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>2009-03-14 02:28:41 +0000
commitc3f962a1f0a4132ad643c58774bb69b190dccc49 (patch)
treedaa59a206d6fde01dc1404197e981927366af0e0 /Makefile.par.gen
parent4eea337c46db44a6ee7560a4552e158421776777 (diff)
Merged r10554:10595 from michaelld/am_swig_4 into trunk. Major overhaul of SWIG usage in build system, also fixes ticket:130. Trunk passes distcheck.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10596 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'Makefile.par.gen')
-rw-r--r--Makefile.par.gen77
1 files changed, 77 insertions, 0 deletions
diff --git a/Makefile.par.gen b/Makefile.par.gen
new file mode 100644
index 0000000000..22eb1a08fd
--- /dev/null
+++ b/Makefile.par.gen
@@ -0,0 +1,77 @@
+# -*- Makefile -*-
+#
+# Copyright 2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+STAMPS ?=
+EXTRA_DIST ?=
+MOSTLYCLEANFILES ?=
+
+## ----------------------------------------------------------------
+## Special rules for generating sources. Include this file when there
+## are multiple targets ('gen_sources') being created using a single
+## command. In this case, parallel build protection is required, and
+## is provided by this file using a reasonably generic ruleset. For
+## more info, see:
+##
+## http://sources.redhat.com/automake/automake.html#Multiple-Outputs
+##
+## If a single source is being created, then normal rules can be used;
+## using this parallel protection will not hurt, but it also won't help.
+##
+## Define the variable 'par_gen_command' to be the command that
+## creates the sources 'gen_sources' from the dependency files
+## 'gen_sources_deps'.
+##
+
+## These STAMPS will be removed upon "make clean", but are otherwise
+## not used.
+
+STAMPS += $(DEPDIR)/stamp-sources-generate*
+
+## The following STAMP will be included in the archive, to show that
+## this these rules have been followed.
+
+EXTRA_DIST += stamp-sources-generate
+MOSTLYCLEANFILES += stamp-sources-generate
+
+stamp-sources-generate: $(gen_sources_deps)
+ @rm -f $(DEPDIR)/stamp-sources-generate-tmp
+ @touch $(DEPDIR)/stamp-sources-generate-tmp
+ $(par_gen_command)
+ @mv -f $(DEPDIR)/stamp-sources-generate-tmp $@
+
+$(gen_sources): stamp-sources-generate
+## Recover from the removal of $@
+ @if test -f $@; then :; else \
+ trap 'rm -rf $(DEPDIR)/stamp-sources-generate-*' 1 2 13 15; \
+ if mkdir $(DEPDIR)/stamp-sources-generate-lock 2>/dev/null; then \
+## This code is being executed by the first process.
+ rm -f stamp-sources-generate; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-sources-generate; \
+ rmdir $(DEPDIR)/stamp-sources-generate-lock; \
+ else \
+## This code is being executed by the follower processes.
+## Wait until the first process is done.
+ while test -d $(DEPDIR)/stamp-sources-generate-lock; do sleep 1; done; \
+## Succeed iff the first process succeeded.
+ test -f stamp-sources-generate; exit $$?; \
+ fi; \
+ fi;