summaryrefslogtreecommitdiff
path: root/gr-howto-write-a-block/Makefile.common
diff options
context:
space:
mode:
Diffstat (limited to 'gr-howto-write-a-block/Makefile.common')
-rw-r--r--gr-howto-write-a-block/Makefile.common34
1 files changed, 34 insertions, 0 deletions
diff --git a/gr-howto-write-a-block/Makefile.common b/gr-howto-write-a-block/Makefile.common
index 15a521698..0787b4eec 100644
--- a/gr-howto-write-a-block/Makefile.common
+++ b/gr-howto-write-a-block/Makefile.common
@@ -23,6 +23,10 @@
# The name of this "out-of-tree" module
modname = howto
+# Make rebuilds less verbose with stuff we can safely ignore
+# about GNU make only extensions.
+AUTOMAKE += -Wno-portability -Wnone
+
# these flags are used when compiling non-SWIG-wrapper files
# when going in to non-SWIG libraries
AM_CXXFLAGS = @autoconf_default_CXXFLAGS@
@@ -69,6 +73,36 @@ RM=$(RM_PROG) -f
STAMPS =
MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT
+## SWIG suffixes for automake to know about
+SUFFIXES = .i .scm .py
+
+if GUILE
+# Compile a .i to what guile needs. We use -o to set the output file name,
+# or even with -outdir guile in SWIG_GUILE_ARGS, swig keeps putting a
+# gnuradio_core_*_wrap.cxx in the source directory.
+gnuradio/%.scm : %.i
+ @echo "Compile .i to .scm"
+ @test -d "guile" || $(mkinstalldirs) "guile"
+ @test -d "gnuradio" || $(mkinstalldirs) "gnuradio"
+ $(SWIG) $(STD_SWIG_GUILE_ARGS) $($*_swig_args) \
+ -MD -MF guile/$*.Std \
+ -module $* -o guile/$*.cc $<
+ $(SED) -e 's|guile/\(.*\)\.cc:|gnuradio/\1.scm:|' guile/$*.Std > guile/$*.d
+ $(SED) -i -e 's/<--dummy-[0-9]\+-->/<top>/g' gnuradio/$*.scm
+ $(SED) -i -e 's/^(export /(export-safely /' gnuradio/$*.scm
+ $(RM) guile/$*.Std
+endif
+
+# Compile a .i file to what python needs
+.i.py:
+ @echo "Compile .i to .py"
+ @test -d "python" || $(mkinstalldirs) "python"
+ $(SWIG) $(STD_SWIG_PYTHON_ARGS) $($*_swig_args) \
+ -MD -MF python/$*.Std \
+ -module $* -o python/$*.cc -oh python/$*.h $<
+ $(SED) -e 's|python/\(.*\)\.cc:|\1.py:|' python/$*.Std > python/$*.d
+ $(RM) python/$*.Std
+
# Don't distribute the files defined in the variable 'no_dist_files'
dist-hook:
@for file in $(no_dist_files); do \