root / Makefile.par.gen @ c3f962a1
History | View | Annotate | Download (2.8 kB)
| 1 | # -*- Makefile -*- |
|---|---|
| 2 | # |
| 3 | # Copyright 2009 Free Software Foundation, Inc. |
| 4 | # |
| 5 | # This file is part of GNU Radio |
| 6 | # |
| 7 | # GNU Radio is free software; you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation; either version 3, or (at your option) |
| 10 | # any later version. |
| 11 | # |
| 12 | # GNU Radio is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with GNU Radio; see the file COPYING. If not, write to |
| 19 | # the Free Software Foundation, Inc., 51 Franklin Street, |
| 20 | # Boston, MA 02110-1301, USA. |
| 21 | # |
| 22 | |
| 23 | STAMPS ?= |
| 24 | EXTRA_DIST ?= |
| 25 | MOSTLYCLEANFILES ?= |
| 26 | |
| 27 | ## ---------------------------------------------------------------- |
| 28 | ## Special rules for generating sources. Include this file when there |
| 29 | ## are multiple targets ('gen_sources') being created using a single
|
| 30 | ## command. In this case, parallel build protection is required, and |
| 31 | ## is provided by this file using a reasonably generic ruleset. For |
| 32 | ## more info, see: |
| 33 | ## |
| 34 | ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs |
| 35 | ## |
| 36 | ## If a single source is being created, then normal rules can be used; |
| 37 | ## using this parallel protection will not hurt, but it also won't help. |
| 38 | ## |
| 39 | ## Define the variable 'par_gen_command' to be the command that |
| 40 | ## creates the sources 'gen_sources' from the dependency files |
| 41 | ## 'gen_sources_deps'. |
| 42 | ## |
| 43 | |
| 44 | ## These STAMPS will be removed upon "make clean", but are otherwise |
| 45 | ## not used. |
| 46 | |
| 47 | STAMPS += $(DEPDIR)/stamp-sources-generate* |
| 48 | |
| 49 | ## The following STAMP will be included in the archive, to show that |
| 50 | ## this these rules have been followed. |
| 51 | |
| 52 | EXTRA_DIST += stamp-sources-generate |
| 53 | MOSTLYCLEANFILES += stamp-sources-generate |
| 54 | |
| 55 | stamp-sources-generate: $(gen_sources_deps) |
| 56 | @rm -f $(DEPDIR)/stamp-sources-generate-tmp |
| 57 | @touch $(DEPDIR)/stamp-sources-generate-tmp |
| 58 | $(par_gen_command) |
| 59 | @mv -f $(DEPDIR)/stamp-sources-generate-tmp $@ |
| 60 | |
| 61 | $(gen_sources): stamp-sources-generate |
| 62 | ## Recover from the removal of $@ |
| 63 | @if test -f $@; then :; else \ |
| 64 | trap 'rm -rf $(DEPDIR)/stamp-sources-generate-*' 1 2 13 15; \ |
| 65 | if mkdir $(DEPDIR)/stamp-sources-generate-lock 2>/dev/null; then \ |
| 66 | ## This code is being executed by the first process. |
| 67 | rm -f stamp-sources-generate; \ |
| 68 | $(MAKE) $(AM_MAKEFLAGS) stamp-sources-generate; \ |
| 69 | rmdir $(DEPDIR)/stamp-sources-generate-lock; \ |
| 70 | else \ |
| 71 | ## This code is being executed by the follower processes. |
| 72 | ## Wait until the first process is done. |
| 73 | while test -d $(DEPDIR)/stamp-sources-generate-lock; do sleep 1; done; \ |
| 74 | ## Succeed iff the first process succeeded. |
| 75 | test -f stamp-sources-generate; exit $$?; \ |
| 76 | fi; \ |
| 77 | fi; |