root / Makefile.swig.gen.t @ 6213d97e
History | View | Annotate | Download (9.4 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 | # Makefile.swig.gen for @NAME@.i |
| 24 | |
| 25 | ## Default install locations for these files: |
| 26 | ## |
| 27 | ## Default location for the Python directory is: |
| 28 | ## ${prefix}/lib/python${python_version}/site-packages/[category]/@NAME@
|
| 29 | ## Default location for the Python exec directory is: |
| 30 | ## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/@NAME@
|
| 31 | ## |
| 32 | ## The following can be overloaded to change the install location, but |
| 33 | ## this has to be done in the including Makefile.am -before- |
| 34 | ## Makefile.swig is included. |
| 35 | |
| 36 | @NAME@_pythondir_category ?= gnuradio/@NAME@ |
| 37 | @NAME@_pylibdir_category ?= $(@NAME@_pythondir_category) |
| 38 | @NAME@_pythondir = $(pythondir)/$(@NAME@_pythondir_category) |
| 39 | @NAME@_pylibdir = $(pyexecdir)/$(@NAME@_pylibdir_category) |
| 40 | |
| 41 | ## SWIG headers are always installed into the same directory. |
| 42 | |
| 43 | @NAME@_swigincludedir = $(swigincludedir) |
| 44 | |
| 45 | ## This is a template file for a "generated" Makefile addition (in |
| 46 | ## this case, "Makefile.swig.gen"). By including the top-level |
| 47 | ## Makefile.swig, this file will be used to generate the SWIG |
| 48 | ## dependencies. Assign the variable TOP_SWIG_FILES to be the list of |
| 49 | ## SWIG .i files to generated wrappings for; there can be more than 1 |
| 50 | ## so long as the names are unique (no sorting is done on the |
| 51 | ## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i |
| 52 | ## file will generate .cc, .py, and possibly .h files -- meaning that |
| 53 | ## all of these files will have the same base name (that provided for |
| 54 | ## the SWIG .i file). |
| 55 | ## |
| 56 | ## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the
|
| 57 | ## right thing. For more info, see < |
| 58 | ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > |
| 59 | |
| 60 | ## Stamps used to ensure parallel make does the right thing. These |
| 61 | ## are removed by "make clean", but otherwise unused except during the |
| 62 | ## parallel built. These will not be included in a tarball, because |
| 63 | ## the SWIG-generated files will be removed from the distribution. |
| 64 | |
| 65 | STAMPS += $(DEPDIR)/@NAME@-generate-* |
| 66 | |
| 67 | ## Other cleaned files: dependency files generated by SWIG or this Makefile |
| 68 | |
| 69 | MOSTLYCLEANFILES += $(DEPDIR)/*.S* |
| 70 | |
| 71 | ## Add the .py and .cc files to the list of SWIG built sources. The |
| 72 | ## .h file is sometimes built, but not always ... so that one has to |
| 73 | ## be added manually by the including Makefile.am . |
| 74 | |
| 75 | swig_built_sources += @NAME@.py @NAME@.cc |
| 76 | |
| 77 | ## Various SWIG variables. These can be overloaded in the including |
| 78 | ## Makefile.am by setting the variable value there, then including |
| 79 | ## Makefile.swig . |
| 80 | |
| 81 | @NAME@_swiginclude_HEADERS = \ |
| 82 | @NAME@.i \ |
| 83 | $(@NAME@_swiginclude_headers) |
| 84 | |
| 85 | @NAME@_pylib_LTLIBRARIES = \ |
| 86 | _@NAME@.la |
| 87 | |
| 88 | _@NAME@_la_SOURCES = \ |
| 89 | @NAME@.cc \ |
| 90 | $(@NAME@_la_swig_sources) |
| 91 | |
| 92 | _@NAME@_la_LIBADD = \ |
| 93 | $(STD_SWIG_LA_LIB_ADD) \ |
| 94 | $(@NAME@_la_swig_libadd) |
| 95 | |
| 96 | _@NAME@_la_LDFLAGS = \ |
| 97 | $(STD_SWIG_LA_LD_FLAGS) \ |
| 98 | $(@NAME@_la_swig_ldflags) |
| 99 | |
| 100 | _@NAME@_la_CXXFLAGS = \ |
| 101 | $(STD_SWIG_CXX_FLAGS) \ |
| 102 | $(@NAME@_la_swig_cxxflags) |
| 103 | |
| 104 | @NAME@_python_PYTHON = \ |
| 105 | @NAME@.py \ |
| 106 | $(@NAME@_python) |
| 107 | |
| 108 | ## Entry rule for running SWIG |
| 109 | |
| 110 | @NAME@.h @NAME@.py @NAME@.cc: @NAME@.i |
| 111 | ## This rule will get called only when MAKE decides that one of the |
| 112 | ## targets needs to be created or re-created, because: |
| 113 | ## |
| 114 | ## * The .i file is newer than any or all of the generated files; |
| 115 | ## |
| 116 | ## * Any or all of the .cc, .h, or .py files does not exist and is |
| 117 | ## needed (in the case this file is not needed, the rule for it is |
| 118 | ## ignored); or |
| 119 | ## |
| 120 | ## * Some SWIG-based dependecy of the .cc file isn't met and hence the |
| 121 | ## .cc file needs be be regenerated. Explanation: Because MAKE |
| 122 | ## knows how to handle dependencies for .cc files (regardless of |
| 123 | ## their name or extension), then the .cc file is used as a target |
| 124 | ## instead of the .i file -- but with the dependencies of the .i |
| 125 | ## file. It is this last reason why the line: |
| 126 | ## |
| 127 | ## if test -f $@; then :; else |
| 128 | ## |
| 129 | ## cannot be used in this case: If a .i file dependecy is not met, |
| 130 | ## then the .cc file needs to be rebuilt. But if the stamp is newer |
| 131 | ## than the .cc file, and the .cc file exists, then in the original |
| 132 | ## version (with the 'test' above) the internal MAKE call will not |
| 133 | ## be issued and hence the .cc file will not be rebuilt. |
| 134 | ## |
| 135 | ## Once execution gets to here, it should always proceed no matter the |
| 136 | ## state of a stamp (as discussed in link above). The |
| 137 | ## $(DEPDIR)/@NAME@-generate stuff is used to allow for parallel |
| 138 | ## builds to "do the right thing". The stamp has no relationship with |
| 139 | ## either the target files or dependency file; it is used solely for |
| 140 | ## the protection of multiple builds during a given call to MAKE. |
| 141 | ## |
| 142 | ## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM |
| 143 | ## (15). At a caught signal, the quoted command will be issued before |
| 144 | ## exiting. In this case, remove any stamp, whether temporary of not. |
| 145 | ## The trap is valid until the process exits; the process includes all |
| 146 | ## commands appended via "\"s. |
| 147 | ## |
| 148 | trap 'rm -rf $(DEPDIR)/@NAME@-generate-*' 1 2 13 15; \ |
| 149 | ## |
| 150 | ## Create a temporary directory, which acts as a lock. The first |
| 151 | ## process to create the directory will succeed and issue the MAKE |
| 152 | ## command to do the actual work, while all subsequent processes will |
| 153 | ## fail -- leading them to wait for the first process to finish. |
| 154 | ## |
| 155 | if mkdir $(DEPDIR)/@NAME@-generate-lock 2>/dev/null; then \ |
| 156 | ## |
| 157 | ## This code is being executed by the first process to succeed in |
| 158 | ## creating the directory lock. |
| 159 | ## |
| 160 | ## Remove the stamp associated with this filename. |
| 161 | ## |
| 162 | rm -f $(DEPDIR)/@NAME@-generate-stamp; \ |
| 163 | ## |
| 164 | ## Tell MAKE to run the rule for creating this stamp. |
| 165 | ## |
| 166 | $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/@NAME@-generate-stamp WHAT=$<; \ |
| 167 | ## |
| 168 | ## Now that the .cc, .h, and .py files have been (re)created from the |
| 169 | ## .i file, future checking of this rule during the same MAKE |
| 170 | ## execution will come back that the rule doesn't need to be executed |
| 171 | ## because none of the conditions mentioned at the start of this rule |
| 172 | ## will be positive. Remove the the directory lock, which frees up |
| 173 | ## any waiting process(es) to continue. |
| 174 | ## |
| 175 | rmdir $(DEPDIR)/@NAME@-generate-lock; \ |
| 176 | else \ |
| 177 | ## |
| 178 | ## This code is being executed by any follower processes while the |
| 179 | ## directory lock is in place. |
| 180 | ## |
| 181 | ## Wait until the first process is done, testing once per second. |
| 182 | ## |
| 183 | while test -d $(DEPDIR)/@NAME@-generate-lock; do \ |
| 184 | sleep 1; \ |
| 185 | done; \ |
| 186 | ## |
| 187 | ## Succeed if and only if the first process succeeded; exit this |
| 188 | ## process returning the status of the generated stamp. |
| 189 | ## |
| 190 | test -f $(DEPDIR)/@NAME@-generate-stamp; \ |
| 191 | exit $$?; \ |
| 192 | fi; |
| 193 | |
| 194 | $(DEPDIR)/@NAME@-generate-stamp: |
| 195 | ## This rule will be called only by the first process issuing the |
| 196 | ## above rule to succeed in creating the lock directory, after |
| 197 | ## removing the actual stamp file in order to guarantee that MAKE will |
| 198 | ## execute this rule. |
| 199 | ## |
| 200 | ## Call SWIG to generate the various output files; special |
| 201 | ## post-processing on 'mingw32' host OS for the dependency file. |
| 202 | ## |
| 203 | if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(@NAME@_swig_args) \ |
| 204 | -MD -MF $(DEPDIR)/@NAME@.Std \ |
| 205 | -module @NAME@ -o @NAME@.cc $(WHAT); then \ |
| 206 | if test $(host_os) = mingw32; then \ |
| 207 | $(RM) $(DEPDIR)/@NAME@.Sd; \ |
| 208 | $(SED) 's,\\\\,/,g' < $(DEPDIR)/@NAME@.Std \ |
| 209 | > $(DEPDIR)/@NAME@.Sd; \ |
| 210 | $(RM) $(DEPDIR)/@NAME@.Std; \ |
| 211 | $(MV) $(DEPDIR)/@NAME@.Sd $(DEPDIR)/@NAME@.Std; \ |
| 212 | fi; \ |
| 213 | else \ |
| 214 | $(RM) $(DEPDIR)/@NAME@.S*; exit 1; \ |
| 215 | fi; |
| 216 | ## |
| 217 | ## Mess with the SWIG output .Std dependency file, to create a |
| 218 | ## dependecy file valid for the input .i file: Basically, simulate the |
| 219 | ## dependency file created for libraries by GNU's libtool for C++, |
| 220 | ## where all of the dependencies for the target are first listed, then |
| 221 | ## each individual dependency is listed as a target with no further |
| 222 | ## dependencies. |
| 223 | ## |
| 224 | ## (1) remove the current dependency file |
| 225 | ## |
| 226 | $(RM) $(DEPDIR)/@NAME@.d |
| 227 | ## |
| 228 | ## (2) Copy the whole SWIG file: |
| 229 | ## |
| 230 | cp $(DEPDIR)/@NAME@.Std $(DEPDIR)/@NAME@.d |
| 231 | ## |
| 232 | ## (3) all a carriage return to the end of the dependency file. |
| 233 | ## |
| 234 | echo "" >> $(DEPDIR)/@NAME@.d |
| 235 | ## |
| 236 | ## (4) from the SWIG file, remove the first line (the target); remove |
| 237 | ## trailing " \" and " " from each line. Append ":" to each line, |
| 238 | ## followed by 2 carriage returns, then append this to the end of |
| 239 | ## the dependency file. |
| 240 | ## |
| 241 | $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/@NAME@.Std | \ |
| 242 | awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/@NAME@.d
|
| 243 | ## |
| 244 | ## (5) remove the SWIG-generated file |
| 245 | ## |
| 246 | $(RM) $(DEPDIR)/@NAME@.Std |
| 247 | ## |
| 248 | ## Create the stamp for this filename generation, to signal success in |
| 249 | ## executing this rule; allows other threads waiting on this process |
| 250 | ## to continue. |
| 251 | ## |
| 252 | touch $(DEPDIR)/@NAME@-generate-stamp |
| 253 | |
| 254 | # KLUDGE: Force runtime include of a SWIG dependency file. This is |
| 255 | # not guaranteed to be portable, but will probably work. If it works, |
| 256 | # we have accurate dependencies for our swig stuff, which is good. |
| 257 | |
| 258 | @am__include@ @am__quote@./$(DEPDIR)/@NAME@.d@am__quote@ |