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 ## This makefile should be included using
24 ## include $(top_srcdir)/Makefile.swig
25 ## in Makefile.am's which require SWIG wrapping / compilation.
26 ## For just installing .i files, this Makefile is not required.
29 ## -w511 turns off keyword argument warning
30 ## "-outdir $(builddir)" writes all generated output files to
31 ## the local builddir (which should always be '.')
32 ## In some older autotools, $(builddir) is not defined, so
33 ## just use '.' instead.
43 ## standard swig flags used by most components
45 STD_SWIG_PYTHON_ARGS = \
46 $(SWIG_PYTHON_FLAGS) \
47 $(STD_DEFINES_AND_INCLUDES) \
48 $(WITH_SWIG_INCLUDES) \
51 ## standard SWIG LD flags for library creation
53 STD_SWIG_LA_LD_FLAGS = \
59 ## standard SWIG library additions for library creation
61 STD_SWIG_LA_LIB_ADD = \
64 ## standard SWIG CXXFLAGS
65 ## This allows for code to be compiled with "-O1" instead of "-g -O2"
66 ## for some systems, avoiding some optimization issues.
68 STD_SWIG_CXX_FLAGS = @swig_CXXFLAGS@
70 ## SWIG suffix for automake to know about
74 ## Create $(srcdir)/Makefile.swig.gen, containing all of the rules
75 ## for running SWIG to generate or re-generate outputs. SWIG file
76 ## names are to be defined in TOP_SWIG_IFILES, and must include the
77 ## full path to the file and full filename including extension. This
78 ## Makefile addition will be made only if either it does not exist or
79 ## if the top-level template has been modified.
81 generate-makefile-swig $(srcdir)/Makefile.swig.gen: $(top_srcdir)/Makefile.swig.gen.t
82 ## recreate $(srcdir)/Makefile.swig.gen only if ...
84 if test -f $(srcdir)/Makefile.swig.gen; then \
85 ## the file exists and can be removed; or ...
86 if $(RM) $(srcdir)/Makefile.swig.gen 2>/dev/null; then \
87 if touch $(srcdir)/Makefile.swig.gen 2>/dev/null; then \
92 ## the file doesn't exist, but can be created (e.g., by touching it).
93 if touch $(srcdir)/Makefile.swig.gen 2>/dev/null; then \
97 if test "$$do_recreate" == "1"; then \
98 echo "Regenerating $(srcdir)/Makefile.swig.gen"; \
99 for TFILE in $(TOP_SWIG_IFILES); do \
100 ## retrieve just the filename, without path or extension
101 TNAME=`python -c "import os.path as op; (dN, fN) = op.split ('$$TFILE'); (fbN, fE) = op.splitext (fN); print fbN;"`; \
102 ## Replace the @-named strings in the template Makefile for SWIG.
103 $(SED) -e 's|@NAME@|'$$TNAME'|g;' < $(top_srcdir)/Makefile.swig.gen.t >> $(srcdir)/Makefile.swig.gen; \
104 echo "" >> $(srcdir)/Makefile.swig.gen; \
107 echo "Cannot recreate $(srcdir)/Makefile.swig.gen because the directory or file is write-protected."; \
113 ## include the built Makefile.swig.gen, always the one from the
114 ## srcdir; this must be included as the last item, because it depends
115 ## on variables defined above.
117 include $(srcdir)/Makefile.swig.gen