From d94769a975612072dc03fa378bc79856c07cd66b Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Sat, 30 Oct 2010 12:14:41 -0600 Subject: add load-extension support --- gr-howto-write-a-block/swig/howto.i | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/swig/howto.i b/gr-howto-write-a-block/swig/howto.i index 8dc502010..9a37ea228 100644 --- a/gr-howto-write-a-block/swig/howto.i +++ b/gr-howto-write-a-block/swig/howto.i @@ -9,3 +9,13 @@ %include "howto_square_ff.i" %include "howto_square2_ff.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-howto" "scm_init_gnuradio_howto_module") +%} + +%goops %{ +(use-modules (gnuradio gnuradio_core_runtime)) +%} +#endif -- cgit From e5473181c0df89735a65be5b00d27433fa0b4031 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 15 Nov 2010 19:06:30 -0700 Subject: add support for --enable-guile --- gr-howto-write-a-block/config/gr_standalone.m4 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/config/gr_standalone.m4 b/gr-howto-write-a-block/config/gr_standalone.m4 index 3f8ddf1d6..0e2ded584 100644 --- a/gr-howto-write-a-block/config/gr_standalone.m4 +++ b/gr-howto-write-a-block/config/gr_standalone.m4 @@ -125,6 +125,23 @@ m4_define([GR_STANDALONE], ) AM_CONDITIONAL([PYTHON], [test x$enable_python = xyes]) + AC_ARG_ENABLE([guile], + [AS_HELP_STRING([--enable-guile], + [generate SWIG/Guile components (default is yes)])], + [case "${enableval}" in + yes) enable_guile=yes ;; + no) enable_guile=no ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-guile]) ;; + esac], + [enable_guile=no] + ) + AM_CONDITIONAL([GUILE], [test x$enable_guile = xyes]) + + dnl see if GUILE is installed + if test x${enable_guile} == xyes; then + AC_PATH_PROG(GUILE,guile) + fi + dnl Define where to look for cppunit includes and libs dnl sets CPPUNIT_CFLAGS and CPPUNIT_LIBS dnl Try using pkg-config first, then fall back to cppunit-config. -- cgit From 4b3d08cca3095c180d2d2bcf24de907c1afa9bfc Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 15 Nov 2010 19:07:05 -0700 Subject: updated by bootstrap --- gr-howto-write-a-block/config.guess | 18 ++++----- gr-howto-write-a-block/config.sub | 76 ++++++++++--------------------------- 2 files changed, 28 insertions(+), 66 deletions(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/config.guess b/gr-howto-write-a-block/config.guess index 285237846..dc84c68ef 100755 --- a/gr-howto-write-a-block/config.guess +++ b/gr-howto-write-a-block/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2010-08-21' +timestamp='2009-11-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -56,9 +56,8 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free -Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -92,7 +91,7 @@ if test $# != 0; then exit 1 fi -trap 'exit 1' HUP INT TERM +trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires @@ -106,7 +105,7 @@ trap 'exit 1' HUP INT TERM set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || @@ -552,7 +551,7 @@ EOF echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[4567]) + *:AIX:*:[456]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 @@ -968,9 +967,6 @@ EOF sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-tilera-linux-gnu - exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; diff --git a/gr-howto-write-a-block/config.sub b/gr-howto-write-a-block/config.sub index 320e30388..2a55a5075 100755 --- a/gr-howto-write-a-block/config.sub +++ b/gr-howto-write-a-block/config.sub @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 # Free Software Foundation, Inc. -timestamp='2010-09-11' +timestamp='2009-11-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -75,9 +75,8 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free -Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -124,9 +123,8 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os @@ -283,7 +281,6 @@ case $basic_machine in | moxie \ | mt \ | msp430 \ - | nds32 | nds32le | nds32be \ | nios | nios2 \ | ns16k | ns32k \ | or32 \ @@ -297,7 +294,7 @@ case $basic_machine in | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu | strongarm \ - | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ + | tahoe | thumb | tic4x | tic80 | tron \ | ubicom32 \ | v850 | v850e \ | we32k \ @@ -305,15 +302,6 @@ case $basic_machine in | z8k | z80) basic_machine=$basic_machine-unknown ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; m6811 | m68hc11 | m6812 | m68hc12 | picochip) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -345,7 +333,7 @@ case $basic_machine in | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ @@ -379,7 +367,6 @@ case $basic_machine in | mmix-* \ | mt-* \ | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ @@ -393,8 +380,7 @@ case $basic_machine in | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile-* | tilegx-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | vax-* \ @@ -494,15 +480,6 @@ case $basic_machine in basic_machine=powerpc-ibm os=-cnk ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; c90) basic_machine=c90-cray os=-unicos @@ -862,12 +839,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -1102,10 +1073,17 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - # This must be matched before tile*. - tilegx*) - basic_machine=tilegx-unknown - os=-linux-gnu + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff ;; tile*) basic_machine=tile-unknown @@ -1316,8 +1294,7 @@ case $os in | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ @@ -1458,8 +1435,6 @@ case $os in -dicos*) os=-dicos ;; - -nacl*) - ;; -none) ;; *) @@ -1500,15 +1475,6 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 -- cgit From c8835c285c6abbc334701238f53f87f93e6f125a Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 15 Nov 2010 19:08:28 -0700 Subject: make howto build the new way --- gr-howto-write-a-block/Makefile.common | 34 ++++ gr-howto-write-a-block/Makefile.swig | 35 +++- gr-howto-write-a-block/Makefile.swig.gen.t | 220 ++++++-------------------- gr-howto-write-a-block/swig/Makefile.am | 35 ++-- gr-howto-write-a-block/swig/Makefile.swig.gen | 220 ++++++-------------------- 5 files changed, 181 insertions(+), 363 deletions(-) (limited to 'gr-howto-write-a-block') 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]\+-->//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 \ diff --git a/gr-howto-write-a-block/Makefile.swig b/gr-howto-write-a-block/Makefile.swig index 9e14835e5..231ae4ebe 100644 --- a/gr-howto-write-a-block/Makefile.swig +++ b/gr-howto-write-a-block/Makefile.swig @@ -32,6 +32,9 @@ ## In some older autotools, $(builddir) is not defined, so ## just use '.' instead. +CLEANFILES = python/*.cc python/*.h python/*.lo python/*.o +CLEANFILES += guile/*.cc gnuradio/*.scm guile/*.lo guile/*.o + SWIG_PYTHON_FLAGS = \ -fvirtual \ -python \ @@ -40,14 +43,34 @@ SWIG_PYTHON_FLAGS = \ -w511 \ -outdir . -## standard swig flags used by most components - STD_SWIG_PYTHON_ARGS = \ $(SWIG_PYTHON_FLAGS) \ $(STD_DEFINES_AND_INCLUDES) \ $(WITH_SWIG_INCLUDES) \ $(WITH_INCLUDES) +# NOTE: -Linkage passive and -Linkage module don't define SWIG_init() +SWIG_GUILE_FLAGS = \ + -guile \ + -scm \ + -scmstub \ + -package gnuradio \ + -Linkage module \ + -proxy \ + -goopsprefix gr: \ + -emit-slot-accessors \ + -emit-setters \ + -outdir . + +## standard swig flags used by most components + +STD_SWIG_GUILE_ARGS = \ + $(SWIG_GUILE_FLAGS) \ + $(STD_DEFINES_AND_INCLUDES) \ + $(WITH_SWIG_INCLUDES) \ + $(WITH_INCLUDES) \ + -I$(GNURADIO_CORE_INCLUDEDIR)/swig/guile + ## standard SWIG LD flags for library creation STD_SWIG_LA_LD_FLAGS = \ @@ -58,8 +81,7 @@ STD_SWIG_LA_LD_FLAGS = \ ## standard SWIG library additions for library creation -STD_SWIG_LA_LIB_ADD = \ - -lstdc++ +STD_SWIG_LA_LIB_ADD = -lstdc++ ## standard SWIG CXXFLAGS ## This allows for code to be compiled with "-O1" instead of "-g -O2" @@ -67,10 +89,6 @@ STD_SWIG_LA_LIB_ADD = \ STD_SWIG_CXX_FLAGS = @swig_CXXFLAGS@ -## SWIG suffix for automake to know about - -SUFFIXES = .i - ## Create $(srcdir)/Makefile.swig.gen, containing all of the rules ## for running SWIG to generate or re-generate outputs. SWIG file ## names are to be defined in TOP_SWIG_IFILES, and must include the @@ -115,3 +133,4 @@ swig_built_sources = ## on variables defined above. include $(srcdir)/Makefile.swig.gen + diff --git a/gr-howto-write-a-block/Makefile.swig.gen.t b/gr-howto-write-a-block/Makefile.swig.gen.t index 686117f83..9603ec3a5 100644 --- a/gr-howto-write-a-block/Makefile.swig.gen.t +++ b/gr-howto-write-a-block/Makefile.swig.gen.t @@ -25,16 +25,28 @@ ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/@NAME@ +## ${prefix}/lib/python${python_version}/site-packages/[category]/@NAME@ ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/@NAME@ +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/@NAME@ ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -@NAME@_pythondir = $(pythondir)/@NAME@ -@NAME@_pylibdir = $(pyexecdir)/@NAME@ +@NAME@_pythondir_category ?= gnuradio/@NAME@ +@NAME@_pylibdir_category ?= $(@NAME@_pythondir_category) +@NAME@_pythondir = $(pythondir)/$(@NAME@_pythondir_category) +@NAME@_pylibdir = $(pyexecdir)/$(@NAME@_pylibdir_category) + +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +@NAME@_scmlibdir = $(libdir) + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/@NAME@ +# FIXME: determince whether these should be installed with gnuradio. +@NAME@_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -55,23 +67,10 @@ ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/@NAME@-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -swig_built_sources += @NAME@_swig.py @NAME@_swig.cc - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -81,176 +80,53 @@ swig_built_sources += @NAME@_swig.py @NAME@_swig.cc $(@NAME@_swiginclude_headers) @NAME@_pylib_LTLIBRARIES = \ - _@NAME@_swig.la + _@NAME@.la -_@NAME@_swig_la_SOURCES = \ - @NAME@_swig.cc \ +_@NAME@_la_SOURCES = \ + python/@NAME@.cc \ $(@NAME@_la_swig_sources) -_@NAME@_swig_la_LIBADD = \ +_@NAME@_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(@NAME@_la_swig_libadd) -_@NAME@_swig_la_LDFLAGS = \ +_@NAME@_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(@NAME@_la_swig_ldflags) -_@NAME@_swig_la_CXXFLAGS = \ +_@NAME@_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(@NAME@_la_swig_cxxflags) @NAME@_python_PYTHON = \ - @NAME@_swig.py \ - $(@NAME@_python) + @NAME@.py \ + $(@NAME@) -## Entry rule for running SWIG +python/@NAME@.cc: @NAME@.py +@NAME@.py: @NAME@.i -@NAME@.h @NAME@_swig.py @NAME@_swig.cc: @NAME@.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/@NAME@-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/@NAME@-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/@NAME@-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/@NAME@-generate-stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/@NAME@-generate-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/@NAME@-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/@NAME@-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/@NAME@-generate-stamp; \ - exit $$?; \ - fi; +# Include the python dependencies for this file +-include python/@NAME@.d +# end of PYTHON -$(DEPDIR)/@NAME@-generate-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(@NAME@_swig_args) \ - -MD -MF $(DEPDIR)/@NAME@.Std \ - -module @NAME@_swig -o @NAME@_swig.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/@NAME@.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/@NAME@.Std \ - > $(DEPDIR)/@NAME@.Sd; \ - $(RM) $(DEPDIR)/@NAME@.Std; \ - $(MV) $(DEPDIR)/@NAME@.Sd $(DEPDIR)/@NAME@.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/@NAME@.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/@NAME@.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/@NAME@.Std $(DEPDIR)/@NAME@.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/@NAME@.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/@NAME@.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/@NAME@.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/@NAME@.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/@NAME@-generate-stamp +if GUILE +@NAME@_scmlib_LTLIBRARIES = libguile-@NAME@.la +libguile_@NAME@_la_SOURCES = \ + guile/@NAME@.cc \ + $(@NAME@_la_swig_sources) +nobase_@NAME@_scm_DATA = gnuradio/@NAME@.scm gnuradio/@NAME@-primitive.scm + +libguile_@NAME@_la_LIBADD = $(_@NAME@_la_LIBADD) +libguile_@NAME@_la_LDFLAGS = $(_@NAME@_la_LDFLAGS) +libguile_@NAME@_la_CXXFLAGS = $(_@NAME@_la_CXXFLAGS) + +guile/@NAME@.cc: gnuradio/@NAME@.scm +gnuradio/@NAME@.scm: @NAME@.i +gnuradio/@NAME@-primitive.scm: gnuradio/@NAME@.scm + +# Include the guile dependencies for this file +-include guile/@NAME@.d -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. +endif # end of GUILE -@am__include@ @am__quote@./$(DEPDIR)/@NAME@.d@am__quote@ diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index 4737ad619..a57834683 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -20,8 +20,19 @@ # include $(top_srcdir)/Makefile.common +include $(top_srcdir)/Makefile.swig + +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) + +CLEANFILES = python/*.cc python/*.h python/*.d +if GUILE +CLEANFILES += guile/*.cc gnuradio/*.scm guile/*.d +endif -AM_CPPFLAGS += -I$(top_srcdir)/lib +AM_CPPFLAGS += -I$(top_srcdir)/lib + +swig_built_sources = if PYTHON ################################### @@ -34,21 +45,23 @@ TOP_SWIG_IFILES = \ # import howto # This ends up at: # ${prefix}/lib/python${python_version}/site-packages/$(modname) - howto_la_swig_libadd = \ $(top_builddir)/lib/libgnuradio-howto.la -include $(top_srcdir)/Makefile.swig - -# add some of the variables generated inside the Makefile.swig.gen -BUILT_SOURCES = $(swig_built_sources) - -# Do not distribute the output of SWIG -no_dist_files = $(swig_built_sources) - # additional SWIG files to be installed -howto_swiginclude_headers = \ +aqhowto_swiginclude_headers = \ howto_square_ff.i \ howto_square2_ff.i +PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) +swig_built_sources += $(PYTHON_GEN) endif + +if GUILE +GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) +swig_built_sources += $(GUILE_GEN) +endif + +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) + diff --git a/gr-howto-write-a-block/swig/Makefile.swig.gen b/gr-howto-write-a-block/swig/Makefile.swig.gen index 6c6e66290..b42bd12a3 100644 --- a/gr-howto-write-a-block/swig/Makefile.swig.gen +++ b/gr-howto-write-a-block/swig/Makefile.swig.gen @@ -25,16 +25,28 @@ ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/howto +## ${prefix}/lib/python${python_version}/site-packages/[category]/howto ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/howto +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/howto ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -howto_pythondir = $(pythondir)/howto -howto_pylibdir = $(pyexecdir)/howto +howto_pythondir_category ?= gnuradio/howto +howto_pylibdir_category ?= $(howto_pythondir_category) +howto_pythondir = $(pythondir)/$(howto_pythondir_category) +howto_pylibdir = $(pyexecdir)/$(howto_pylibdir_category) + +# The .so libraries for the guile modules get installed whereever guile +# is installed, usually /usr/lib/guile/gnuradio/ +# FIXME: determince whether these should be installed with gnuradio. +howto_scmlibdir = $(libdir) + +# The scm files for the guile modules get installed where ever guile +# is installed, usually /usr/share/guile/site/howto +# FIXME: determince whether these should be installed with gnuradio. +howto_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. @@ -55,23 +67,10 @@ howto_swigincludedir = $(swigincludedir) ## right thing. For more info, see < ## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > -## Stamps used to ensure parallel make does the right thing. These -## are removed by "make clean", but otherwise unused except during the -## parallel built. These will not be included in a tarball, because -## the SWIG-generated files will be removed from the distribution. - -STAMPS += $(DEPDIR)/howto-generate-* - ## Other cleaned files: dependency files generated by SWIG or this Makefile MOSTLYCLEANFILES += $(DEPDIR)/*.S* -## Add the .py and .cc files to the list of SWIG built sources. The -## .h file is sometimes built, but not always ... so that one has to -## be added manually by the including Makefile.am . - -swig_built_sources += howto_swig.py howto_swig.cc - ## Various SWIG variables. These can be overloaded in the including ## Makefile.am by setting the variable value there, then including ## Makefile.swig . @@ -81,177 +80,54 @@ howto_swiginclude_HEADERS = \ $(howto_swiginclude_headers) howto_pylib_LTLIBRARIES = \ - _howto_swig.la + _howto.la -_howto_swig_la_SOURCES = \ - howto_swig.cc \ +_howto_la_SOURCES = \ + python/howto.cc \ $(howto_la_swig_sources) -_howto_swig_la_LIBADD = \ +_howto_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(howto_la_swig_libadd) -_howto_swig_la_LDFLAGS = \ +_howto_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ $(howto_la_swig_ldflags) -_howto_swig_la_CXXFLAGS = \ +_howto_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ $(howto_la_swig_cxxflags) howto_python_PYTHON = \ - howto_swig.py \ - $(howto_python) + howto.py \ + $(howto) -## Entry rule for running SWIG +python/howto.cc: howto.py +howto.py: howto.i -howto.h howto_swig.py howto_swig.cc: howto.i -## This rule will get called only when MAKE decides that one of the -## targets needs to be created or re-created, because: -## -## * The .i file is newer than any or all of the generated files; -## -## * Any or all of the .cc, .h, or .py files does not exist and is -## needed (in the case this file is not needed, the rule for it is -## ignored); or -## -## * Some SWIG-based dependecy of the .cc file isn't met and hence the -## .cc file needs be be regenerated. Explanation: Because MAKE -## knows how to handle dependencies for .cc files (regardless of -## their name or extension), then the .cc file is used as a target -## instead of the .i file -- but with the dependencies of the .i -## file. It is this last reason why the line: -## -## if test -f $@; then :; else -## -## cannot be used in this case: If a .i file dependecy is not met, -## then the .cc file needs to be rebuilt. But if the stamp is newer -## than the .cc file, and the .cc file exists, then in the original -## version (with the 'test' above) the internal MAKE call will not -## be issued and hence the .cc file will not be rebuilt. -## -## Once execution gets to here, it should always proceed no matter the -## state of a stamp (as discussed in link above). The -## $(DEPDIR)/howto-generate stuff is used to allow for parallel -## builds to "do the right thing". The stamp has no relationship with -## either the target files or dependency file; it is used solely for -## the protection of multiple builds during a given call to MAKE. -## -## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM -## (15). At a caught signal, the quoted command will be issued before -## exiting. In this case, remove any stamp, whether temporary of not. -## The trap is valid until the process exits; the process includes all -## commands appended via "\"s. -## - trap 'rm -rf $(DEPDIR)/howto-generate-*' 1 2 13 15; \ -## -## Create a temporary directory, which acts as a lock. The first -## process to create the directory will succeed and issue the MAKE -## command to do the actual work, while all subsequent processes will -## fail -- leading them to wait for the first process to finish. -## - if mkdir $(DEPDIR)/howto-generate-lock 2>/dev/null; then \ -## -## This code is being executed by the first process to succeed in -## creating the directory lock. -## -## Remove the stamp associated with this filename. -## - rm -f $(DEPDIR)/howto-generate-stamp; \ -## -## Tell MAKE to run the rule for creating this stamp. -## - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/howto-generate-stamp WHAT=$<; \ -## -## Now that the .cc, .h, and .py files have been (re)created from the -## .i file, future checking of this rule during the same MAKE -## execution will come back that the rule doesn't need to be executed -## because none of the conditions mentioned at the start of this rule -## will be positive. Remove the the directory lock, which frees up -## any waiting process(es) to continue. -## - rmdir $(DEPDIR)/howto-generate-lock; \ - else \ -## -## This code is being executed by any follower processes while the -## directory lock is in place. -## -## Wait until the first process is done, testing once per second. -## - while test -d $(DEPDIR)/howto-generate-lock; do \ - sleep 1; \ - done; \ -## -## Succeed if and only if the first process succeeded; exit this -## process returning the status of the generated stamp. -## - test -f $(DEPDIR)/howto-generate-stamp; \ - exit $$?; \ - fi; +# Include the python dependencies for this file +-include python/howto.d +# end of PYTHON -$(DEPDIR)/howto-generate-stamp: -## This rule will be called only by the first process issuing the -## above rule to succeed in creating the lock directory, after -## removing the actual stamp file in order to guarantee that MAKE will -## execute this rule. -## -## Call SWIG to generate the various output files; special -## post-processing on 'mingw32' host OS for the dependency file. -## - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(howto_swig_args) \ - -MD -MF $(DEPDIR)/howto.Std \ - -module howto_swig -o howto_swig.cc $(WHAT); then \ - if test $(host_os) = mingw32; then \ - $(RM) $(DEPDIR)/howto.Sd; \ - $(SED) 's,\\\\,/,g' < $(DEPDIR)/howto.Std \ - > $(DEPDIR)/howto.Sd; \ - $(RM) $(DEPDIR)/howto.Std; \ - $(MV) $(DEPDIR)/howto.Sd $(DEPDIR)/howto.Std; \ - fi; \ - else \ - $(RM) $(DEPDIR)/howto.S*; exit 1; \ - fi; -## -## Mess with the SWIG output .Std dependency file, to create a -## dependecy file valid for the input .i file: Basically, simulate the -## dependency file created for libraries by GNU's libtool for C++, -## where all of the dependencies for the target are first listed, then -## each individual dependency is listed as a target with no further -## dependencies. -## -## (1) remove the current dependency file -## - $(RM) $(DEPDIR)/howto.d -## -## (2) Copy the whole SWIG file: -## - cp $(DEPDIR)/howto.Std $(DEPDIR)/howto.d -## -## (3) all a carriage return to the end of the dependency file. -## - echo "" >> $(DEPDIR)/howto.d -## -## (4) from the SWIG file, remove the first line (the target); remove -## trailing " \" and " " from each line. Append ":" to each line, -## followed by 2 carriage returns, then append this to the end of -## the dependency file. -## - $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/howto.Std | \ - awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/howto.d -## -## (5) remove the SWIG-generated file -## - $(RM) $(DEPDIR)/howto.Std -## -## Create the stamp for this filename generation, to signal success in -## executing this rule; allows other threads waiting on this process -## to continue. -## - touch $(DEPDIR)/howto-generate-stamp +if GUILE +howto_scmlib_LTLIBRARIES = libguile-howto.la +libguile_howto_la_SOURCES = \ + guile/howto.cc \ + $(howto_la_swig_sources) +nobase_howto_scm_DATA = gnuradio/howto.scm gnuradio/howto-primitive.scm + +libguile_howto_la_LIBADD = $(_howto_la_LIBADD) +libguile_howto_la_LDFLAGS = $(_howto_la_LDFLAGS) +libguile_howto_la_CXXFLAGS = $(_howto_la_CXXFLAGS) + +guile/howto.cc: gnuradio/howto.scm +gnuradio/howto.scm: howto.i +gnuradio/howto-primitive.scm: gnuradio/howto.scm + +# Include the guile dependencies for this file +-include guile/howto.d -# KLUDGE: Force runtime include of a SWIG dependency file. This is -# not guaranteed to be portable, but will probably work. If it works, -# we have accurate dependencies for our swig stuff, which is good. +endif # end of GUILE -@am__include@ @am__quote@./$(DEPDIR)/howto.d@am__quote@ -- cgit From f0ed1de2d15b24eae7be7ab8a4762a6fd74ff681 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Mon, 15 Nov 2010 19:20:13 -0700 Subject: add other .i files to EXTRA_DIST so it'll almost distcheck --- gr-howto-write-a-block/swig/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index a57834683..17c4334f6 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -53,6 +53,8 @@ aqhowto_swiginclude_headers = \ howto_square_ff.i \ howto_square2_ff.i +EXTRA_DIST = $(aqhowto_swiginclude_headers) + PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) swig_built_sources += $(PYTHON_GEN) endif -- cgit From 3c1c531408f3afaa465341b03b7f4f565ef53a0e Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 16 Nov 2010 21:32:58 -0800 Subject: Add _python that was dropped from Makefile.swig.gen.t --- gr-howto-write-a-block/Makefile.swig.gen.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/Makefile.swig.gen.t b/gr-howto-write-a-block/Makefile.swig.gen.t index 9603ec3a5..5be0ac4aa 100644 --- a/gr-howto-write-a-block/Makefile.swig.gen.t +++ b/gr-howto-write-a-block/Makefile.swig.gen.t @@ -101,7 +101,7 @@ _@NAME@_la_CXXFLAGS = \ @NAME@_python_PYTHON = \ @NAME@.py \ - $(@NAME@) + $(@NAME@_python) python/@NAME@.cc: @NAME@.py @NAME@.py: @NAME@.i -- cgit From 8180bb1d7020e07c9b0a217820c68d07f0d98a74 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 16 Nov 2010 21:33:50 -0800 Subject: regenerated --- gr-howto-write-a-block/swig/Makefile.swig.gen | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/swig/Makefile.swig.gen b/gr-howto-write-a-block/swig/Makefile.swig.gen index b42bd12a3..72d8a09aa 100644 --- a/gr-howto-write-a-block/swig/Makefile.swig.gen +++ b/gr-howto-write-a-block/swig/Makefile.swig.gen @@ -101,7 +101,7 @@ _howto_la_CXXFLAGS = \ howto_python_PYTHON = \ howto.py \ - $(howto) + $(howto_python) python/howto.cc: howto.py howto.py: howto.i -- cgit From cfb2ff29a33e05b74cc80f3b68609af6bafc96ca Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 17 Nov 2010 08:17:12 -0800 Subject: Update .gitignore --- gr-howto-write-a-block/swig/.gitignore | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/swig/.gitignore b/gr-howto-write-a-block/swig/.gitignore index 7f4c478d9..696b1ae84 100644 --- a/gr-howto-write-a-block/swig/.gitignore +++ b/gr-howto-write-a-block/swig/.gitignore @@ -4,3 +4,6 @@ /Makefile /howto_swig.cc /howto_swig.py +/gnuradio +/guile +/python -- cgit From d692a41f98e7b888c745efbb9fcbbb0400f39025 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Wed, 24 Nov 2010 17:29:11 -0800 Subject: Major Makefile.am housecleaning. Passes distcheck. Move all occurrences of swig_built_sources out of Makefile.am's. Move all SWIG related use of BUILT_SOURCES out of Makefile.am's. Clean up 'if PYTHON' conditionalization in gr-* Still left to do: fix Makefile.swig CLEANFILES and no_dist_files such that they remove exactly the generated files. --- gr-howto-write-a-block/Makefile.am | 2 +- gr-howto-write-a-block/config/Makefile.am | 4 ++-- gr-howto-write-a-block/python/Makefile.am | 2 +- gr-howto-write-a-block/swig/Makefile.am | 30 +++--------------------------- 4 files changed, 7 insertions(+), 31 deletions(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/Makefile.am b/gr-howto-write-a-block/Makefile.am index 98368c211..bf3c4294d 100644 --- a/gr-howto-write-a-block/Makefile.am +++ b/gr-howto-write-a-block/Makefile.am @@ -23,7 +23,7 @@ ACLOCAL_AMFLAGS = -I config include $(top_srcdir)/Makefile.common -EXTRA_DIST = \ +EXTRA_DIST += \ bootstrap \ configure \ config.h.in \ diff --git a/gr-howto-write-a-block/config/Makefile.am b/gr-howto-write-a-block/config/Makefile.am index 23f4a4b16..e0cbadb8b 100644 --- a/gr-howto-write-a-block/config/Makefile.am +++ b/gr-howto-write-a-block/config/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001 Free Software Foundation, Inc. +# Copyright 2001,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -80,4 +80,4 @@ m4macros = \ # Don't install m4 macros anymore # m4data_DATA = $(m4macros) -EXTRA_DIST = $(m4macros) +EXTRA_DIST += $(m4macros) diff --git a/gr-howto-write-a-block/python/Makefile.am b/gr-howto-write-a-block/python/Makefile.am index ae36ea665..5c4fbd3a8 100644 --- a/gr-howto-write-a-block/python/Makefile.am +++ b/gr-howto-write-a-block/python/Makefile.am @@ -21,8 +21,8 @@ include $(top_srcdir)/Makefile.common -EXTRA_DIST = run_tests.in TESTS = run_tests +EXTRA_DIST += run_tests.in modpython_PYTHON = \ __init__.py diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index 17c4334f6..c6b1786f6 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -22,21 +22,10 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig -# add some of the variables generated inside the Makefile.swig.gen -BUILT_SOURCES = $(swig_built_sources) - -CLEANFILES = python/*.cc python/*.h python/*.d -if GUILE -CLEANFILES += guile/*.cc gnuradio/*.scm guile/*.d -endif - AM_CPPFLAGS += -I$(top_srcdir)/lib -swig_built_sources = - -if PYTHON ################################### -# SWIG Python interface and library +# SWIG interfaces and libraries TOP_SWIG_IFILES = \ howto.i @@ -49,21 +38,8 @@ howto_la_swig_libadd = \ $(top_builddir)/lib/libgnuradio-howto.la # additional SWIG files to be installed -aqhowto_swiginclude_headers = \ +howto_swiginclude_headers = \ howto_square_ff.i \ howto_square2_ff.i -EXTRA_DIST = $(aqhowto_swiginclude_headers) - -PYTHON_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(HFILE))) -swig_built_sources += $(PYTHON_GEN) -endif - -if GUILE -GUILE_GEN = $(foreach HFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(HFILE))) -swig_built_sources += $(GUILE_GEN) -endif - -# Do not distribute the output of SWIG -no_dist_files = $(swig_built_sources) - +EXTRA_DIST += $(howto_swiginclude_headers) -- cgit From 0b5f66113f43d2ba94a1ca741b5ce65e1f9f2c02 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:30:54 -0800 Subject: Rename libguile- to libguile-gnuradio- to match guile library naming convention. The stuff in gnuradio-core ends up with funky names, but that could be fixed by renaming gnuradio_core_filter.i -> core_filter.i etc. --- gr-howto-write-a-block/swig/howto.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/swig/howto.i b/gr-howto-write-a-block/swig/howto.i index 9a37ea228..868df5739 100644 --- a/gr-howto-write-a-block/swig/howto.i +++ b/gr-howto-write-a-block/swig/howto.i @@ -12,7 +12,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-howto" "scm_init_gnuradio_howto_module") +(load-extension "libguile-gnuradio-howto" "scm_init_gnuradio_howto_module") %} %goops %{ -- cgit From 7a7a4b7ad1ccdb0c1f6814e6c258b1238fd92fd7 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:40:22 -0800 Subject: Fix EXTRA_DIST in gr-howto-write-a-block --- gr-howto-write-a-block/Makefile.am | 2 +- gr-howto-write-a-block/config/Makefile.am | 2 +- gr-howto-write-a-block/python/Makefile.am | 2 +- gr-howto-write-a-block/swig/Makefile.am | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/Makefile.am b/gr-howto-write-a-block/Makefile.am index bf3c4294d..98368c211 100644 --- a/gr-howto-write-a-block/Makefile.am +++ b/gr-howto-write-a-block/Makefile.am @@ -23,7 +23,7 @@ ACLOCAL_AMFLAGS = -I config include $(top_srcdir)/Makefile.common -EXTRA_DIST += \ +EXTRA_DIST = \ bootstrap \ configure \ config.h.in \ diff --git a/gr-howto-write-a-block/config/Makefile.am b/gr-howto-write-a-block/config/Makefile.am index e0cbadb8b..eb2ee6283 100644 --- a/gr-howto-write-a-block/config/Makefile.am +++ b/gr-howto-write-a-block/config/Makefile.am @@ -80,4 +80,4 @@ m4macros = \ # Don't install m4 macros anymore # m4data_DATA = $(m4macros) -EXTRA_DIST += $(m4macros) +EXTRA_DIST = $(m4macros) diff --git a/gr-howto-write-a-block/python/Makefile.am b/gr-howto-write-a-block/python/Makefile.am index 5c4fbd3a8..c216cca29 100644 --- a/gr-howto-write-a-block/python/Makefile.am +++ b/gr-howto-write-a-block/python/Makefile.am @@ -22,7 +22,7 @@ include $(top_srcdir)/Makefile.common TESTS = run_tests -EXTRA_DIST += run_tests.in +EXTRA_DIST = run_tests.in modpython_PYTHON = \ __init__.py diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index c6b1786f6..d55c8070d 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -42,4 +42,4 @@ howto_swiginclude_headers = \ howto_square_ff.i \ howto_square2_ff.i -EXTRA_DIST += $(howto_swiginclude_headers) +EXTRA_DIST = $(howto_swiginclude_headers) -- cgit From ea8a60ad9c2e0f9bdc57f77f5506c5906f8d1d6f Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 3 Dec 2010 23:58:48 -0800 Subject: Make gr-howto-write-a-block work again... Copied Makefile.swig, Mkefile.swig.gen.t from .. Renamed howto.i to howto_swig.i Regenerated Makefile.swig.gen --- gr-howto-write-a-block/Makefile.common | 10 +++ gr-howto-write-a-block/Makefile.swig | 72 ++++++++++++++---- gr-howto-write-a-block/Makefile.swig.gen.t | 36 ++++++--- gr-howto-write-a-block/swig/Makefile.am | 4 +- gr-howto-write-a-block/swig/Makefile.swig.gen | 102 ++++++++++++++------------ gr-howto-write-a-block/swig/howto.i | 21 ------ gr-howto-write-a-block/swig/howto_swig.i | 21 ++++++ 7 files changed, 172 insertions(+), 94 deletions(-) delete mode 100644 gr-howto-write-a-block/swig/howto.i create mode 100644 gr-howto-write-a-block/swig/howto_swig.i (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/Makefile.common b/gr-howto-write-a-block/Makefile.common index 0787b4eec..cfcbce9c8 100644 --- a/gr-howto-write-a-block/Makefile.common +++ b/gr-howto-write-a-block/Makefile.common @@ -20,6 +20,16 @@ # Boston, MA 02110-1301, USA. # +# Every Makefile starts with common vars so we can +# consistently use += +BUILT_SOURCES = +MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT +CLEANFILES = guile.log +DISTCLEANFILES = +#EXTRA_DIST = +STAMPS = + + # The name of this "out-of-tree" module modname = howto diff --git a/gr-howto-write-a-block/Makefile.swig b/gr-howto-write-a-block/Makefile.swig index 231ae4ebe..327b566e1 100644 --- a/gr-howto-write-a-block/Makefile.swig +++ b/gr-howto-write-a-block/Makefile.swig @@ -1,6 +1,6 @@ # -*- Makefile -*- # -# Copyright 2009 Free Software Foundation, Inc. +# Copyright 2009,2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -25,6 +25,11 @@ ## in Makefile.am's which require SWIG wrapping / compilation. ## For just installing .i files, this Makefile is not required. + +## include the built Makefile.swig.gen, always the one from the srcdir +include $(srcdir)/Makefile.swig.gen + + ## swig flags ## -w511 turns off keyword argument warning ## "-outdir $(builddir)" writes all generated output files to @@ -32,9 +37,6 @@ ## In some older autotools, $(builddir) is not defined, so ## just use '.' instead. -CLEANFILES = python/*.cc python/*.h python/*.lo python/*.o -CLEANFILES += guile/*.cc gnuradio/*.scm guile/*.lo guile/*.o - SWIG_PYTHON_FLAGS = \ -fvirtual \ -python \ @@ -68,8 +70,7 @@ STD_SWIG_GUILE_ARGS = \ $(SWIG_GUILE_FLAGS) \ $(STD_DEFINES_AND_INCLUDES) \ $(WITH_SWIG_INCLUDES) \ - $(WITH_INCLUDES) \ - -I$(GNURADIO_CORE_INCLUDEDIR)/swig/guile + $(WITH_INCLUDES) ## standard SWIG LD flags for library creation @@ -89,6 +90,57 @@ STD_SWIG_LA_LIB_ADD = -lstdc++ STD_SWIG_CXX_FLAGS = @swig_CXXFLAGS@ +# We drive the dependencies off of swig_built_sources. This variable +# ends up containing only the generated .py and/or .scm files, not the .h +# or .cc files. This allows us to use the pattern rules in +# Makefile.common to generate all the pieces without the parallel make +# problems that occur when both the .py's and .cc's are in swig_built_sources. + +swig_built_sources = + +# swig_all_built_sources contains swig_built_sources plus the .cc and .h files. +# It contains the files to remove from the distribution and the files to +# remove for make clean. + +swig_all_built_sources = + +if PYTHON +# Create a list of .py files based on the top level .i files. +PYTHON_GEN = $(foreach IFILE,$(TOP_SWIG_IFILES), $(subst .i,.py,$(IFILE))) +swig_built_sources += $(PYTHON_GEN) +swig_all_built_sources += $(PYTHON_GEN) + +# Now add .h, .cc to _all_ +swig_all_built_sources += $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,python/%.h,$(IFILE))) +swig_all_built_sources += $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,python/%.cc,$(IFILE))) +endif + +if GUILE +# Create a list of .scm files based on the top level .i files. +GUILE_GEN = $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%.scm,$(IFILE))) +swig_built_sources += $(GUILE_GEN) +swig_all_built_sources += $(GUILE_GEN) + +# Now add -primitive.scm, .cc to _all_ +swig_all_built_sources += $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,gnuradio/%-primitive.scm,$(IFILE))) +swig_all_built_sources += $(foreach IFILE,$(TOP_SWIG_IFILES), $(patsubst %.i,guile/%.cc,$(IFILE))) +endif + +# N.B. Only $(swig_built_sources), not $(swig_all_built_sources) +BUILT_SOURCES += $(swig_built_sources) + +# Don't distribute any of the swig generated files +no_dist_files = $(swig_all_built_sources) + +CLEANFILES += $(swig_all_built_sources) +CLEANFILES += python/*.lo python/*.o python/*.d +CLEANFILES += guile/*.lo guile/*.o guile/*.d + + +## ------------------------------------------------------------------------ +## Rule that (re)generates Makefile.swig.gen using TOP_SWIG_IFILES and +## Makefile.swig.gen.t +## ## Create $(srcdir)/Makefile.swig.gen, containing all of the rules ## for running SWIG to generate or re-generate outputs. SWIG file ## names are to be defined in TOP_SWIG_IFILES, and must include the @@ -126,11 +178,3 @@ generate-makefile-swig $(srcdir)/Makefile.swig.gen: $(top_srcdir)/Makefile.swig. exit -1; \ fi; -swig_built_sources = - -## include the built Makefile.swig.gen, always the one from the -## srcdir; this must be included as the last item, because it depends -## on variables defined above. - -include $(srcdir)/Makefile.swig.gen - diff --git a/gr-howto-write-a-block/Makefile.swig.gen.t b/gr-howto-write-a-block/Makefile.swig.gen.t index 5be0ac4aa..4d37e0e21 100644 --- a/gr-howto-write-a-block/Makefile.swig.gen.t +++ b/gr-howto-write-a-block/Makefile.swig.gen.t @@ -79,6 +79,7 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* @NAME@.i \ $(@NAME@_swiginclude_headers) +if PYTHON @NAME@_pylib_LTLIBRARIES = \ _@NAME@.la @@ -86,6 +87,10 @@ _@NAME@_la_SOURCES = \ python/@NAME@.cc \ $(@NAME@_la_swig_sources) +@NAME@_python_PYTHON = \ + @NAME@.py \ + $(@NAME@_python) + _@NAME@_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ $(@NAME@_la_swig_libadd) @@ -99,27 +104,34 @@ _@NAME@_la_CXXFLAGS = \ -I$(top_builddir) \ $(@NAME@_la_swig_cxxflags) -@NAME@_python_PYTHON = \ - @NAME@.py \ - $(@NAME@_python) - python/@NAME@.cc: @NAME@.py @NAME@.py: @NAME@.i # Include the python dependencies for this file -include python/@NAME@.d -# end of PYTHON + +endif # end of if python if GUILE -@NAME@_scmlib_LTLIBRARIES = libguile-@NAME@.la -libguile_@NAME@_la_SOURCES = \ + +@NAME@_scmlib_LTLIBRARIES = \ + libguile-gnuradio-@NAME@.la +libguile_gnuradio_@NAME@_la_SOURCES = \ guile/@NAME@.cc \ $(@NAME@_la_swig_sources) -nobase_@NAME@_scm_DATA = gnuradio/@NAME@.scm gnuradio/@NAME@-primitive.scm - -libguile_@NAME@_la_LIBADD = $(_@NAME@_la_LIBADD) -libguile_@NAME@_la_LDFLAGS = $(_@NAME@_la_LDFLAGS) -libguile_@NAME@_la_CXXFLAGS = $(_@NAME@_la_CXXFLAGS) +nobase_@NAME@_scm_DATA = \ + gnuradio/@NAME@.scm \ + gnuradio/@NAME@-primitive.scm +libguile_gnuradio_@NAME@_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(@NAME@_la_swig_libadd) +libguile_gnuradio_@NAME@_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(@NAME@_la_swig_ldflags) +libguile_gnuradio_@NAME@_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(@NAME@_la_swig_cxxflags) guile/@NAME@.cc: gnuradio/@NAME@.scm gnuradio/@NAME@.scm: @NAME@.i diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index d55c8070d..87134af93 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -28,13 +28,13 @@ AM_CPPFLAGS += -I$(top_srcdir)/lib # SWIG interfaces and libraries TOP_SWIG_IFILES = \ - howto.i + howto_swig.i # Install so that they end up available as: # import howto # This ends up at: # ${prefix}/lib/python${python_version}/site-packages/$(modname) -howto_la_swig_libadd = \ +howto_swig_la_swig_libadd = \ $(top_builddir)/lib/libgnuradio-howto.la # additional SWIG files to be installed diff --git a/gr-howto-write-a-block/swig/Makefile.swig.gen b/gr-howto-write-a-block/swig/Makefile.swig.gen index 72d8a09aa..310cfb8da 100644 --- a/gr-howto-write-a-block/swig/Makefile.swig.gen +++ b/gr-howto-write-a-block/swig/Makefile.swig.gen @@ -20,37 +20,37 @@ # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for howto.i +# Makefile.swig.gen for howto_swig.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/howto +## ${prefix}/lib/python${python_version}/site-packages/[category]/howto_swig ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/howto +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/howto_swig ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -howto_pythondir_category ?= gnuradio/howto -howto_pylibdir_category ?= $(howto_pythondir_category) -howto_pythondir = $(pythondir)/$(howto_pythondir_category) -howto_pylibdir = $(pyexecdir)/$(howto_pylibdir_category) +howto_swig_pythondir_category ?= gnuradio/howto_swig +howto_swig_pylibdir_category ?= $(howto_swig_pythondir_category) +howto_swig_pythondir = $(pythondir)/$(howto_swig_pythondir_category) +howto_swig_pylibdir = $(pyexecdir)/$(howto_swig_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -howto_scmlibdir = $(libdir) +howto_swig_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/howto +# is installed, usually /usr/share/guile/site/howto_swig # FIXME: determince whether these should be installed with gnuradio. -howto_scmdir = $(guiledir) +howto_swig_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. -howto_swigincludedir = $(swigincludedir) +howto_swig_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -75,58 +75,70 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -howto_swiginclude_HEADERS = \ - howto.i \ - $(howto_swiginclude_headers) +howto_swig_swiginclude_HEADERS = \ + howto_swig.i \ + $(howto_swig_swiginclude_headers) -howto_pylib_LTLIBRARIES = \ - _howto.la +if PYTHON +howto_swig_pylib_LTLIBRARIES = \ + _howto_swig.la -_howto_la_SOURCES = \ - python/howto.cc \ - $(howto_la_swig_sources) +_howto_swig_la_SOURCES = \ + python/howto_swig.cc \ + $(howto_swig_la_swig_sources) -_howto_la_LIBADD = \ +howto_swig_python_PYTHON = \ + howto_swig.py \ + $(howto_swig_python) + +_howto_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(howto_la_swig_libadd) + $(howto_swig_la_swig_libadd) -_howto_la_LDFLAGS = \ +_howto_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(howto_la_swig_ldflags) + $(howto_swig_la_swig_ldflags) -_howto_la_CXXFLAGS = \ +_howto_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(howto_la_swig_cxxflags) - -howto_python_PYTHON = \ - howto.py \ - $(howto_python) + $(howto_swig_la_swig_cxxflags) -python/howto.cc: howto.py -howto.py: howto.i +python/howto_swig.cc: howto_swig.py +howto_swig.py: howto_swig.i # Include the python dependencies for this file --include python/howto.d -# end of PYTHON +-include python/howto_swig.d + +endif # end of if python if GUILE -howto_scmlib_LTLIBRARIES = libguile-howto.la -libguile_howto_la_SOURCES = \ - guile/howto.cc \ - $(howto_la_swig_sources) -nobase_howto_scm_DATA = gnuradio/howto.scm gnuradio/howto-primitive.scm -libguile_howto_la_LIBADD = $(_howto_la_LIBADD) -libguile_howto_la_LDFLAGS = $(_howto_la_LDFLAGS) -libguile_howto_la_CXXFLAGS = $(_howto_la_CXXFLAGS) +howto_swig_scmlib_LTLIBRARIES = \ + libguile-gnuradio-howto_swig.la +libguile_gnuradio_howto_swig_la_SOURCES = \ + guile/howto_swig.cc \ + $(howto_swig_la_swig_sources) +nobase_howto_swig_scm_DATA = \ + gnuradio/howto_swig.scm \ + gnuradio/howto_swig-primitive.scm +libguile_gnuradio_howto_swig_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(howto_swig_la_swig_libadd) +libguile_gnuradio_howto_swig_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(howto_swig_la_swig_ldflags) +libguile_gnuradio_howto_swig_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + -I$(top_builddir) \ + $(howto_swig_la_swig_cxxflags) -guile/howto.cc: gnuradio/howto.scm -gnuradio/howto.scm: howto.i -gnuradio/howto-primitive.scm: gnuradio/howto.scm +guile/howto_swig.cc: gnuradio/howto_swig.scm +gnuradio/howto_swig.scm: howto_swig.i +gnuradio/howto_swig-primitive.scm: gnuradio/howto_swig.scm # Include the guile dependencies for this file --include guile/howto.d +-include guile/howto_swig.d endif # end of GUILE diff --git a/gr-howto-write-a-block/swig/howto.i b/gr-howto-write-a-block/swig/howto.i deleted file mode 100644 index 868df5739..000000000 --- a/gr-howto-write-a-block/swig/howto.i +++ /dev/null @@ -1,21 +0,0 @@ -/* -*- c++ -*- */ - -%include "gnuradio.i" // the common stuff - -%{ -#include "howto_square_ff.h" -#include "howto_square2_ff.h" -%} - -%include "howto_square_ff.i" -%include "howto_square2_ff.i" - -#if SWIGGUILE -%scheme %{ -(load-extension "libguile-gnuradio-howto" "scm_init_gnuradio_howto_module") -%} - -%goops %{ -(use-modules (gnuradio gnuradio_core_runtime)) -%} -#endif diff --git a/gr-howto-write-a-block/swig/howto_swig.i b/gr-howto-write-a-block/swig/howto_swig.i new file mode 100644 index 000000000..868df5739 --- /dev/null +++ b/gr-howto-write-a-block/swig/howto_swig.i @@ -0,0 +1,21 @@ +/* -*- c++ -*- */ + +%include "gnuradio.i" // the common stuff + +%{ +#include "howto_square_ff.h" +#include "howto_square2_ff.h" +%} + +%include "howto_square_ff.i" +%include "howto_square2_ff.i" + +#if SWIGGUILE +%scheme %{ +(load-extension "libguile-gnuradio-howto" "scm_init_gnuradio_howto_module") +%} + +%goops %{ +(use-modules (gnuradio gnuradio_core_runtime)) +%} +#endif -- cgit From 6ba2c80cdedf6d4eea99c565ffa8b204174d0576 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 4 Dec 2010 00:31:22 -0800 Subject: Some piece of this commit triggers a syntax error running swig: make[2]: Entering directory `/home/eb/git/wf-exec/gr-howto-write-a-block/swig' Compile .i to .py /usr/bin/swig -fvirtual -python -modern -keyword -w511 -outdir . -I/home/eb/git/wf-exec/gr-howto-write-a-block/lib -I/home/eb/install/include/gnuradio -I/home/eb/install/include/gnuradio/swig \ -MD -MF python/howto_swig.Std \ -module howto_swig -o python/howto_swig.cc -oh python/howto_swig.h howto_swig.i /usr/share/swig/1.3.40/python/std_complex.i:12: Error: Syntax error in input(1). make[2]: *** [howto_swig.py] Error 1 --- gr-howto-write-a-block/Makefile.am | 2 +- gr-howto-write-a-block/Makefile.common | 10 +--- gr-howto-write-a-block/config/Makefile.am | 1 + gr-howto-write-a-block/config/gr_guile.m4 | 65 ++++++++++++++++++++++++++ gr-howto-write-a-block/config/gr_scripting.m4 | 10 +++- gr-howto-write-a-block/config/gr_set_md_cpu.m4 | 2 +- gr-howto-write-a-block/config/gr_swig.m4 | 32 +++++++++++-- gr-howto-write-a-block/config/pkg.m4 | 19 ++++++-- 8 files changed, 124 insertions(+), 17 deletions(-) create mode 100644 gr-howto-write-a-block/config/gr_guile.m4 (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/Makefile.am b/gr-howto-write-a-block/Makefile.am index 98368c211..4ceb210ba 100644 --- a/gr-howto-write-a-block/Makefile.am +++ b/gr-howto-write-a-block/Makefile.am @@ -38,4 +38,4 @@ SUBDIRS = config lib swig python grc apps pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = -DISTCLEANFILES = gr-howto-write-a-block*.tar.gz +DISTCLEANFILES += gr-howto-write-a-block*.tar.gz diff --git a/gr-howto-write-a-block/Makefile.common b/gr-howto-write-a-block/Makefile.common index cfcbce9c8..d89cbaa16 100644 --- a/gr-howto-write-a-block/Makefile.common +++ b/gr-howto-write-a-block/Makefile.common @@ -79,14 +79,9 @@ grc_blocksdir = $(prefix)/share/gnuradio/grc/blocks # here have to add a -f to be like GNU make. RM=$(RM_PROG) -f -# Other common defines; use "+=" to add to these -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. @@ -101,7 +96,6 @@ gnuradio/%.scm : %.i $(SED) -i -e 's/<--dummy-[0-9]\+-->//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: @@ -113,9 +107,9 @@ endif $(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 \ echo $(RM) $(distdir)/$$file; \ $(RM) $(distdir)/$$file; \ - done; + done diff --git a/gr-howto-write-a-block/config/Makefile.am b/gr-howto-write-a-block/config/Makefile.am index eb2ee6283..aaaf0db7c 100644 --- a/gr-howto-write-a-block/config/Makefile.am +++ b/gr-howto-write-a-block/config/Makefile.am @@ -51,6 +51,7 @@ m4macros = \ gr_fortran.m4 \ gr_git.m4 \ gr_gprof.m4 \ + gr_guile.m4 \ gr_lib64.m4 \ gr_libgnuradio_core_extra_ldflags.m4 \ gr_no_undefined.m4 \ diff --git a/gr-howto-write-a-block/config/gr_guile.m4 b/gr-howto-write-a-block/config/gr_guile.m4 new file mode 100644 index 000000000..1f0793944 --- /dev/null +++ b/gr-howto-write-a-block/config/gr_guile.m4 @@ -0,0 +1,65 @@ +dnl +dnl Copyright 2003,2004,2005 Free Software Foundation, Inc. +dnl +dnl This file is part of GNU Radio +dnl +dnl GNU Radio is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 3, or (at your option) +dnl any later version. +dnl +dnl GNU Radio is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with GNU Radio; see the file COPYING. If not, write to +dnl the Free Software Foundation, Inc., 51 Franklin Street, +dnl Boston, MA 02110-1301, USA. +dnl + +# GUILE_DEVEL() +# +# Checks for Guile and tries to get the include path to 'Guile.h'. +# It sets the $(GUILE_CPPFLAGS), $(GUILE_LDFLAGS) and $(guiledir) output variables, +# +AC_DEFUN([GUILE_DEVEL],[ + dnl see if GUILE is installed + AC_PATH_PROG(GUILE, guile) + dnl get the config program + AC_PATH_PROG(GUILE_CONFIG, guile-config) + if test x${GUILE_CONFIG} != x; then + GUILE_CFLAGS="`${GUILE_CONFIG} compile`" + GUILE_LIBS="`${GUILE_CONFIG} link`" + GUILE_PKLIBDIR="`${GUILE_CONFIG} info pkglibdir`" + GUILE_PKDATADIR="`${GUILE_CONFIG} info pkgdatadir`/site" + else + GUILE_CFLAGS="" + GUILE_PKLIBDIR="" + GUILE_LIBS="Wl,-Bsymbolic-functions -lguile -lgmp -lcrypt" + fi + AC_SUBST(GUILE_CFLAGS) + AC_SUBST(GUILE_PKLIBDIR) + AC_SUBST(GUILE_PKDATADIR) + AC_SUBST(GUILE_LIBS) +]) + +# GUILE_CHECK_MODULE +# +# Determines if a particular Guile module can be imported +# +# $1 - module name +# $2 - module description +# $3 - action if found +# $4 - action if not found +# $5 - test command + +AC_DEFUN([GUILE_CHECK_MODULE],[ + AC_MSG_CHECKING([for $2]) + dnl ######################################## + dnl # import and test checking + dnl ######################################## + dnl if test x${enable_guile} = xyes; then + dnl fi +]) diff --git a/gr-howto-write-a-block/config/gr_scripting.m4 b/gr-howto-write-a-block/config/gr_scripting.m4 index e030a8102..866b7e017 100644 --- a/gr-howto-write-a-block/config/gr_scripting.m4 +++ b/gr-howto-write-a-block/config/gr_scripting.m4 @@ -26,5 +26,13 @@ AC_DEFUN([GR_SCRIPTING],[ SWIG_PROG(1.3.31) SWIG_ENABLE_CXX - SWIG_PYTHON + dnl We need python at build time, as it's used as for utilities. If python + dnl isn't enabled, then we don't want the SWIG support for python. + AC_REQUIRE([AM_PATH_PYTHON]) + if test x${enable_python} = xyes; then + SWIG_PYTHON + fi + if test x${enable_guile} = xyes; then + SWIG_GUILE + fi ]) diff --git a/gr-howto-write-a-block/config/gr_set_md_cpu.m4 b/gr-howto-write-a-block/config/gr_set_md_cpu.m4 index 7ebf88a66..cb5fb5aac 100644 --- a/gr-howto-write-a-block/config/gr_set_md_cpu.m4 +++ b/gr-howto-write-a-block/config/gr_set_md_cpu.m4 @@ -80,7 +80,7 @@ AC_DEFUN([GR_SET_MD_CPU],[ x86 | i[[3-7]]86) MD_CPU=x86 MD_SUBCPU=x86 ;; x86_64) MD_CPU=x86 MD_SUBCPU=x86_64 ;; powerpc*) MD_CPU=powerpc ;; - arm) + arm*) _FIND_ARM_ISA if test $is_armv5 = yes; then MD_CPU=armv5; elif test $is_armv7_a = yes; then MD_CPU=armv7_a; diff --git a/gr-howto-write-a-block/config/gr_swig.m4 b/gr-howto-write-a-block/config/gr_swig.m4 index cdb28055c..e03390994 100644 --- a/gr-howto-write-a-block/config/gr_swig.m4 +++ b/gr-howto-write-a-block/config/gr_swig.m4 @@ -26,7 +26,7 @@ dnl # is greater or equal to the value of the argument. It should have the format: # N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.) AC_DEFUN([SWIG_PROG],[ - AC_REQUIRE([AC_PROG_MAKE_SET]) + AC_REQUIRE([AC_PROG_MAKE_SET]) AC_CHECK_PROG(SWIG,swig,[`which swig`]) if test -z "$SWIG" ; then AC_MSG_ERROR([Cannot find 'swig' program. SWIG version >= $1 required]) @@ -56,9 +56,11 @@ AC_DEFUN([SWIG_PROG],[ AC_DEFUN([SWIG_ENABLE_CXX],[ AC_REQUIRE([SWIG_PROG]) AC_REQUIRE([AC_PROG_CXX]) - if test "$SWIG" != "false" ; then + if test x${enable_python} = xyes -o x${enable_guile} = xyes; then + if test "$SWIG" != "false" ; then SWIG="$SWIG -c++" - fi + fi + fi ]) # SWIG_PYTHON([use-shadow-classes]) @@ -83,3 +85,27 @@ dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow]) fi AC_SUBST(SWIG_PYTHON_CPPFLAGS,[$PYTHON_CPPFLAGS]) ]) + +AC_DEFUN([SWIG_TCL],[ + AC_REQUIRE([SWIG_PROG]) + AC_REQUIRE([TCL_DEVEL]) + if test "$SWIG" != "false" ; then + AC_SUBST(SWIG_TCL_LIB,[-ltcl]) +dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow="" +dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow]) + AC_SUBST(SWIG_TCL_OPT,[-tcl]) + fi + AC_SUBST(SWIG_TCL_CPPFLAGS,[$TCL_CPPFLAGS]) +]) + +AC_DEFUN([SWIG_GUILE],[ + AC_REQUIRE([SWIG_PROG]) + AC_REQUIRE([GUILE_DEVEL]) + if test "$SWIG" != "false" ; then + AC_SUBST(SWIG_GUILE_LIB,[-lguile]) +dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow="" +dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow]) + AC_SUBST(SWIG_GUILE_OPT,[-guile]) + fi + AC_SUBST(SWIG_GUILE_CPPFLAGS,[$GUILE_CPPFLAGS]) +]) diff --git a/gr-howto-write-a-block/config/pkg.m4 b/gr-howto-write-a-block/config/pkg.m4 index 80bdfed4c..2d4d96109 100644 --- a/gr-howto-write-a-block/config/pkg.m4 +++ b/gr-howto-write-a-block/config/pkg.m4 @@ -111,8 +111,11 @@ fi[]dnl # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # -------------------------------------------------------------- -AC_DEFUN([PKG_CHECK_MODULES], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_DEFUN([PKG_CHECK_MODULES],[ +AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl + AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_INCLUDEDIR], [includedir for $1, overriding pkg-config])dnl @@ -124,7 +127,17 @@ _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) if test x$cross_compiling = xyes then - _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2]) + dnl _PKG_CONFIG([$1][_LIBS], [libs-only-l --static], [$2]) + _PKG_CONFIG([$1][_LIBS], [libs --static], [$2]) + dnl prune out any -L/lib or -L/usr/lib since they're pointing to the wrong filesystem root + _pkg_tmp= + for flag in [$]pkg_cv_[$1][_LIBS]; do + case $flag in + (-L/lib* | -L/usr/lib* ) ;; # ignore + (*) _pkg_tmp="$_pkg_tmp $flag" ;; + esac + done + pkg_cv_[$1][_LIBS]="$_pkg_tmp" else _PKG_CONFIG([$1][_LIBS], [libs --static], [$2]) fi -- cgit From 05a68e2b0991b90ee974bcdc7a852604849ce377 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 4 Dec 2010 00:42:21 -0800 Subject: Fix swig syntax error triggered in python/std_complex.i --- gr-howto-write-a-block/config/gr_swig.m4 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/config/gr_swig.m4 b/gr-howto-write-a-block/config/gr_swig.m4 index e03390994..dcc2e72dc 100644 --- a/gr-howto-write-a-block/config/gr_swig.m4 +++ b/gr-howto-write-a-block/config/gr_swig.m4 @@ -56,10 +56,8 @@ AC_DEFUN([SWIG_PROG],[ AC_DEFUN([SWIG_ENABLE_CXX],[ AC_REQUIRE([SWIG_PROG]) AC_REQUIRE([AC_PROG_CXX]) - if test x${enable_python} = xyes -o x${enable_guile} = xyes; then - if test "$SWIG" != "false" ; then + if test "$SWIG" != "false" ; then SWIG="$SWIG -c++" - fi fi ]) -- cgit From 95254c28c18277012907354ae9fa5aef295271b8 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 4 Dec 2010 00:49:17 -0800 Subject: Move swig related suffix/pattern rules from Makefile.common to Makefile.swig. --- gr-howto-write-a-block/Makefile.common | 29 ----------------------------- gr-howto-write-a-block/Makefile.swig | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 31 deletions(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/Makefile.common b/gr-howto-write-a-block/Makefile.common index d89cbaa16..f751532ed 100644 --- a/gr-howto-write-a-block/Makefile.common +++ b/gr-howto-write-a-block/Makefile.common @@ -79,35 +79,6 @@ grc_blocksdir = $(prefix)/share/gnuradio/grc/blocks # here have to add a -f to be like GNU make. RM=$(RM_PROG) -f -## SWIG suffixes for automake to know about -SUFFIXES = .i .scm .py - -# 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]\+-->//g' gnuradio/$*.scm - $(SED) -i -e 's/^(export /(export-safely /' gnuradio/$*.scm - $(RM) guile/$*.Std - -# 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 - - dist-hook: @for file in $(no_dist_files); do \ echo $(RM) $(distdir)/$$file; \ diff --git a/gr-howto-write-a-block/Makefile.swig b/gr-howto-write-a-block/Makefile.swig index 327b566e1..2ed69c6c7 100644 --- a/gr-howto-write-a-block/Makefile.swig +++ b/gr-howto-write-a-block/Makefile.swig @@ -92,8 +92,8 @@ STD_SWIG_CXX_FLAGS = @swig_CXXFLAGS@ # We drive the dependencies off of swig_built_sources. This variable # ends up containing only the generated .py and/or .scm files, not the .h -# or .cc files. This allows us to use the pattern rules in -# Makefile.common to generate all the pieces without the parallel make +# or .cc files. This allows us to use the pattern rules defined +# below to generate all the pieces without the parallel make # problems that occur when both the .py's and .cc's are in swig_built_sources. swig_built_sources = @@ -137,6 +137,34 @@ CLEANFILES += python/*.lo python/*.o python/*.d CLEANFILES += guile/*.lo guile/*.o guile/*.d +## SWIG suffixes for automake to know about +SUFFIXES = .i .scm .py + +# 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]\+-->//g' gnuradio/$*.scm + $(SED) -i -e 's/^(export /(export-safely /' gnuradio/$*.scm + $(RM) guile/$*.Std + +# 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 + ## ------------------------------------------------------------------------ ## Rule that (re)generates Makefile.swig.gen using TOP_SWIG_IFILES and ## Makefile.swig.gen.t -- cgit From 910165a9eccf02bf4cb0fb30fb4e620426c1a000 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Sat, 4 Dec 2010 01:18:36 -0800 Subject: Fix load-extension strings --- gr-howto-write-a-block/swig/howto_swig.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/swig/howto_swig.i b/gr-howto-write-a-block/swig/howto_swig.i index 868df5739..c62ddf3eb 100644 --- a/gr-howto-write-a-block/swig/howto_swig.i +++ b/gr-howto-write-a-block/swig/howto_swig.i @@ -12,7 +12,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-howto" "scm_init_gnuradio_howto_module") +(load-extension "libguile-gnuradio-howto_swig" "scm_init_gnuradio_howto_swig_module") %} %goops %{ -- cgit From e8542abdbf4da924dcdc54bfe2e7a20cda55c26b Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 6 Dec 2010 19:10:45 -0800 Subject: Add prefix = NONE test to gr-howto-write-a-block --- gr-howto-write-a-block/configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/configure.ac b/gr-howto-write-a-block/configure.ac index 52c4639bb..fc4227d71 100644 --- a/gr-howto-write-a-block/configure.ac +++ b/gr-howto-write-a-block/configure.ac @@ -1,5 +1,5 @@ dnl -dnl Copyright 2004,2005,2007,2008,2009 Free Software Foundation, Inc. +dnl Copyright 2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -24,6 +24,12 @@ AC_INIT AC_PREREQ(2.57) AC_CONFIG_AUX_DIR([.]) +dnl Set the prefix to the default when --prefix is not specified. +dnl This is critical for variable substitutions in the configure. +if test "${prefix}" = "NONE"; then + prefix=${ac_default_prefix} +fi + AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET -- cgit From cc088ab014791450d9d5d88564f3f889ece74909 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 6 Dec 2010 19:47:42 -0800 Subject: Add guile QA code to gr-howto-write-a-block --- gr-howto-write-a-block/Makefile.common | 3 + gr-howto-write-a-block/config/gr_standalone.m4 | 7 +- gr-howto-write-a-block/configure.ac | 8 +- gr-howto-write-a-block/setup_guile_test_env.in | 140 +++++++++++++++++++++++++ gr-howto-write-a-block/swig/Makefile.am | 9 ++ gr-howto-write-a-block/swig/howto.test | 69 ++++++++++++ gr-howto-write-a-block/swig/run_guile_tests.in | 14 +++ 7 files changed, 248 insertions(+), 2 deletions(-) create mode 100644 gr-howto-write-a-block/setup_guile_test_env.in create mode 100644 gr-howto-write-a-block/swig/howto.test create mode 100644 gr-howto-write-a-block/swig/run_guile_tests.in (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/Makefile.common b/gr-howto-write-a-block/Makefile.common index f751532ed..fca6133c1 100644 --- a/gr-howto-write-a-block/Makefile.common +++ b/gr-howto-write-a-block/Makefile.common @@ -64,6 +64,9 @@ modincludedir = $(includedir)/$(modname) # swig includes swigincludedir = $(modincludedir)/swig +# Guile scheme code ends up under here: +guiledir = $(prefix)/share/guile/site + # Install this stuff in the appropriate subdirectory # This usually ends up at: # ${prefix}/lib/python${python_version}/site-packages/$(modname) diff --git a/gr-howto-write-a-block/config/gr_standalone.m4 b/gr-howto-write-a-block/config/gr_standalone.m4 index 0e2ded584..d4acaec2f 100644 --- a/gr-howto-write-a-block/config/gr_standalone.m4 +++ b/gr-howto-write-a-block/config/gr_standalone.m4 @@ -1,5 +1,5 @@ dnl -dnl Copyright 2008,2009 Free Software Foundation, Inc. +dnl Copyright 2008,2009,2010 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -111,6 +111,11 @@ m4_define([GR_STANDALONE], PKG_CHECK_MODULES(GNURADIO_CORE, gnuradio-core >= 3) LIBS="$LIBS $GNURADIO_CORE_LIBS" + gnuradio_core_GUILE_LOAD_PATH="`pkg-config --variable=guile_load_path gnuradio-core`" + gnuradio_core_LIBDIRPATH="`pkg-config --variable=libdir gnuradio-core`" + AC_SUBST(gnuradio_core_GUILE_LOAD_PATH) + AC_SUBST(gnuradio_core_LIBDIRPATH) + dnl Allow user to choose whether to generate SWIG/Python dnl Default is enabled AC_ARG_ENABLE([python], diff --git a/gr-howto-write-a-block/configure.ac b/gr-howto-write-a-block/configure.ac index fc4227d71..ef5c98eeb 100644 --- a/gr-howto-write-a-block/configure.ac +++ b/gr-howto-write-a-block/configure.ac @@ -77,6 +77,7 @@ dnl AX_BOOST_WSERIALIZATION AC_CONFIG_FILES([\ Makefile \ + setup_guile_test_env \ apps/Makefile \ config/Makefile \ grc/Makefile \ @@ -84,10 +85,15 @@ AC_CONFIG_FILES([\ python/Makefile \ python/run_tests \ swig/Makefile \ + swig/run_guile_tests \ ]) dnl run_tests is created from run_tests.in. Make it executable. -AC_CONFIG_COMMANDS([run_tests], [chmod +x python/run_tests]) +AC_CONFIG_COMMANDS([run_tests], + [ + chmod +x python/run_tests + chmod +x swig/run_guile_tests + ]) AC_OUTPUT diff --git a/gr-howto-write-a-block/setup_guile_test_env.in b/gr-howto-write-a-block/setup_guile_test_env.in new file mode 100644 index 000000000..6a2402064 --- /dev/null +++ b/gr-howto-write-a-block/setup_guile_test_env.in @@ -0,0 +1,140 @@ +# +# Copyright 2010 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# This is sourced by run_guile_tests to establish the environment +# variables required to run the tests in the build tree. + +# add_local_paths is the only "public" function in this file + +# 1st argument is absolute path to hand coded guile source directory +# 2nd argument is absolute path to component C++ shared library build directory +# 3nd argument is absolute path to component SWIG build directory + +function add_local_paths(){ + if [ $# -ne 3 ] + then + echo "$0: requires 3 args" 1>&2 + exit 1 + fi + + # Add local dirs to the front + prepend_to_guile_load_path "$1" + prepend_to_libpath "$2/.libs" + [ "$2" != "$3" ] && prepend_to_libpath "$3/.libs" + prepend_to_guile_load_path "$3" +} + +# ------------------------------------------------------------------------ + +abs_top_srcdir=@abs_top_srcdir@ +abs_top_builddir=@abs_top_builddir@ + +# usage: prepend +function prepend(){ + if [ $# -ne 2 ] + then + echo "$0: prepend needs 2 args" 1>&2 + exit 1 + fi + local path="$1" dir="$2" contents="" + eval "contents=\$$path" + if [ "$dir" != "" ] + then + if [ "$contents" = "" ] + then + eval "$path=\"$dir\"" + else + eval "$path=\"$dir:$contents\"" + fi + fi + #echo end-of-prepend: $path=${!path} +} + +# usage: append +function append(){ + if [ $# -ne 2 ] + then + echo "$0: append needs 2 args" 1>&2 + exit 1 + fi + local path="$1" dir="$2" contents="" + eval "contents=\$$path" + if [ "$dir" != "" ] + then + if [ "$contents" = "" ] + then + eval "$path=\"$dir\"" + else + eval "$path=\"$contents:$dir\"" + fi + fi + #echo end-of-append: $path=${!path} +} + +function prepend_to_guile_load_path(){ + prepend GUILE_LOAD_PATH "$1" + export GUILE_LOAD_PATH +} + +function append_to_guile_load_path(){ + append GUILE_LOAD_PATH "$1" + export GUILE_LOAD_PATH +} + +function prepend_to_libpath(){ + prepend LTDL_LIBRARY_PATH "$1" + export LTDL_LIBRARY_PATH + case "@host_os@" in + darwin*) + prepend DYLD_LIBRARY_PATH "$1" + export DYLD_LIBRARY_PATH + ;; + cygwin*|win*|mingw*) + prepend PATH "$1" + export PATH + ;; + esac +} + +function append_to_libpath(){ + append LTDL_LIBRARY_PATH "$1" + export LTDL_LIBRARY_PATH + case "@host_os@" in + darwin*) + append DYLD_LIBRARY_PATH "$1" + export DYLD_LIBRARY_PATH + ;; + cygwin*|win*|mingw*) + append PATH "$1" + export PATH + ;; + esac +} + +# ------------------------------------------------------------------------ +# Start with gnuradio_core_LIBDIRPATH and gnuradio_core_GUILE_LOAD_PATH +# ------------------------------------------------------------------------ + +# Where to search for gnuradio-core shared libraries +prepend_to_libpath @gnuradio_core_LIBDIRPATH@ + +# Where to seach for gnuradio-core guile code +prepend_to_guile_load_path @gnuradio_core_GUILE_LOAD_PATH@ + +export GUILE_WARN_DEPRECATED=no diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index 87134af93..a7d39444e 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -43,3 +43,12 @@ howto_swiginclude_headers = \ howto_square2_ff.i EXTRA_DIST = $(howto_swiginclude_headers) + + +if GUILE +TESTS = run_guile_tests +EXTRA_DIST += $(nobase_guile_DATA) + +nobase_guile_DATA = \ + gnuradio/howto.scm +endif diff --git a/gr-howto-write-a-block/swig/howto.test b/gr-howto-write-a-block/swig/howto.test new file mode 100644 index 000000000..ffe7251cd --- /dev/null +++ b/gr-howto-write-a-block/swig/howto.test @@ -0,0 +1,69 @@ +;;; -*- Scheme -*- +;;; +;;; Copyright 2010 Free Software Foundation, Inc. +;;; +;;; This file is part of GNU Radio +;;; +;;; GNU Radio is free software; you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3, or (at your option) +;;; any later version. +;;; +;;; GNU Radio is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . +;;; + +;;; If you're using Emacs's Scheme mode: +;;; (put 'with-test-prefix 'scheme-indent-function 1) + +;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. +;;; See also the very end of the file, where the test-equal, test-eqv +;;; and test-eq macros are defined. + +(define-module (test-module) + #:use-module (oop goops) + #:use-module (gnuradio core) + #:use-module (gnuradio test-suite lib) + #:duplicates (merge-generics replace check)) + + +;; Use our module +(use-modules (gnuradio howto)) + + +(define (vector-map f v) + (list->vector (map f (vector->list v)))) + + +(with-test-prefix "square-ff" + (let* ((src-data #(-3. 4. -5.5 2. 3.)) + (expected-result (vector-map (lambda (x) (* x x)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-f src-data #f)) + (op (gr:howto-square-ff)) + (dst (gr:vector-sink-f))) + + (gr:connect tb src op dst) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + + +(with-test-prefix "square2-ff" + (let* ((src-data #(-3. 4. -5.5 2. 3.)) + (expected-result (vector-map (lambda (x) (* x x)) src-data)) + (tb (gr:top-block-swig "QA top block")) + (src (gr:vector-source-f src-data #f)) + (op (gr:howto-square2-ff)) + (dst (gr:vector-sink-f))) + + (gr:connect tb src op dst) + + (gr:run tb) + (test-equal expected-result (gr:data dst)))) + diff --git a/gr-howto-write-a-block/swig/run_guile_tests.in b/gr-howto-write-a-block/swig/run_guile_tests.in new file mode 100644 index 000000000..5d08b0dd5 --- /dev/null +++ b/gr-howto-write-a-block/swig/run_guile_tests.in @@ -0,0 +1,14 @@ +#!/bin/sh + +. @top_builddir@/setup_guile_test_env + +# 1st argument is absolute path to hand coded guile source directory +# 2nd argument is absolute path to component C++ shared library build directory +# 3nd argument is absolute path to component SWIG build directory + +add_local_paths \ + @srcdir@ \ + @abs_builddir@ \ + @abs_builddir@ + +@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@ -- cgit From 59a1eeb1b18483ec716afde24df3f0593ed5085c Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 6 Dec 2010 20:02:51 -0800 Subject: Update comments for --enable-guile, reflecting that it's disabled by default. --- gr-howto-write-a-block/config/gr_standalone.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/config/gr_standalone.m4 b/gr-howto-write-a-block/config/gr_standalone.m4 index d4acaec2f..beb98204c 100644 --- a/gr-howto-write-a-block/config/gr_standalone.m4 +++ b/gr-howto-write-a-block/config/gr_standalone.m4 @@ -130,9 +130,11 @@ m4_define([GR_STANDALONE], ) AM_CONDITIONAL([PYTHON], [test x$enable_python = xyes]) + dnl Allow user to choose whether to generate SWIG/Guile + dnl Default is disabled AC_ARG_ENABLE([guile], [AS_HELP_STRING([--enable-guile], - [generate SWIG/Guile components (default is yes)])], + [generate SWIG/Guile components (default is no)])], [case "${enableval}" in yes) enable_guile=yes ;; no) enable_guile=no ;; -- cgit From c69cf50c8c553377d1ad9d353b207d57f5d3a47d Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Tue, 7 Dec 2010 13:19:06 -0800 Subject: Change shell function definitions to use POSIX syntax --- gr-howto-write-a-block/setup_guile_test_env.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/setup_guile_test_env.in b/gr-howto-write-a-block/setup_guile_test_env.in index 6a2402064..3437fab44 100644 --- a/gr-howto-write-a-block/setup_guile_test_env.in +++ b/gr-howto-write-a-block/setup_guile_test_env.in @@ -26,7 +26,7 @@ # 2nd argument is absolute path to component C++ shared library build directory # 3nd argument is absolute path to component SWIG build directory -function add_local_paths(){ +add_local_paths() { if [ $# -ne 3 ] then echo "$0: requires 3 args" 1>&2 @@ -46,7 +46,7 @@ abs_top_srcdir=@abs_top_srcdir@ abs_top_builddir=@abs_top_builddir@ # usage: prepend -function prepend(){ +prepend() { if [ $# -ne 2 ] then echo "$0: prepend needs 2 args" 1>&2 @@ -67,7 +67,7 @@ function prepend(){ } # usage: append -function append(){ +append() { if [ $# -ne 2 ] then echo "$0: append needs 2 args" 1>&2 @@ -87,17 +87,17 @@ function append(){ #echo end-of-append: $path=${!path} } -function prepend_to_guile_load_path(){ +prepend_to_guile_load_path() { prepend GUILE_LOAD_PATH "$1" export GUILE_LOAD_PATH } -function append_to_guile_load_path(){ +append_to_guile_load_path() { append GUILE_LOAD_PATH "$1" export GUILE_LOAD_PATH } -function prepend_to_libpath(){ +prepend_to_libpath() { prepend LTDL_LIBRARY_PATH "$1" export LTDL_LIBRARY_PATH case "@host_os@" in @@ -112,7 +112,7 @@ function prepend_to_libpath(){ esac } -function append_to_libpath(){ +append_to_libpath() { append LTDL_LIBRARY_PATH "$1" export LTDL_LIBRARY_PATH case "@host_os@" in -- cgit From 08907ee94fb6c34531d57b988324c67c26c8b747 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Fri, 10 Dec 2010 16:15:40 -0800 Subject: Use load-extension-global instead of load-extension --- gr-howto-write-a-block/swig/howto_swig.i | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/swig/howto_swig.i b/gr-howto-write-a-block/swig/howto_swig.i index c62ddf3eb..d0bbcdc11 100644 --- a/gr-howto-write-a-block/swig/howto_swig.i +++ b/gr-howto-write-a-block/swig/howto_swig.i @@ -12,7 +12,7 @@ #if SWIGGUILE %scheme %{ -(load-extension "libguile-gnuradio-howto_swig" "scm_init_gnuradio_howto_swig_module") +(load-extension-global "libguile-gnuradio-howto_swig" "scm_init_gnuradio_howto_swig_module") %} %goops %{ -- cgit From fd8f86713d8f9de79850b9e7aabde7c453b7e890 Mon Sep 17 00:00:00 2001 From: Eric Blossom Date: Mon, 27 Dec 2010 22:56:47 -0800 Subject: Add missing .test files to tarball. --- gr-howto-write-a-block/swig/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gr-howto-write-a-block') diff --git a/gr-howto-write-a-block/swig/Makefile.am b/gr-howto-write-a-block/swig/Makefile.am index a7d39444e..ba660f1b3 100644 --- a/gr-howto-write-a-block/swig/Makefile.am +++ b/gr-howto-write-a-block/swig/Makefile.am @@ -22,6 +22,8 @@ include $(top_srcdir)/Makefile.common include $(top_srcdir)/Makefile.swig +noinst_GUILE = howto.test + AM_CPPFLAGS += -I$(top_srcdir)/lib ################################### -- cgit