3 # Copyright 2009 Free Software Foundation, Inc.
5 # This file is part of GNU Radio
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)
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.
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.
23 # Makefile.swig.gen for msdd.i
25 ## Default install locations for these files:
27 ## Default location for the Python directory is:
28 ## ${prefix}/lib/python${python_version}/site-packages/[category]/msdd
29 ## Default location for the Python exec directory is:
30 ## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/msdd
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.
37 msdd_pythondir_category ?= gnuradio/msdd
38 msdd_pylibdir_category ?= $(msdd_pythondir_category)
39 msdd_pythondir = $(pythondir)/$(msdd_pythondir_category)
40 msdd_pylibdir = $(pyexecdir)/$(msdd_pylibdir_category)
42 msdd_rs_pythondir_category ?= gnuradio/msdd_rs
43 msdd_rs_pylibdir_category ?= $(msdd_rs_pythondir_category)
44 msdd_rs_pythondir = $(pythondir)/$(msdd_rs_pythondir_category)
45 msdd_rs_pylibdir = $(pyexecdir)/$(msdd_rs_pylibdir_category)
47 ## SWIG headers are always installed into the same directory.
49 msdd_swigincludedir = $(swigincludedir)
50 msdd_rs_swigincludedir = $(swigincludedir)
52 ## This is a template file for a "generated" Makefile addition (in
53 ## this case, "Makefile.swig.gen"). By including the top-level
54 ## Makefile.swig, this file will be used to generate the SWIG
55 ## dependencies. Assign the variable TOP_SWIG_FILES to be the list of
56 ## SWIG .i files to generated wrappings for; there can be more than 1
57 ## so long as the names are unique (no sorting is done on the
58 ## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i
59 ## file will generate .cc, .py, and possibly .h files -- meaning that
60 ## all of these files will have the same base name (that provided for
63 ## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the
64 ## right thing. For more info, see <
65 ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
67 ## Stamps used to ensure parallel make does the right thing. These
68 ## are removed by "make clean", but otherwise unused except during the
69 ## parallel built. These will not be included in a tarball, because
70 ## the SWIG-generated files will be removed from the distribution.
72 STAMPS += $(DEPDIR)/msdd-generate-*
73 STAMPS += $(DEPDIR)/msdd_rs-generate-*
75 ## Other cleaned files: dependency files generated by SWIG or this Makefile
77 MOSTLYCLEANFILES += $(DEPDIR)/*.S*
79 ## Add the .py and .cc files to the list of SWIG built sources. The
80 ## .h file is sometimes built, but not always ... so that one has to
81 ## be added manually by the including Makefile.am .
83 swig_built_sources += msdd.py msdd_rs.py msdd.cc msdd_rs.cc
85 ## Various SWIG variables. These can be overloaded in the including
86 ## Makefile.am by setting the variable value there, then including
89 msdd_swiginclude_HEADERS = \
92 $(msdd_swiginclude_headers)
94 msdd_pylib_LTLIBRARIES = \
97 msdd_rs_pylib_LTLIBRARIES = \
102 $(msdd_la_swig_sources)
104 _msdd_rs_la_SOURCES = \
106 $(msdd_la_swig_sources)
110 $(STD_SWIG_LA_LIB_ADD) \
111 $(msdd_la_swig_libadd)
113 _msdd_rs_la_LIBADD = \
114 $(STD_SWIG_LA_LIB_ADD) \
115 $(msdd_rs_la_swig_libadd)
118 $(STD_SWIG_LA_LD_FLAGS) \
119 $(msdd_la_swig_ldflags)
121 _msdd_la_CXXFLAGS = \
122 $(STD_SWIG_CXX_FLAGS) \
123 $(msdd_la_swig_cxxflags)
125 _msdd_rs_la_LDFLAGS = \
126 $(STD_SWIG_LA_LD_FLAGS) \
127 $(msdd_rs_la_swig_ldflags)
129 _msdd_rs_la_CXXFLAGS = \
130 $(STD_SWIG_CXX_FLAGS) \
131 $(msdd_rs_la_swig_cxxflags)
133 msdd_python_PYTHON = \
137 msdd_rs_python_PYTHON = \
141 ## Entry rule for running SWIG
143 msdd.h msdd.py msdd.cc: msdd.i
144 ## This rule will get called only when MAKE decides that one of the
145 ## targets needs to be created or re-created, because:
147 ## * The .i file is newer than any or all of the generated files;
149 ## * Any or all of the .cc, .h, or .py files does not exist and is
150 ## needed (in the case this file is not needed, the rule for it is
153 ## * Some SWIG-based dependecy of the .cc file isn't met and hence the
154 ## .cc file needs be be regenerated. Explanation: Because MAKE
155 ## knows how to handle dependencies for .cc files (regardless of
156 ## their name or extension), then the .cc file is used as a target
157 ## instead of the .i file -- but with the dependencies of the .i
158 ## file. It is this last reason why the line:
160 ## if test -f $@; then :; else
162 ## cannot be used in this case: If a .i file dependecy is not met,
163 ## then the .cc file needs to be rebuilt. But if the stamp is newer
164 ## than the .cc file, and the .cc file exists, then in the original
165 ## version (with the 'test' above) the internal MAKE call will not
166 ## be issued and hence the .cc file will not be rebuilt.
168 ## Once execution gets to here, it should always proceed no matter the
169 ## state of a stamp (as discussed in link above). The
170 ## $(DEPDIR)/msdd-generate stuff is used to allow for parallel
171 ## builds to "do the right thing". The stamp has no relationship with
172 ## either the target files or dependency file; it is used solely for
173 ## the protection of multiple builds during a given call to MAKE.
175 ## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
176 ## (15). At a caught signal, the quoted command will be issued before
177 ## exiting. In this case, remove any stamp, whether temporary of not.
178 ## The trap is valid until the process exits; the process includes all
179 ## commands appended via "\"s.
181 trap 'rm -rf $(DEPDIR)/msdd-generate-*' 1 2 13 15; \
183 ## Create a temporary directory, which acts as a lock. The first
184 ## process to create the directory will succeed and issue the MAKE
185 ## command to do the actual work, while all subsequent processes will
186 ## fail -- leading them to wait for the first process to finish.
188 if mkdir $(DEPDIR)/msdd-generate-lock 2>/dev/null; then \
190 ## This code is being executed by the first process to succeed in
191 ## creating the directory lock.
193 ## Remove the stamp associated with this filename.
195 rm -f $(DEPDIR)/msdd-generate-stamp; \
197 ## Tell MAKE to run the rule for creating this stamp.
199 $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/msdd-generate-stamp WHAT=$<; \
201 ## Now that the .cc, .h, and .py files have been (re)created from the
202 ## .i file, future checking of this rule during the same MAKE
203 ## execution will come back that the rule doesn't need to be executed
204 ## because none of the conditions mentioned at the start of this rule
205 ## will be positive. Remove the the directory lock, which frees up
206 ## any waiting process(es) to continue.
208 rmdir $(DEPDIR)/msdd-generate-lock; \
211 ## This code is being executed by any follower processes while the
212 ## directory lock is in place.
214 ## Wait until the first process is done, testing once per second.
216 while test -d $(DEPDIR)/msdd-generate-lock; do \
220 ## Succeed if and only if the first process succeeded; exit this
221 ## process returning the status of the generated stamp.
223 test -f $(DEPDIR)/msdd-generate-stamp; \
227 $(DEPDIR)/msdd-generate-stamp:
228 ## This rule will be called only by the first process issuing the
229 ## above rule to succeed in creating the lock directory, after
230 ## removing the actual stamp file in order to guarantee that MAKE will
231 ## execute this rule.
233 ## Call SWIG to generate the various output files; special
234 ## post-processing on 'mingw32' host OS for the dependency file.
236 if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(msdd_swig_args) \
237 -MD -MF $(DEPDIR)/msdd.Std \
238 -module msdd -o msdd.cc $(WHAT); then \
239 if test $(host_os) = mingw32; then \
240 $(RM) $(DEPDIR)/msdd.Sd; \
241 $(SED) 's,\\\\,/,g' < $(DEPDIR)/msdd.Std \
242 > $(DEPDIR)/msdd.Sd; \
243 $(RM) $(DEPDIR)/msdd.Std; \
244 $(MV) $(DEPDIR)/msdd.Sd $(DEPDIR)/msdd.Std; \
247 $(RM) $(DEPDIR)/msdd.S*; exit 1; \
250 ## Mess with the SWIG output .Std dependency file, to create a
251 ## dependecy file valid for the input .i file: Basically, simulate the
252 ## dependency file created for libraries by GNU's libtool for C++,
253 ## where all of the dependencies for the target are first listed, then
254 ## each individual dependency is listed as a target with no further
257 ## (1) remove the current dependency file
259 $(RM) $(DEPDIR)/msdd.d
261 ## (2) Copy the whole SWIG file:
263 cp $(DEPDIR)/msdd.Std $(DEPDIR)/msdd.d
265 ## (3) all a carriage return to the end of the dependency file.
267 echo "" >> $(DEPDIR)/msdd.d
269 ## (4) from the SWIG file, remove the first line (the target); remove
270 ## trailing " \" and " " from each line. Append ":" to each line,
271 ## followed by 2 carriage returns, then append this to the end of
272 ## the dependency file.
274 $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/msdd.Std | \
275 awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/msdd.d
277 ## (5) remove the SWIG-generated file
279 $(RM) $(DEPDIR)/msdd.Std
281 ## Create the stamp for this filename generation, to signal success in
282 ## executing this rule; allows other threads waiting on this process
285 touch $(DEPDIR)/msdd-generate-stamp
292 msdd_rs.h msdd_rs.py msdd_rs.cc: msdd_rs.i
293 ## This rule will get called only when MAKE decides that one of the
294 ## targets needs to be created or re-created, because:
296 ## * The .i file is newer than any or all of the generated files;
298 ## * Any or all of the .cc, .h, or .py files does not exist and is
299 ## needed (in the case this file is not needed, the rule for it is
302 ## * Some SWIG-based dependecy of the .cc file isn't met and hence the
303 ## .cc file needs be be regenerated. Explanation: Because MAKE
304 ## knows how to handle dependencies for .cc files (regardless of
305 ## their name or extension), then the .cc file is used as a target
306 ## instead of the .i file -- but with the dependencies of the .i
307 ## file. It is this last reason why the line:
309 ## if test -f $@; then :; else
311 ## cannot be used in this case: If a .i file dependecy is not met,
312 ## then the .cc file needs to be rebuilt. But if the stamp is newer
313 ## than the .cc file, and the .cc file exists, then in the original
314 ## version (with the 'test' above) the internal MAKE call will not
315 ## be issued and hence the .cc file will not be rebuilt.
317 ## Once execution gets to here, it should always proceed no matter the
318 ## state of a stamp (as discussed in link above). The
319 ## $(DEPDIR)/msdd-generate stuff is used to allow for parallel
320 ## builds to "do the right thing". The stamp has no relationship with
321 ## either the target files or dependency file; it is used solely for
322 ## the protection of multiple builds during a given call to MAKE.
324 ## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
325 ## (15). At a caught signal, the quoted command will be issued before
326 ## exiting. In this case, remove any stamp, whether temporary of not.
327 ## The trap is valid until the process exits; the process includes all
328 ## commands appended via "\"s.
330 trap 'rm -rf $(DEPDIR)/msdd_rs-generate-*' 1 2 13 15; \
332 ## Create a temporary directory, which acts as a lock. The first
333 ## process to create the directory will succeed and issue the MAKE
334 ## command to do the actual work, while all subsequent processes will
335 ## fail -- leading them to wait for the first process to finish.
337 if mkdir $(DEPDIR)/msdd_rs-generate-lock 2>/dev/null; then \
339 ## This code is being executed by the first process to succeed in
340 ## creating the directory lock.
342 ## Remove the stamp associated with this filename.
344 rm -f $(DEPDIR)/msdd_rs-generate-stamp; \
346 ## Tell MAKE to run the rule for creating this stamp.
348 $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/msdd_rs-generate-stamp WHAT=$<; \
350 ## Now that the .cc, .h, and .py files have been (re)created from the
351 ## .i file, future checking of this rule during the same MAKE
352 ## execution will come back that the rule doesn't need to be executed
353 ## because none of the conditions mentioned at the start of this rule
354 ## will be positive. Remove the the directory lock, which frees up
355 ## any waiting process(es) to continue.
357 rmdir $(DEPDIR)/msdd_rs-generate-lock; \
360 ## This code is being executed by any follower processes while the
361 ## directory lock is in place.
363 ## Wait until the first process is done, testing once per second.
365 while test -d $(DEPDIR)/msdd_rs-generate-lock; do \
369 ## Succeed if and only if the first process succeeded; exit this
370 ## process returning the status of the generated stamp.
372 test -f $(DEPDIR)/msdd_rs-generate-stamp; \
376 $(DEPDIR)/msdd_rs-generate-stamp:
377 ## This rule will be called only by the first process issuing the
378 ## above rule to succeed in creating the lock directory, after
379 ## removing the actual stamp file in order to guarantee that MAKE will
380 ## execute this rule.
382 ## Call SWIG to generate the various output files; special
383 ## post-processing on 'mingw32' host OS for the dependency file.
385 if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(msdd_rs_swig_args) \
386 -MD -MF $(DEPDIR)/msdd_rs.Std \
387 -module msdd_rs -o msdd_rs.cc $(WHAT); then \
388 if test $(host_os) = mingw32; then \
389 $(RM) $(DEPDIR)/msdd_rs.Sd; \
390 $(SED) 's,\\\\,/,g' < $(DEPDIR)/msdd_rs.Std \
391 > $(DEPDIR)/msdd_rs.Sd; \
392 $(RM) $(DEPDIR)/msdd_rs.Std; \
393 $(MV) $(DEPDIR)/msdd_rs.Sd $(DEPDIR)/msdd_rs.Std; \
396 $(RM) $(DEPDIR)/msdd_rs.S*; exit 1; \
399 ## Mess with the SWIG output .Std dependency file, to create a
400 ## dependecy file valid for the input .i file: Basically, simulate the
401 ## dependency file created for libraries by GNU's libtool for C++,
402 ## where all of the dependencies for the target are first listed, then
403 ## each individual dependency is listed as a target with no further
406 ## (1) remove the current dependency file
408 $(RM) $(DEPDIR)/msdd_rs.d
410 ## (2) Copy the whole SWIG file:
412 cp $(DEPDIR)/msdd_rs.Std $(DEPDIR)/msdd_rs.d
414 ## (3) all a carriage return to the end of the dependency file.
416 echo "" >> $(DEPDIR)/msdd_rs.d
418 ## (4) from the SWIG file, remove the first line (the target); remove
419 ## trailing " \" and " " from each line. Append ":" to each line,
420 ## followed by 2 carriage returns, then append this to the end of
421 ## the dependency file.
423 $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/msdd_rs.Std | \
424 awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/msdd_rs.d
426 ## (5) remove the SWIG-generated file
428 $(RM) $(DEPDIR)/msdd_rs.Std
430 ## Create the stamp for this filename generation, to signal success in
431 ## executing this rule; allows other threads waiting on this process
434 touch $(DEPDIR)/msdd_rs-generate-stamp
436 # KLUDGE: Force runtime include of a SWIG dependency file. This is
437 # not guaranteed to be portable, but will probably work. If it works,
438 # we have accurate dependencies for our swig stuff, which is good.
441 @am__include@ @am__quote@./$(DEPDIR)/msdd.d@am__quote@
442 @am__include@ @am__quote@./$(DEPDIR)/msdd_rs.d@am__quote@