Imported Upstream version 3.2.2
[debian/gnuradio] / Makefile.par.gen
diff --git a/Makefile.par.gen b/Makefile.par.gen
new file mode 100644 (file)
index 0000000..22eb1a0
--- /dev/null
@@ -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;