Merged r10554:10595 from michaelld/am_swig_4 into trunk. Major overhaul of SWIG...
[debian/gnuradio] / gr-usrp2 / src / Makefile.am
index 90796ceae9103e3742ee1f98bcc599e7ed008d19..bd9034f1ad51c0a8a664a2258ea0733bdf8f29e8 100644 (file)
 
 include $(top_srcdir)/Makefile.common
 
+# ----------------------------------------------------------------------
+# Local Python files, not installed
+#
+# qa_usrp2.py
+# ----------------------------------------------------------------------
+
+noinst_PYTHON = qa_usrp2.py
+
+# ----------------------------------------------------------------------
+# Miscellaneous build operations
+# ----------------------------------------------------------------------
+
+EXTRA_DIST = run_tests.in
+TESTS = run_tests
+DISTCLEANFILES = run_tests
+
 # ----------------------------------------------------------------------
 # C++ block API interface librar(ies)
 #
@@ -70,64 +86,28 @@ noinst_HEADERS = \
 # _usrp2.so
 # ----------------------------------------------------------------------
 
-# Python installation locations
-ourpythondir = $(grpythondir)
-ourlibdir    = $(grpyexecdir)
-
-# SWIG interface files
-LOCAL_IFILES = $(srcdir)/usrp2.i
-NON_LOCAL_IFILES = $(GNURADIO_I)
-ALL_IFILES = $(LOCAL_IFILES) $(NON_LOCAL_IFILES)               
-
-# Install the SWIG interface files
-swiginclude_HEADERS = $(LOCAL_IFILES)
+TOP_SWIG_IFILES =              \
+       usrp2.i
 
-# Generated by SWIG wrapper generator
-BUILT_SOURCES = usrp2.cc usrp2.py                      
+# Install so that they end up available as:
+#   import gnuradio.usrp2
+# This ends up at:
+#   ${prefix}/lib/python${python_version}/site-packages/gnuradio
+usrp2_pythondir_category =     \
+       gnuradio
 
-# Install the SWIG python output
-ourpython_PYTHON = usrp2.py
+# additional arguments to the SWIG command
+usrp2_swig_args =              \
+       $(USRP2_INCLUDES)
 
-# Special swig arguments
-LOCAL_SWIG_DEFINES_AND_INCLUDES = $(USRP2_INCLUDES)
+# additional libraries for linking with the SWIG-generated library
+usrp2_la_swig_libadd =         \
+       libgr-usrp2.la
 
-# Invoke SWIG wrapper generator
-usrp2.cc usrp2.py: $(ALL_IFILES)
-       $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module usrp2 \
-               -o usrp2.cc $(LOCAL_IFILES)
+include $(top_srcdir)/Makefile.swig
 
-# Create the Python shared library
-ourlib_LTLIBRARIES = _usrp2.la
-_usrp2_la_SOURCES = usrp2.cc
-_usrp2_la_CXXFLAGS = @swig_CXXFLAGS@
-_usrp2_la_LDFLAGS = $(swig_CXXFLAGS) $(NO_UNDEFINED) -module -avoid-version
+# add some of the variables generated inside the Makefile.swig.gen
+BUILT_SOURCES = $(swig_built_sources)
 
-# Link the library as needed
-_usrp2_la_LIBADD = \
-       $(PYTHON_LDFLAGS) \
-       libgr-usrp2.la \
-       $(GNURADIO_CORE_LA) \
-       $(USRP2_LIBS) \
-       -lstdc++
-
-# Don't distribute output of swig
-dist-hook:
-       @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done
-       @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done
-
-# ----------------------------------------------------------------------
-# Local Python files, not installed
-#
-# qa_usrp2.py
-# ----------------------------------------------------------------------
-
-noinst_PYTHON = qa_usrp2.py                    
-
-
-# ----------------------------------------------------------------------
-# Miscellaneous build operations
-# ----------------------------------------------------------------------
-
-EXTRA_DIST = run_tests.in
-TESTS = run_tests
-MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc
+# Do not distribute the output of SWIG
+no_dist_files = $(swig_built_sources)