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