From c3f962a1f0a4132ad643c58774bb69b190dccc49 Mon Sep 17 00:00:00 2001 From: jcorgan Date: Sat, 14 Mar 2009 02:28:41 +0000 Subject: [PATCH] Merged r10554:10595 from michaelld/am_swig_4 into trunk. Major overhaul of SWIG usage in build system, also fixes ticket:130. Trunk passes distcheck. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10596 221aa14e-8319-0410-a670-987f0aec2ac5 --- Makefile.am | 6 +- Makefile.common | 29 +- Makefile.gen.gen | 49 +- Makefile.par.gen | 77 + Makefile.swig | 117 ++ Makefile.swig.gen.t | 258 ++++ config/grc_gnuradio_core.m4 | 13 +- config/grc_gr_gcell.m4 | 8 +- gnuradio-core/src/lib/filter/Makefile.am | 35 +- gnuradio-core/src/lib/general/Makefile.am | 5 +- gnuradio-core/src/lib/gengen/Makefile.am | 39 +- gnuradio-core/src/lib/runtime/Makefile.am | 2 - gnuradio-core/src/lib/swig/Makefile.am | 295 +--- gnuradio-core/src/lib/swig/Makefile.swig.gen | 1295 +++++++++++++++++ ...{sw_filter.i => gnuradio_swig_py_filter.i} | 0 ...w_general.i => gnuradio_swig_py_general.i} | 0 ...{sw_gengen.i => gnuradio_swig_py_gengen.i} | 0 .../swig/{sw_io.i => gnuradio_swig_py_io.i} | 0 ...w_runtime.i => gnuradio_swig_py_runtime.i} | 0 gnuradio-core/src/python/bin/Makefile.am | 4 +- gnuradio-core/src/python/gnuradio/Makefile.am | 4 +- .../src/python/gnuradio/blks2/Makefile.am | 7 +- .../src/python/gnuradio/blks2impl/Makefile.am | 7 +- .../src/python/gnuradio/gru/Makefile.am | 7 +- .../src/python/gnuradio/gruimpl/Makefile.am | 4 +- gnuradio-examples/c++/dial_tone/Makefile.am | 4 +- .../python/digital-bert/Makefile.am | 2 - gnuradio-examples/python/digital/Makefile.am | 2 - gnuradio-examples/python/network/Makefile.am | 2 - gr-atsc/src/lib/Makefile.am | 110 +- gr-atsc/src/lib/Makefile.swig.gen | 259 ++++ gr-audio-alsa/src/Makefile.am | 88 +- gr-audio-alsa/src/Makefile.swig.gen | 259 ++++ gr-audio-jack/src/Makefile.am | 84 +- gr-audio-jack/src/Makefile.swig.gen | 259 ++++ gr-audio-oss/src/Makefile.am | 82 +- gr-audio-oss/src/Makefile.swig.gen | 259 ++++ gr-audio-osx/src/Makefile.am | 86 +- gr-audio-osx/src/Makefile.swig.gen | 259 ++++ gr-audio-portaudio/src/Makefile.am | 80 +- gr-audio-portaudio/src/Makefile.swig.gen | 259 ++++ gr-audio-windows/src/Makefile.am | 83 +- gr-audio-windows/src/Makefile.swig.gen | 259 ++++ gr-comedi/src/Makefile.am | 86 +- gr-comedi/src/Makefile.swig.gen | 259 ++++ gr-cvsd-vocoder/src/lib/Makefile.am | 86 +- gr-cvsd-vocoder/src/lib/Makefile.swig.gen | 259 ++++ gr-cvsd-vocoder/src/python/Makefile.am | 4 +- gr-gcell/src/Makefile.am | 108 +- gr-gcell/src/Makefile.swig.gen | 259 ++++ gr-gcell/src/examples/Makefile.am | 2 - gr-gpio/src/fpga/top/Makefile.am | 7 +- gr-gpio/src/python/Makefile.am | 2 - gr-gsm-fr-vocoder/src/lib/Makefile.am | 86 +- gr-gsm-fr-vocoder/src/lib/Makefile.swig.gen | 259 ++++ gr-howto-write-a-block/Makefile.am | 6 +- gr-howto-write-a-block/Makefile.common | 36 +- gr-howto-write-a-block/Makefile.swig | 117 ++ gr-howto-write-a-block/Makefile.swig.gen.t | 258 ++++ gr-howto-write-a-block/config.guess | 36 +- gr-howto-write-a-block/config.sub | 52 +- .../config/gr_standalone.m4 | 40 +- gr-howto-write-a-block/config/lf_cc.m4 | 1 - gr-howto-write-a-block/configure.ac | 4 - gr-howto-write-a-block/src/lib/Makefile.am | 100 +- .../src/lib/Makefile.swig.gen | 259 ++++ gr-msdd6000/src/Makefile.am | 97 +- gr-msdd6000/src/Makefile.swig.gen | 259 ++++ gr-pager/Makefile.am | 4 +- gr-pager/src/Makefile.am | 156 +- gr-pager/src/Makefile.swig.gen | 259 ++++ gr-pager/src/{pager.i => pager_swig.i} | 0 gr-qtgui/src/lib/Makefile.am | 77 +- gr-qtgui/src/lib/Makefile.swig.gen | 259 ++++ gr-qtgui/src/python/Makefile.am | 4 +- gr-radar-mono/src/fpga/lib/Makefile.am | 4 +- gr-radar-mono/src/fpga/models/Makefile.am | 4 +- gr-radar-mono/src/fpga/tb/Makefile.am | 4 +- gr-radar-mono/src/fpga/top/Makefile.am | 5 +- gr-radar-mono/src/python/Makefile.am | 2 - gr-radio-astronomy/src/lib/Makefile.am | 71 +- gr-radio-astronomy/src/lib/Makefile.swig.gen | 259 ++++ gr-sounder/src/fpga/lib/Makefile.am | 4 +- gr-sounder/src/fpga/tb/Makefile.am | 4 +- gr-sounder/src/fpga/top/Makefile.am | 5 +- gr-sounder/src/python/Makefile.am | 2 - gr-trellis/src/examples/Makefile.am | 2 - gr-trellis/src/lib/Makefile.am | 144 +- gr-trellis/src/lib/Makefile.swig.gen | 259 ++++ gr-trellis/src/python/Makefile.am | 4 +- gr-usrp/apps/Makefile.am | 4 +- gr-usrp/src/Makefile.am | 106 +- gr-usrp/src/Makefile.swig.gen | 259 ++++ gr-usrp/src/{usrp.i => usrp_swig.i} | 0 gr-usrp2/src/Makefile.am | 90 +- gr-usrp2/src/Makefile.swig.gen | 259 ++++ gr-utils/src/python/Makefile.am | 4 +- gr-video-sdl/src/Makefile.am | 76 +- gr-video-sdl/src/Makefile.swig.gen | 259 ++++ grc/freedesktop/Makefile.am | 3 +- grc/src/platforms/base/Makefile.am | 3 +- grc/src/platforms/python/Makefile.am | 3 +- mblock/src/lib/Makefile.am | 4 +- pmt/src/lib/Makefile.am | 56 +- usrp/host/lib/inband/Makefile.am | 3 - usrp/host/lib/legacy/Makefile.am | 13 +- usrp/host/swig/Makefile.am | 81 +- usrp/host/swig/Makefile.swig.gen | 259 ++++ usrp/host/swig/{prims.i => usrp_prims.i} | 0 109 files changed, 8565 insertions(+), 1828 deletions(-) create mode 100644 Makefile.par.gen create mode 100644 Makefile.swig create mode 100644 Makefile.swig.gen.t create mode 100644 gnuradio-core/src/lib/swig/Makefile.swig.gen rename gnuradio-core/src/lib/swig/{sw_filter.i => gnuradio_swig_py_filter.i} (100%) rename gnuradio-core/src/lib/swig/{sw_general.i => gnuradio_swig_py_general.i} (100%) rename gnuradio-core/src/lib/swig/{sw_gengen.i => gnuradio_swig_py_gengen.i} (100%) rename gnuradio-core/src/lib/swig/{sw_io.i => gnuradio_swig_py_io.i} (100%) rename gnuradio-core/src/lib/swig/{sw_runtime.i => gnuradio_swig_py_runtime.i} (100%) create mode 100644 gr-atsc/src/lib/Makefile.swig.gen create mode 100644 gr-audio-alsa/src/Makefile.swig.gen create mode 100644 gr-audio-jack/src/Makefile.swig.gen create mode 100644 gr-audio-oss/src/Makefile.swig.gen create mode 100644 gr-audio-osx/src/Makefile.swig.gen create mode 100644 gr-audio-portaudio/src/Makefile.swig.gen create mode 100644 gr-audio-windows/src/Makefile.swig.gen create mode 100644 gr-comedi/src/Makefile.swig.gen create mode 100644 gr-cvsd-vocoder/src/lib/Makefile.swig.gen create mode 100644 gr-gcell/src/Makefile.swig.gen create mode 100644 gr-gsm-fr-vocoder/src/lib/Makefile.swig.gen create mode 100644 gr-howto-write-a-block/Makefile.swig create mode 100644 gr-howto-write-a-block/Makefile.swig.gen.t create mode 100644 gr-howto-write-a-block/src/lib/Makefile.swig.gen create mode 100644 gr-msdd6000/src/Makefile.swig.gen create mode 100644 gr-pager/src/Makefile.swig.gen rename gr-pager/src/{pager.i => pager_swig.i} (100%) create mode 100644 gr-qtgui/src/lib/Makefile.swig.gen create mode 100644 gr-radio-astronomy/src/lib/Makefile.swig.gen create mode 100644 gr-trellis/src/lib/Makefile.swig.gen create mode 100644 gr-usrp/src/Makefile.swig.gen rename gr-usrp/src/{usrp.i => usrp_swig.i} (100%) create mode 100644 gr-usrp2/src/Makefile.swig.gen create mode 100644 gr-video-sdl/src/Makefile.swig.gen create mode 100644 usrp/host/swig/Makefile.swig.gen rename usrp/host/swig/{prims.i => usrp_prims.i} (100%) diff --git a/Makefile.am b/Makefile.am index e9dde45f..1711f707 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,11 @@ EXTRA_DIST = \ configure \ configure-cell-cross \ config.h.in \ - run_tests.sh.in + run_tests.sh.in \ + Makefile.swig \ + Makefile.swig.gen.t \ + Makefile.par.gen \ + Makefile.gen.gen SUBDIRS = @build_dirs@ DIST_SUBDIRS = @build_dirs@ @skipped_dirs@ @with_dirs@ diff --git a/Makefile.common b/Makefile.common index 24ec75a3..b81433a3 100644 --- a/Makefile.common +++ b/Makefile.common @@ -59,21 +59,6 @@ STD_DEFINES_AND_INCLUDES = $(DEFINES) $(BOOST_CPPFLAGS) \ WITH_INCLUDES = @with_INCLUDES@ WITH_SWIG_INCLUDES = @with_SWIG_INCLUDES@ -# swig flags -# -w511 turns off keyword argument warning -# "-outdir $(builddir)" writes all generated output files to -# the local builddir (which should always be '.') -SWIG_PYTHON_FLAGS = -fvirtual -python -modern -keyword \ - -w511 -outdir . - -# standard swig flags used by most components -STD_SWIG_PYTHON_ARGS = \ - $(SWIG_PYTHON_FLAGS) \ - $(STD_DEFINES_AND_INCLUDES) \ - $(LOCAL_SWIG_DEFINES_AND_INCLUDES) \ - $(WITH_SWIG_INCLUDES) \ - $(WITH_INCLUDES) - # How to link in the top-level omnithreads library from inside the tree OMNITHREAD_INCLUDES = @omnithread_INCLUDES@ OMNITHREAD_LA = @omnithread_LA@ @@ -85,9 +70,6 @@ GNURADIO_INCLUDES = @gnuradio_core_INCLUDES@ # How to link in GNU Radio core library from inside the tree GNURADIO_CORE_LA = @gnuradio_core_LA@ -# This is a dependency for many swig operations -GNURADIO_I = @gnuradio_core_I@ - # How to link in the USRP library from inside the tree GRUEL_INCLUDES = @gruel_INCLUDES@ GRUEL_LA = @gruel_LA@ @@ -132,3 +114,14 @@ exampledir = $(datadir)/gnuradio/examples # Base directory for documentation (docdir undefined in autoconf < 1.60) docdir ?= $(datadir)/doc/$(PACKAGE) gr_docdir = $(docdir)-$(VERSION) + +# Other common defines; use "+=" to add to these +STAMPS = +MOSTLYCLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc *.pyo *~ *.tmp *.loT + +# 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; diff --git a/Makefile.gen.gen b/Makefile.gen.gen index 1a67edf8..a6df8b8f 100644 --- a/Makefile.gen.gen +++ b/Makefile.gen.gen @@ -20,39 +20,16 @@ # Boston, MA 02110-1301, USA. # -STAMPS += $(DEPDIR)/sources-generate-* - -# Ensure parallel make does the right thing. -# http://sources.redhat.com/automake/automake.html#Multiple-Outputs - -$(DEPDIR)/sources-generate-stamp: $(gen_sources_deps) - @rm -f $(DEPDIR)/sources-generate-tmp - @touch $(DEPDIR)/sources-generate-tmp - PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py - @mv -f $(DEPDIR)/sources-generate-tmp $@ - -$(gen_sources): $(DEPDIR)/sources-generate-stamp -## Recover from the removal of $@ - @if test -f $@; then :; else \ - trap 'rm -rf $(DEPDIR)/sources-generate-*' 1 2 13 15; \ - if mkdir $(DEPDIR)/sources-generate-lock 2>/dev/null; then \ -## This code is being executed by the first process. - rm -f $(DEPDIR)/sources-generate-stamp; \ - $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/sources-generate-stamp; \ - rmdir $(DEPDIR)/sources-generate-lock; \ - else \ -## This code is being executed by the follower processes. -## Wait until the first process is done. - while test -d $(DEPDIR)/sources-generate-lock; do sleep 1; done; \ -## Succeed if and only if the first process succeeded. - test -f $(DEPDIR)/sources-generate-stamp; exit $$?; \ - fi; \ - fi; - ## ---------------------------------------------------------------- ## Special rule for regenerating the local Makefile.gen +## +## Define the variable 'makefile_gen_gen_command' to be the command +## that creates $(srcdir)/Makefile.gen . The rule below will check to +## make sure that it can create the generated file, and if not exits +## with an error -1. +## -STAMPS += $(DEPDIR)/generate-makefile-generate-* +STAMPS += $(DEPDIR)/Makefile.gen-generate-generate-* generate-makefile $(srcdir)/Makefile.gen: ## parallel make protection; can't hurt @@ -77,21 +54,17 @@ generate-makefile $(srcdir)/Makefile.gen: fi; \ if test "$$do_recreate" == "1"; then \ echo "Regenerating $(srcdir)/Makefile.gen"; \ - PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) do_makefile=1 do_sources=0 $(PYTHON) $(srcdir)/generate_all.py; \ + $(makefile_gen_gen_command); \ else \ echo "Cannot recreate $(srcdir)/Makefile.gen because the directory or file is write-protected."; \ + exit -1; \ fi; \ mv -f $(DEPDIR)/Makefile.gen-generate-tmp $(DEPDIR)/Makefile.gen-generate-stamp; \ rmdir $(DEPDIR)/Makefile.gen-generate-lock; \ else \ ## This code is being executed by the follower processes. ## Wait until the first process is done. - while test -d $(DEPDIR)/$@-generate-lock; do sleep 1; done; \ + while test -d $(DEPDIR)/Makefile.gen-generate-lock; do sleep 1; done; \ ## Succeed if and only if the first process succeeded. - test -f $(DEPDIR)/$@-generate-stamp; exit $$?; \ + test -f $(DEPDIR)/Makefile.gen-generate-stamp; exit $$?; \ fi; - -## ---------------------------------------------------------------- - -MOSTLYCLEANFILES += $(STAMPS) - diff --git a/Makefile.par.gen b/Makefile.par.gen new file mode 100644 index 00000000..22eb1a08 --- /dev/null +++ b/Makefile.par.gen @@ -0,0 +1,77 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +STAMPS ?= +EXTRA_DIST ?= +MOSTLYCLEANFILES ?= + +## ---------------------------------------------------------------- +## Special rules for generating sources. Include this file when there +## are multiple targets ('gen_sources') being created using a single +## command. In this case, parallel build protection is required, and +## is provided by this file using a reasonably generic ruleset. For +## more info, see: +## +## http://sources.redhat.com/automake/automake.html#Multiple-Outputs +## +## If a single source is being created, then normal rules can be used; +## using this parallel protection will not hurt, but it also won't help. +## +## Define the variable 'par_gen_command' to be the command that +## creates the sources 'gen_sources' from the dependency files +## 'gen_sources_deps'. +## + +## These STAMPS will be removed upon "make clean", but are otherwise +## not used. + +STAMPS += $(DEPDIR)/stamp-sources-generate* + +## The following STAMP will be included in the archive, to show that +## this these rules have been followed. + +EXTRA_DIST += stamp-sources-generate +MOSTLYCLEANFILES += stamp-sources-generate + +stamp-sources-generate: $(gen_sources_deps) + @rm -f $(DEPDIR)/stamp-sources-generate-tmp + @touch $(DEPDIR)/stamp-sources-generate-tmp + $(par_gen_command) + @mv -f $(DEPDIR)/stamp-sources-generate-tmp $@ + +$(gen_sources): stamp-sources-generate +## Recover from the removal of $@ + @if test -f $@; then :; else \ + trap 'rm -rf $(DEPDIR)/stamp-sources-generate-*' 1 2 13 15; \ + if mkdir $(DEPDIR)/stamp-sources-generate-lock 2>/dev/null; then \ +## This code is being executed by the first process. + rm -f stamp-sources-generate; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-sources-generate; \ + rmdir $(DEPDIR)/stamp-sources-generate-lock; \ + else \ +## This code is being executed by the follower processes. +## Wait until the first process is done. + while test -d $(DEPDIR)/stamp-sources-generate-lock; do sleep 1; done; \ +## Succeed iff the first process succeeded. + test -f stamp-sources-generate; exit $$?; \ + fi; \ + fi; diff --git a/Makefile.swig b/Makefile.swig new file mode 100644 index 00000000..9e14835e --- /dev/null +++ b/Makefile.swig @@ -0,0 +1,117 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +## This makefile should be included using +## include $(top_srcdir)/Makefile.swig +## in Makefile.am's which require SWIG wrapping / compilation. +## For just installing .i files, this Makefile is not required. + +## swig flags +## -w511 turns off keyword argument warning +## "-outdir $(builddir)" writes all generated output files to +## the local builddir (which should always be '.') +## In some older autotools, $(builddir) is not defined, so +## just use '.' instead. + +SWIG_PYTHON_FLAGS = \ + -fvirtual \ + -python \ + -modern \ + -keyword \ + -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) + +## standard SWIG LD flags for library creation + +STD_SWIG_LA_LD_FLAGS = \ + $(PYTHON_LDFLAGS) \ + -module \ + -avoid-version \ + $(NO_UNDEFINED) + +## standard SWIG library additions for library creation + +STD_SWIG_LA_LIB_ADD = \ + -lstdc++ + +## standard SWIG CXXFLAGS +## This allows for code to be compiled with "-O1" instead of "-g -O2" +## for some systems, avoiding some optimization issues. + +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 +## full path to the file and full filename including extension. This +## Makefile addition will be made only if either it does not exist or +## if the top-level template has been modified. + +generate-makefile-swig $(srcdir)/Makefile.swig.gen: $(top_srcdir)/Makefile.swig.gen.t +## recreate $(srcdir)/Makefile.swig.gen only if ... + @do_recreate=0; \ + if test -f $(srcdir)/Makefile.swig.gen; then \ +## the file exists and can be removed; or ... + if $(RM) $(srcdir)/Makefile.swig.gen 2>/dev/null; then \ + if touch $(srcdir)/Makefile.swig.gen 2>/dev/null; then \ + do_recreate=1; \ + fi; \ + fi; \ + else \ +## the file doesn't exist, but can be created (e.g., by touching it). + if touch $(srcdir)/Makefile.swig.gen 2>/dev/null; then \ + do_recreate=1; \ + fi; \ + fi; \ + if test "$$do_recreate" == "1"; then \ + echo "Regenerating $(srcdir)/Makefile.swig.gen"; \ + for TFILE in $(TOP_SWIG_IFILES); do \ +## retrieve just the filename, without path or extension + TNAME=`python -c "import os.path as op; (dN, fN) = op.split ('$$TFILE'); (fbN, fE) = op.splitext (fN); print fbN;"`; \ +## Replace the @-named strings in the template Makefile for SWIG. + $(SED) -e 's|@NAME@|'$$TNAME'|g;' < $(top_srcdir)/Makefile.swig.gen.t >> $(srcdir)/Makefile.swig.gen; \ + echo "" >> $(srcdir)/Makefile.swig.gen; \ + done; \ + else \ + echo "Cannot recreate $(srcdir)/Makefile.swig.gen because the directory or file is write-protected."; \ + 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/Makefile.swig.gen.t b/Makefile.swig.gen.t new file mode 100644 index 00000000..c15a8172 --- /dev/null +++ b/Makefile.swig.gen.t @@ -0,0 +1,258 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for @NAME@.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${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/[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_category ?= gnuradio/@NAME@ +@NAME@_pylibdir_category ?= $(@NAME@_pythondir_category) +@NAME@_pythondir = $(pythondir)/$(@NAME@_pythondir_category) +@NAME@_pylibdir = $(pyexecdir)/$(@NAME@_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +@NAME@_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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@.py @NAME@.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +@NAME@_swiginclude_HEADERS = \ + @NAME@.i \ + $(@NAME@_swiginclude_headers) + +@NAME@_pylib_LTLIBRARIES = \ + _@NAME@.la + +_@NAME@_la_SOURCES = \ + @NAME@.cc \ + $(@NAME@_la_swig_sources) + +_@NAME@_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(@NAME@_la_swig_libadd) + +_@NAME@_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(@NAME@_la_swig_ldflags) + +_@NAME@_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(@NAME@_la_swig_cxxflags) + +@NAME@_python_PYTHON = \ + @NAME@.py \ + $(@NAME@_python) + +## Entry rule for running SWIG + +@NAME@.h @NAME@.py @NAME@.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; + +$(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@ -o @NAME@.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 + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/@NAME@.d@am__quote@ diff --git a/config/grc_gnuradio_core.m4 b/config/grc_gnuradio_core.m4 index 43e6d55f..29e20c28 100644 --- a/config/grc_gnuradio_core.m4 +++ b/config/grc_gnuradio_core.m4 @@ -1,4 +1,4 @@ -dnl Copyright 2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc. +dnl Copyright 2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -65,19 +65,10 @@ AC_DEFUN([GRC_GNURADIO_CORE],[ \$(FFTW3F_CFLAGS) \ \$(GSL_CFLAGS)" gnuradio_core_LA="\${abs_top_builddir}/gnuradio-core/src/lib/libgnuradio-core.la" - gnuradio_core_I="\${abs_top_srcdir}/gnuradio-core/src/lib/swig/gnuradio.i" + dnl gnuradio_core_I="\${abs_top_srcdir}/gnuradio-core/src/lib/swig/gnuradio.i" gnuradio_core_LIBDIRPATH="\${abs_top_builddir}/gnuradio-core/src/lib:\${abs_top_builddir}/gnuradio-core/src/lib/.libs" gnuradio_core_SWIGDIRPATH="\${abs_top_builddir}/gnuradio-core/src/lib/swig:\${abs_top_builddir}/gnuradio-core/src/lib/swig/.libs:\${abs_top_srcdir}/gnuradio-core/src/lib/swig" gnuradio_core_PYDIRPATH="\${abs_top_srcdir}/gnuradio-core/src/python" - - dnl kludge up initial swig dependency files - AC_CONFIG_COMMANDS([swig_deps], [ - touch gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.d - touch gnuradio-core/src/lib/swig/gnuradio_swig_py_general.d - touch gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.d - touch gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.d - touch gnuradio-core/src/lib/swig/gnuradio_swig_py_io.d - ]) fi dnl other externally-required gnuradio-core variables diff --git a/config/grc_gr_gcell.m4 b/config/grc_gr_gcell.m4 index 191afdc0..476de364 100644 --- a/config/grc_gr_gcell.m4 +++ b/config/grc_gr_gcell.m4 @@ -1,4 +1,4 @@ -dnl Copyright 2001,2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc. +dnl Copyright 2001,2002,2003,2004,2005,2006,2008,2009 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -31,12 +31,6 @@ AC_DEFUN([GRC_GR_GCELL],[ gr-gcell/src/run_tests \ ]) - dnl kludge up initial swig dependency files - AC_CONFIG_COMMANDS([swig_gcell_deps], [ - touch gr-gcell/src/gcell.d - ]) - - GRC_BUILD_CONDITIONAL(gr-gcell,[ dnl run_tests is created from run_tests.in. Make it executable. AC_CONFIG_COMMANDS([run_tests_gcell], [chmod +x gr-gcell/src/run_tests]) diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index aaf7d41e..b7fd0f58 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -62,29 +62,13 @@ code_generator = \ gr_freq_xlating_fir_filter_XXX.h.t \ gr_freq_xlating_fir_filter_XXX.i.t -# include the srcdir's Makefile.gen; doing this creates an implicit -# dependency between $(srcdir)/Makefile.in and $(srcdir)/Makefile.gen. -include $(srcdir)/Makefile.gen - # Source built by Python into $(builddir) -python_built_sources = \ +BUILT_SOURCES = \ $(GENERATED_H) \ $(GENERATED_I) \ $(GENERATED_CC) \ filter_generated.i -BUILT_SOURCES = $(python_built_sources) - -# Required when including Makefile.gen.gen - -STAMPS = -gen_sources = $(BUILT_SOURCES) -gen_sources_deps = $(core_generator) -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc - -# common way for generating sources from templates, using the above parameters -include $(top_srcdir)/Makefile.gen.gen - # ---------------------------------------------------------------- # MD_CPU and MD_SUBCPU are set at configure time by way of # gnuradio/config/gr_set_md_cpu.m4. @@ -326,3 +310,20 @@ swiginclude_HEADERS = \ gr_single_pole_iir_filter_ff.i \ gr_single_pole_iir_filter_cc.i \ $(GENERATED_I) + +# Do creation and inclusion of other Makefiles last + +# include the srcdir's Makefile.gen; doing this creates an implicit +# dependency between $(srcdir)/Makefile.in and $(srcdir)/Makefile.gen. +include $(srcdir)/Makefile.gen + +# common way for generating local Makefile.gen +makefile_gen_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) do_makefile=1 do_sources=0 $(PYTHON) $(srcdir)/generate_all.py +include $(top_srcdir)/Makefile.gen.gen + +# common way for generating sources from templates when using +# BUILT_SOURCES, using parallel build protection. +gen_sources = $(BUILT_SOURCES) +gen_sources_deps = $(core_generator) +par_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py +include $(top_srcdir)/Makefile.par.gen diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 7d486092..fa3ccd5a 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2001,2002,2004,2006,2007,2008 Free Software Foundation, Inc. +# Copyright 2001,2002,2004,2006,2007,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -475,6 +475,3 @@ swiginclude_HEADERS = \ gr_scrambler_bb.i \ gr_probe_mpsk_snr_c.i \ gr_probe_density_b.i - - -CLEANFILES = $(BUILT_SOURCES) *.pyc diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am index e969eb90..13c82101 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.am +++ b/gnuradio-core/src/lib/gengen/Makefile.am @@ -120,29 +120,13 @@ core_generator = \ gr_moving_average_XX.h.t \ gr_moving_average_XX.i.t -# include the srcdir's Makefile.gen; doing this creates an implicit -# dependency between $(srcdir)/Makefile.in and $(srcdir)/Makefile.gen. -include $(srcdir)/Makefile.gen - # Source built by Python into $(builddir) -python_built_sources = \ +BUILT_SOURCES = \ $(GENERATED_H) \ $(GENERATED_I) \ $(GENERATED_CC) \ gengen_generated.i -BUILT_SOURCES = $(python_built_sources) - -# Required when including Makefile.gen.gen - -STAMPS = -gen_sources = $(BUILT_SOURCES) -gen_sources_deps = $(core_generator) -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc - -# common way for generating sources from templates, using the above parameters -include $(top_srcdir)/Makefile.gen.gen - # ---------------------------------------------------------------- EXTRA_DIST = \ @@ -151,20 +135,31 @@ EXTRA_DIST = \ libgengen_la_SOURCES = \ $(GENERATED_CC) -#libgengen_qa_la_SOURCES = - grinclude_HEADERS = \ $(GENERATED_H) \ gr_endianness.h \ gr_noise_type.h \ gr_sig_source_waveform.h -noinst_HEADERS = - swiginclude_HEADERS = \ $(GENERATED_I) \ gr_endianness.i \ gengen.i \ gengen_generated.i -CLEANFILES = $(BUILT_SOURCES) *.pyc +# Do creation and inclusion of other Makefiles last + +# include the srcdir's Makefile.gen; doing this creates an implicit +# dependency between $(srcdir)/Makefile.in and $(srcdir)/Makefile.gen. +include $(srcdir)/Makefile.gen + +# common way for generating local Makefile.gen +makefile_gen_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) do_makefile=1 do_sources=0 $(PYTHON) $(srcdir)/generate_all.py +include $(top_srcdir)/Makefile.gen.gen + +# common way for generating sources from templates when using +# BUILT_SOURCES, using parallel build protection. +gen_sources = $(BUILT_SOURCES) +gen_sources_deps = $(core_generator) +par_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py +include $(top_srcdir)/Makefile.par.gen diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am index cc8da49d..af5e4980 100644 --- a/gnuradio-core/src/lib/runtime/Makefile.am +++ b/gnuradio-core/src/lib/runtime/Makefile.am @@ -154,5 +154,3 @@ swiginclude_HEADERS = \ gr_sync_interpolator.i \ gr_top_block.i \ runtime.i - -MOSTLYCLEANFILES = *~ *.loT diff --git a/gnuradio-core/src/lib/swig/Makefile.am b/gnuradio-core/src/lib/swig/Makefile.am index 98c03219..734388d4 100644 --- a/gnuradio-core/src/lib/swig/Makefile.am +++ b/gnuradio-core/src/lib/swig/Makefile.am @@ -21,241 +21,21 @@ include $(top_srcdir)/Makefile.common -# Install this stuff in the gr subdirectory of the python pkg dir. -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/gr - -grgrpythondir = $(grpythondir)/gr -grgrlibdir = $(grpyexecdir)/gr - AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) -I$(srcdir) \ $(WITH_INCLUDES) EXTRA_DIST = gen-swig-bug-fix -LOCAL_IFILES = \ +# SWIG headers get installed in ${prefix}/include/gnuradio/swig +swiginclude_HEADERS = \ gnuradio.i \ gr_swig_block_magic.i \ - gr_shared_ptr.i \ - sw_general.i \ - sw_gengen.i \ - sw_filter.i \ - sw_io.i \ - sw_runtime.i - -ALL_IFILES = \ - $(LOCAL_IFILES) - -# ---------------------------------------------------------------- -# We've split the previously monstrous gnuradio_swig_python into -# 5 smaller pieces. This reduces compile time coupling and -# creates smaller pieces for the compiler to digest. -# prior to this change, on X86_64, g++'s resident set size was -# 650MB! - -BUILT_SOURCES = \ - gnuradio_swig_py_runtime.cc \ - gnuradio_swig_py_runtime.py \ - gnuradio_swig_py_runtime.h \ - gnuradio_swig_py_general.cc \ - gnuradio_swig_py_general.py \ - gnuradio_swig_py_general.h \ - gnuradio_swig_py_gengen.cc \ - gnuradio_swig_py_gengen.py \ - gnuradio_swig_py_gengen.h \ - gnuradio_swig_py_filter.cc \ - gnuradio_swig_py_filter.py \ - gnuradio_swig_py_filter.h \ - gnuradio_swig_py_io.cc \ - gnuradio_swig_py_io.py \ - gnuradio_swig_py_io.h \ - gnuradio_swig_bug_workaround.h - -# ---------------------------------------------------------------- -# We break this up into 5 libraries... - -grgrlib_LTLIBRARIES = \ - _gnuradio_swig_py_runtime.la \ - _gnuradio_swig_py_general.la \ - _gnuradio_swig_py_gengen.la \ - _gnuradio_swig_py_filter.la \ - _gnuradio_swig_py_io.la - - -grgrpython_PYTHON = \ - gnuradio_swig_python.py \ - gnuradio_swig_py_runtime.py \ - gnuradio_swig_py_general.py \ - gnuradio_swig_py_gengen.py \ - gnuradio_swig_py_filter.py \ - gnuradio_swig_py_io.py - - -# This results in the code being compiled with -O1 instead of -g -O2 - -_gnuradio_swig_py_runtime_la_CXXFLAGS = @swig_CXXFLAGS@ -_gnuradio_swig_py_general_la_CXXFLAGS = @swig_CXXFLAGS@ -_gnuradio_swig_py_gengen_la_CXXFLAGS = @swig_CXXFLAGS@ -_gnuradio_swig_py_filter_la_CXXFLAGS = @swig_CXXFLAGS@ -_gnuradio_swig_py_io_la_CXXFLAGS = @swig_CXXFLAGS@ - - -# ---------------------------------------------------------------- -# Part 1: sw_runtime.i -> gnuradio_swig_py_runtime -# -# We continue to call this gnuradio.i to avoid having to touch -# lots of code in other modules - -_gnuradio_swig_py_runtime_la_SOURCES = \ - gnuradio_swig_py_runtime.cc - - -_gnuradio_swig_py_runtime_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - $(PYTHON_LDFLAGS) \ - -lstdc++ - -_gnuradio_swig_py_runtime_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - - -# KLUDGE: Force runtime include of gnuradio_swig_py_runtime.d 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. -@am__include@ @am__quote@./gnuradio_swig_py_runtime.d@am__quote@ - -gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.h: gnuradio_swig_py_runtime.cc - -gnuradio_swig_py_runtime.cc : $(srcdir)/sw_runtime.i - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) -MMD -MF gnuradio_swig_py_runtime.Td -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime.cc $(srcdir)/sw_runtime.i ;\ - then if test $(host_os) = mingw32; \ - then sed 's,\\\\,/,g' gnuradio_swig_py_runtime.d; rm -f gnuradio_swig_py_runtime.Td; \ - else mv -f gnuradio_swig_py_runtime.Td gnuradio_swig_py_runtime.d; fi \ - else rm -f gnuradio_swig_py_runtime.Td; exit 1; fi - - -# ---------------------------------------------------------------- -# Part 2: sw_general.i -> gnuradio_swig_py_general -# - -_gnuradio_swig_py_general_la_SOURCES = \ - gnuradio_swig_py_general.cc - - -_gnuradio_swig_py_general_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - $(PYTHON_LDFLAGS) \ - -lstdc++ - -_gnuradio_swig_py_general_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - - -# KLUDGE: Force general include of gnuradio_swig_py_general.d 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. -@am__include@ @am__quote@./gnuradio_swig_py_general.d@am__quote@ - -gnuradio_swig_py_general.py gnuradio_swig_py_general.h: gnuradio_swig_py_general.cc - -gnuradio_swig_py_general.cc : $(srcdir)/sw_general.i - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) -MMD -MF gnuradio_swig_py_general.Td -module gnuradio_swig_py_general -o gnuradio_swig_py_general.cc $(srcdir)/sw_general.i ;\ - then if test $(host_os) = mingw32; \ - then sed 's,\\\\,/,g' gnuradio_swig_py_general.d; rm -f gnuradio_swig_py_general.Td; \ - else mv -f gnuradio_swig_py_general.Td gnuradio_swig_py_general.d; fi \ - else rm -f gnuradio_swig_py_general.Td; exit 1; fi - - -# ---------------------------------------------------------------- -# Part 3: sw_gengen.i -> gnuradio_swig_py_gengen -# - -_gnuradio_swig_py_gengen_la_SOURCES = \ - gnuradio_swig_py_gengen.cc - - -_gnuradio_swig_py_gengen_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - $(PYTHON_LDFLAGS) \ - -lstdc++ - -_gnuradio_swig_py_gengen_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - - -# KLUDGE: Force gengen include of gnuradio_swig_py_gengen.d 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. -@am__include@ @am__quote@./gnuradio_swig_py_gengen.d@am__quote@ - -gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.h: gnuradio_swig_py_gengen.cc - -gnuradio_swig_py_gengen.cc : $(srcdir)/sw_gengen.i - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) -MMD -MF gnuradio_swig_py_gengen.Td -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen.cc $(srcdir)/sw_gengen.i ;\ - then if test $(host_os) = mingw32; \ - then sed 's,\\\\,/,g' gnuradio_swig_py_gengen.d; rm -f gnuradio_swig_py_gengen.Td; \ - else mv -f gnuradio_swig_py_gengen.Td gnuradio_swig_py_gengen.d; fi \ - else rm -f gnuradio_swig_py_gengen.Td; exit 1; fi - - -# ---------------------------------------------------------------- -# Part 4: sw_filter.i -> gnuradio_swig_py_filter -# - -_gnuradio_swig_py_filter_la_SOURCES = \ - gnuradio_swig_py_filter.cc - - -_gnuradio_swig_py_filter_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - $(PYTHON_LDFLAGS) \ - -lstdc++ - -_gnuradio_swig_py_filter_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - - -# KLUDGE: Force filter include of gnuradio_swig_py_filter.d 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. -@am__include@ @am__quote@./gnuradio_swig_py_filter.d@am__quote@ - -gnuradio_swig_py_filter.py gnuradio_swig_py_filter.h: gnuradio_swig_py_filter.cc - -gnuradio_swig_py_filter.cc : $(srcdir)/sw_filter.i - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) -MMD -MF gnuradio_swig_py_filter.Td -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter.cc $(srcdir)/sw_filter.i ;\ - then if test $(host_os) = mingw32; \ - then sed 's,\\\\,/,g' gnuradio_swig_py_filter.d; rm -f gnuradio_swig_py_filter.Td; \ - else mv -f gnuradio_swig_py_filter.Td gnuradio_swig_py_filter.d; fi \ - else rm -f gnuradio_swig_py_filter.Td; exit 1; fi - - -# ---------------------------------------------------------------- -# Part 5: sw_io.i -> gnuradio_swig_py_io -# - -_gnuradio_swig_py_io_la_SOURCES = \ - gnuradio_swig_py_io.cc - - -_gnuradio_swig_py_io_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - $(PYTHON_LDFLAGS) \ - -lstdc++ - -_gnuradio_swig_py_io_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - - -# KLUDGE: Force io include of gnuradio_swig_py_io.d 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. -@am__include@ @am__quote@./gnuradio_swig_py_io.d@am__quote@ - -gnuradio_swig_py_io.py gnuradio_swig_py_io.h: gnuradio_swig_py_io.cc - -gnuradio_swig_py_io.cc : $(srcdir)/sw_io.i - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) -MMD -MF gnuradio_swig_py_io.Td -module gnuradio_swig_py_io -o gnuradio_swig_py_io.cc $(srcdir)/sw_io.i ;\ - then if test $(host_os) = mingw32; \ - then sed 's,\\\\,/,g' gnuradio_swig_py_io.d; rm -f gnuradio_swig_py_io.Td; \ - else mv -f gnuradio_swig_py_io.Td gnuradio_swig_py_io.d; fi \ - else rm -f gnuradio_swig_py_io.Td; exit 1; fi + gr_shared_ptr.i +# special install for this top-level Python script which includes all +# of the split Python libraries. +ourpythondir = $(grpythondir)/gr +ourpython_PYTHON = gnuradio_swig_python.py # ---------------------------------------------------------------- # FIXME As of swig 1.3.31, this still seems to be required... @@ -263,26 +43,55 @@ gnuradio_swig_py_io.cc : $(srcdir)/sw_io.i gnuradio_swig_bug_workaround.h : gnuradio_swig_py_runtime.cc $(srcdir)/gen-swig-bug-fix $(PYTHON) $(srcdir)/gen-swig-bug-fix gnuradio_swig_py_runtime.cc $@ +# C/C++ headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + gnuradio_swig_bug_workaround.h + +# ---------------------------------------------------------------- +# We've split the previously monstrous gnuradio_swig_python into 5 +# smaller pieces. This reduces compile time coupling and creates +# smaller pieces for the compiler to digest. prior to this change, on +# X86_64, g++'s resident set size was 650MB! # ---------------------------------------------------------------- -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +TOP_SWIG_IFILES = \ + gnuradio_swig_py_runtime.i \ + gnuradio_swig_py_general.i \ + gnuradio_swig_py_gengen.i \ + gnuradio_swig_py_filter.i \ + gnuradio_swig_py_io.i + +# Install so that they end up available as: +# import gnuradio.gr +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/gr +gnuradio_swig_py_runtime_pythondir_category = gnuradio/gr +gnuradio_swig_py_general_pythondir_category = gnuradio/gr +gnuradio_swig_py_gengen_pythondir_category = gnuradio/gr +gnuradio_swig_py_filter_pythondir_category = gnuradio/gr +gnuradio_swig_py_io_pythondir_category = gnuradio/gr +# additional libraries for linking with each SWIG-generated library +gnuradio_swig_py_runtime_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_swig_py_general_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_swig_py_gengen_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_swig_py_filter_la_swig_libadd = $(GNURADIO_CORE_LA) +gnuradio_swig_py_io_la_swig_libadd = $(GNURADIO_CORE_LA) -grinclude_HEADERS = \ - gnuradio_swig_bug_workaround.h +include $(top_srcdir)/Makefile.swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +# add some of the variables generated inside the Makefile.swig -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc +# include the SWIG-generated .h files in the BUILT SOURCES, since they +# aren't by default when using Makefile.swig; order doesn't matter. +BUILT_SOURCES = \ + gnuradio_swig_py_runtime.h \ + gnuradio_swig_py_general.h \ + gnuradio_swig_py_gengen.h \ + gnuradio_swig_py_filter.h \ + gnuradio_swig_py_io.h \ + $(grinclude_HEADERS) \ + $(swig_built_sources) -DISTCLEANFILES = \ - gnuradio_swig_py_runtime.d \ - gnuradio_swig_py_general.d \ - gnuradio_swig_py_gengen.d \ - gnuradio_swig_py_filter.d \ - gnuradio_swig_py_io.d +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gnuradio-core/src/lib/swig/Makefile.swig.gen b/gnuradio-core/src/lib/swig/Makefile.swig.gen new file mode 100644 index 00000000..ebb98a05 --- /dev/null +++ b/gnuradio-core/src/lib/swig/Makefile.swig.gen @@ -0,0 +1,1295 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for gnuradio_swig_py_runtime.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_runtime +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_runtime +## +## 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. + +gnuradio_swig_py_runtime_pythondir_category ?= gnuradio/gnuradio_swig_py_runtime +gnuradio_swig_py_runtime_pylibdir_category ?= $(gnuradio_swig_py_runtime_pythondir_category) +gnuradio_swig_py_runtime_pythondir = $(pythondir)/$(gnuradio_swig_py_runtime_pythondir_category) +gnuradio_swig_py_runtime_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_runtime_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +gnuradio_swig_py_runtime_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/gnuradio_swig_py_runtime-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 += gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +gnuradio_swig_py_runtime_swiginclude_HEADERS = \ + gnuradio_swig_py_runtime.i \ + $(gnuradio_swig_py_runtime_swiginclude_headers) + +gnuradio_swig_py_runtime_pylib_LTLIBRARIES = \ + _gnuradio_swig_py_runtime.la + +_gnuradio_swig_py_runtime_la_SOURCES = \ + gnuradio_swig_py_runtime.cc \ + $(gnuradio_swig_py_runtime_la_swig_sources) + +_gnuradio_swig_py_runtime_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_swig_py_runtime_la_swig_libadd) + +_gnuradio_swig_py_runtime_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_swig_py_runtime_la_swig_ldflags) + +_gnuradio_swig_py_runtime_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(gnuradio_swig_py_runtime_la_swig_cxxflags) + +gnuradio_swig_py_runtime_python_PYTHON = \ + gnuradio_swig_py_runtime.py \ + $(gnuradio_swig_py_runtime_python) + +## Entry rule for running SWIG + +gnuradio_swig_py_runtime.h gnuradio_swig_py_runtime.py gnuradio_swig_py_runtime.cc: gnuradio_swig_py_runtime.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)/gnuradio_swig_py_runtime-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)/gnuradio_swig_py_runtime-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)/gnuradio_swig_py_runtime-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)/gnuradio_swig_py_runtime-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_runtime-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)/gnuradio_swig_py_runtime-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)/gnuradio_swig_py_runtime-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)/gnuradio_swig_py_runtime-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/gnuradio_swig_py_runtime-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) $(gnuradio_swig_py_runtime_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_runtime.Std \ + -module gnuradio_swig_py_runtime -o gnuradio_swig_py_runtime.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_runtime.Std \ + > $(DEPDIR)/gnuradio_swig_py_runtime.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_runtime.Sd $(DEPDIR)/gnuradio_swig_py_runtime.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.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)/gnuradio_swig_py_runtime.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/gnuradio_swig_py_runtime.Std $(DEPDIR)/gnuradio_swig_py_runtime.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/gnuradio_swig_py_runtime.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)/gnuradio_swig_py_runtime.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_runtime.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/gnuradio_swig_py_runtime.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)/gnuradio_swig_py_runtime-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_runtime.d@am__quote@ + +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for gnuradio_swig_py_general.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_general +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_general +## +## 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. + +gnuradio_swig_py_general_pythondir_category ?= gnuradio/gnuradio_swig_py_general +gnuradio_swig_py_general_pylibdir_category ?= $(gnuradio_swig_py_general_pythondir_category) +gnuradio_swig_py_general_pythondir = $(pythondir)/$(gnuradio_swig_py_general_pythondir_category) +gnuradio_swig_py_general_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_general_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +gnuradio_swig_py_general_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/gnuradio_swig_py_general-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 += gnuradio_swig_py_general.py gnuradio_swig_py_general.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +gnuradio_swig_py_general_swiginclude_HEADERS = \ + gnuradio_swig_py_general.i \ + $(gnuradio_swig_py_general_swiginclude_headers) + +gnuradio_swig_py_general_pylib_LTLIBRARIES = \ + _gnuradio_swig_py_general.la + +_gnuradio_swig_py_general_la_SOURCES = \ + gnuradio_swig_py_general.cc \ + $(gnuradio_swig_py_general_la_swig_sources) + +_gnuradio_swig_py_general_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_swig_py_general_la_swig_libadd) + +_gnuradio_swig_py_general_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_swig_py_general_la_swig_ldflags) + +_gnuradio_swig_py_general_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(gnuradio_swig_py_general_la_swig_cxxflags) + +gnuradio_swig_py_general_python_PYTHON = \ + gnuradio_swig_py_general.py \ + $(gnuradio_swig_py_general_python) + +## Entry rule for running SWIG + +gnuradio_swig_py_general.h gnuradio_swig_py_general.py gnuradio_swig_py_general.cc: gnuradio_swig_py_general.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)/gnuradio_swig_py_general-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)/gnuradio_swig_py_general-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)/gnuradio_swig_py_general-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)/gnuradio_swig_py_general-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_general-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)/gnuradio_swig_py_general-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)/gnuradio_swig_py_general-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)/gnuradio_swig_py_general-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/gnuradio_swig_py_general-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) $(gnuradio_swig_py_general_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_general.Std \ + -module gnuradio_swig_py_general -o gnuradio_swig_py_general.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_general.Std \ + > $(DEPDIR)/gnuradio_swig_py_general.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_general.Sd $(DEPDIR)/gnuradio_swig_py_general.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_general.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)/gnuradio_swig_py_general.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/gnuradio_swig_py_general.Std $(DEPDIR)/gnuradio_swig_py_general.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/gnuradio_swig_py_general.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)/gnuradio_swig_py_general.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_general.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/gnuradio_swig_py_general.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)/gnuradio_swig_py_general-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_general.d@am__quote@ + +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for gnuradio_swig_py_gengen.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_gengen +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_gengen +## +## 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. + +gnuradio_swig_py_gengen_pythondir_category ?= gnuradio/gnuradio_swig_py_gengen +gnuradio_swig_py_gengen_pylibdir_category ?= $(gnuradio_swig_py_gengen_pythondir_category) +gnuradio_swig_py_gengen_pythondir = $(pythondir)/$(gnuradio_swig_py_gengen_pythondir_category) +gnuradio_swig_py_gengen_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_gengen_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +gnuradio_swig_py_gengen_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/gnuradio_swig_py_gengen-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 += gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +gnuradio_swig_py_gengen_swiginclude_HEADERS = \ + gnuradio_swig_py_gengen.i \ + $(gnuradio_swig_py_gengen_swiginclude_headers) + +gnuradio_swig_py_gengen_pylib_LTLIBRARIES = \ + _gnuradio_swig_py_gengen.la + +_gnuradio_swig_py_gengen_la_SOURCES = \ + gnuradio_swig_py_gengen.cc \ + $(gnuradio_swig_py_gengen_la_swig_sources) + +_gnuradio_swig_py_gengen_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_swig_py_gengen_la_swig_libadd) + +_gnuradio_swig_py_gengen_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_swig_py_gengen_la_swig_ldflags) + +_gnuradio_swig_py_gengen_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(gnuradio_swig_py_gengen_la_swig_cxxflags) + +gnuradio_swig_py_gengen_python_PYTHON = \ + gnuradio_swig_py_gengen.py \ + $(gnuradio_swig_py_gengen_python) + +## Entry rule for running SWIG + +gnuradio_swig_py_gengen.h gnuradio_swig_py_gengen.py gnuradio_swig_py_gengen.cc: gnuradio_swig_py_gengen.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)/gnuradio_swig_py_gengen-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)/gnuradio_swig_py_gengen-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)/gnuradio_swig_py_gengen-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)/gnuradio_swig_py_gengen-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_gengen-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)/gnuradio_swig_py_gengen-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)/gnuradio_swig_py_gengen-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)/gnuradio_swig_py_gengen-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/gnuradio_swig_py_gengen-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) $(gnuradio_swig_py_gengen_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_gengen.Std \ + -module gnuradio_swig_py_gengen -o gnuradio_swig_py_gengen.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_gengen.Std \ + > $(DEPDIR)/gnuradio_swig_py_gengen.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_gengen.Sd $(DEPDIR)/gnuradio_swig_py_gengen.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.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)/gnuradio_swig_py_gengen.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/gnuradio_swig_py_gengen.Std $(DEPDIR)/gnuradio_swig_py_gengen.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/gnuradio_swig_py_gengen.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)/gnuradio_swig_py_gengen.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_gengen.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/gnuradio_swig_py_gengen.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)/gnuradio_swig_py_gengen-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_gengen.d@am__quote@ + +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for gnuradio_swig_py_filter.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_filter +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_filter +## +## 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. + +gnuradio_swig_py_filter_pythondir_category ?= gnuradio/gnuradio_swig_py_filter +gnuradio_swig_py_filter_pylibdir_category ?= $(gnuradio_swig_py_filter_pythondir_category) +gnuradio_swig_py_filter_pythondir = $(pythondir)/$(gnuradio_swig_py_filter_pythondir_category) +gnuradio_swig_py_filter_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_filter_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +gnuradio_swig_py_filter_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/gnuradio_swig_py_filter-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 += gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +gnuradio_swig_py_filter_swiginclude_HEADERS = \ + gnuradio_swig_py_filter.i \ + $(gnuradio_swig_py_filter_swiginclude_headers) + +gnuradio_swig_py_filter_pylib_LTLIBRARIES = \ + _gnuradio_swig_py_filter.la + +_gnuradio_swig_py_filter_la_SOURCES = \ + gnuradio_swig_py_filter.cc \ + $(gnuradio_swig_py_filter_la_swig_sources) + +_gnuradio_swig_py_filter_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_swig_py_filter_la_swig_libadd) + +_gnuradio_swig_py_filter_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_swig_py_filter_la_swig_ldflags) + +_gnuradio_swig_py_filter_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(gnuradio_swig_py_filter_la_swig_cxxflags) + +gnuradio_swig_py_filter_python_PYTHON = \ + gnuradio_swig_py_filter.py \ + $(gnuradio_swig_py_filter_python) + +## Entry rule for running SWIG + +gnuradio_swig_py_filter.h gnuradio_swig_py_filter.py gnuradio_swig_py_filter.cc: gnuradio_swig_py_filter.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)/gnuradio_swig_py_filter-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)/gnuradio_swig_py_filter-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)/gnuradio_swig_py_filter-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)/gnuradio_swig_py_filter-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_filter-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)/gnuradio_swig_py_filter-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)/gnuradio_swig_py_filter-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)/gnuradio_swig_py_filter-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/gnuradio_swig_py_filter-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) $(gnuradio_swig_py_filter_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_filter.Std \ + -module gnuradio_swig_py_filter -o gnuradio_swig_py_filter.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_filter.Std \ + > $(DEPDIR)/gnuradio_swig_py_filter.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_filter.Sd $(DEPDIR)/gnuradio_swig_py_filter.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_filter.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)/gnuradio_swig_py_filter.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/gnuradio_swig_py_filter.Std $(DEPDIR)/gnuradio_swig_py_filter.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/gnuradio_swig_py_filter.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)/gnuradio_swig_py_filter.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_filter.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/gnuradio_swig_py_filter.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)/gnuradio_swig_py_filter-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_filter.d@am__quote@ + +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for gnuradio_swig_py_io.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_io +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gnuradio_swig_py_io +## +## 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. + +gnuradio_swig_py_io_pythondir_category ?= gnuradio/gnuradio_swig_py_io +gnuradio_swig_py_io_pylibdir_category ?= $(gnuradio_swig_py_io_pythondir_category) +gnuradio_swig_py_io_pythondir = $(pythondir)/$(gnuradio_swig_py_io_pythondir_category) +gnuradio_swig_py_io_pylibdir = $(pyexecdir)/$(gnuradio_swig_py_io_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +gnuradio_swig_py_io_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/gnuradio_swig_py_io-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 += gnuradio_swig_py_io.py gnuradio_swig_py_io.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +gnuradio_swig_py_io_swiginclude_HEADERS = \ + gnuradio_swig_py_io.i \ + $(gnuradio_swig_py_io_swiginclude_headers) + +gnuradio_swig_py_io_pylib_LTLIBRARIES = \ + _gnuradio_swig_py_io.la + +_gnuradio_swig_py_io_la_SOURCES = \ + gnuradio_swig_py_io.cc \ + $(gnuradio_swig_py_io_la_swig_sources) + +_gnuradio_swig_py_io_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gnuradio_swig_py_io_la_swig_libadd) + +_gnuradio_swig_py_io_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gnuradio_swig_py_io_la_swig_ldflags) + +_gnuradio_swig_py_io_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(gnuradio_swig_py_io_la_swig_cxxflags) + +gnuradio_swig_py_io_python_PYTHON = \ + gnuradio_swig_py_io.py \ + $(gnuradio_swig_py_io_python) + +## Entry rule for running SWIG + +gnuradio_swig_py_io.h gnuradio_swig_py_io.py gnuradio_swig_py_io.cc: gnuradio_swig_py_io.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)/gnuradio_swig_py_io-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)/gnuradio_swig_py_io-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)/gnuradio_swig_py_io-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)/gnuradio_swig_py_io-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gnuradio_swig_py_io-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)/gnuradio_swig_py_io-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)/gnuradio_swig_py_io-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)/gnuradio_swig_py_io-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/gnuradio_swig_py_io-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) $(gnuradio_swig_py_io_swig_args) \ + -MD -MF $(DEPDIR)/gnuradio_swig_py_io.Std \ + -module gnuradio_swig_py_io -o gnuradio_swig_py_io.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gnuradio_swig_py_io.Std \ + > $(DEPDIR)/gnuradio_swig_py_io.Sd; \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io.Std; \ + $(MV) $(DEPDIR)/gnuradio_swig_py_io.Sd $(DEPDIR)/gnuradio_swig_py_io.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gnuradio_swig_py_io.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)/gnuradio_swig_py_io.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/gnuradio_swig_py_io.Std $(DEPDIR)/gnuradio_swig_py_io.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/gnuradio_swig_py_io.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)/gnuradio_swig_py_io.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gnuradio_swig_py_io.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/gnuradio_swig_py_io.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)/gnuradio_swig_py_io-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/gnuradio_swig_py_io.d@am__quote@ + diff --git a/gnuradio-core/src/lib/swig/sw_filter.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i similarity index 100% rename from gnuradio-core/src/lib/swig/sw_filter.i rename to gnuradio-core/src/lib/swig/gnuradio_swig_py_filter.i diff --git a/gnuradio-core/src/lib/swig/sw_general.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i similarity index 100% rename from gnuradio-core/src/lib/swig/sw_general.i rename to gnuradio-core/src/lib/swig/gnuradio_swig_py_general.i diff --git a/gnuradio-core/src/lib/swig/sw_gengen.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i similarity index 100% rename from gnuradio-core/src/lib/swig/sw_gengen.i rename to gnuradio-core/src/lib/swig/gnuradio_swig_py_gengen.i diff --git a/gnuradio-core/src/lib/swig/sw_io.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i similarity index 100% rename from gnuradio-core/src/lib/swig/sw_io.i rename to gnuradio-core/src/lib/swig/gnuradio_swig_py_io.i diff --git a/gnuradio-core/src/lib/swig/sw_runtime.i b/gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i similarity index 100% rename from gnuradio-core/src/lib/swig/sw_runtime.i rename to gnuradio-core/src/lib/swig/gnuradio_swig_py_runtime.i diff --git a/gnuradio-core/src/python/bin/Makefile.am b/gnuradio-core/src/python/bin/Makefile.am index 5318777b..0afd3276 100644 --- a/gnuradio-core/src/python/bin/Makefile.am +++ b/gnuradio-core/src/python/bin/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -26,5 +26,3 @@ EXTRA_DIST = microtune.py noinst_SCRIPTS = \ microtune.py - -CLEANFILES = *.pyc diff --git a/gnuradio-core/src/python/gnuradio/Makefile.am b/gnuradio-core/src/python/gnuradio/Makefile.am index d0188215..5cc0824b 100644 --- a/gnuradio-core/src/python/gnuradio/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2007,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -34,5 +34,3 @@ grpython_PYTHON = \ gr_unittest.py \ optfir.py \ window.py - -CLEANFILES = *.pyc diff --git a/gnuradio-core/src/python/gnuradio/blks2/Makefile.am b/gnuradio-core/src/python/gnuradio/blks2/Makefile.am index f79e3055..04b7c650 100644 --- a/gnuradio-core/src/python/gnuradio/blks2/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/blks2/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -28,8 +28,3 @@ grblks2pythondir = $(grpythondir)/blks2 grblks2python_PYTHON = \ __init__.py - - -noinst_PYTHON = - -CLEANFILES = *.pyc *.pyo diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am b/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am index 66540c77..09cd92fc 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2005,2007 Free Software Foundation, Inc. +# Copyright 2005,2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -60,8 +60,3 @@ grblkspython_PYTHON = \ wfm_rcv.py \ wfm_rcv_pll.py \ wfm_tx.py - - -noinst_PYTHON = - -CLEANFILES = *.pyc *.pyo diff --git a/gnuradio-core/src/python/gnuradio/gru/Makefile.am b/gnuradio-core/src/python/gnuradio/gru/Makefile.am index 361ab82a..9b311d81 100644 --- a/gnuradio-core/src/python/gnuradio/gru/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/gru/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -28,8 +28,3 @@ grblkspythondir = $(grpythondir)/gru grblkspython_PYTHON = \ __init__.py - - -noinst_PYTHON = - -CLEANFILES = *.pyc *.pyo diff --git a/gnuradio-core/src/python/gnuradio/gruimpl/Makefile.am b/gnuradio-core/src/python/gnuradio/gruimpl/Makefile.am index b2ed7e64..314358a7 100644 --- a/gnuradio-core/src/python/gnuradio/gruimpl/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/gruimpl/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2005 Free Software Foundation, Inc. +# Copyright 2005,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -37,5 +37,3 @@ grupython_PYTHON = \ seq_with_cursor.py \ socket_stuff.py \ daemon.py - -CLEANFILES = *.pyc diff --git a/gnuradio-examples/c++/dial_tone/Makefile.am b/gnuradio-examples/c++/dial_tone/Makefile.am index 8acb5470..ea34beee 100644 --- a/gnuradio-examples/c++/dial_tone/Makefile.am +++ b/gnuradio-examples/c++/dial_tone/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2006,2008 Free Software Foundation, Inc. +# Copyright 2006,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -42,5 +42,3 @@ dial_tone_SOURCES = \ dial_tone_LDADD = \ $(GNURADIO_CORE_LA) \ $(GR_AUDIO_ALSA_LA) - -MOSTLYCLEANFILES = *~ diff --git a/gnuradio-examples/python/digital-bert/Makefile.am b/gnuradio-examples/python/digital-bert/Makefile.am index 4275af54..17b2de74 100644 --- a/gnuradio-examples/python/digital-bert/Makefile.am +++ b/gnuradio-examples/python/digital-bert/Makefile.am @@ -28,5 +28,3 @@ dist_ourdata_SCRIPTS = \ benchmark_tx.py \ receive_path.py \ transmit_path.py - -MOSTLYCLEANFILES = *.pyc *.pyo *~ diff --git a/gnuradio-examples/python/digital/Makefile.am b/gnuradio-examples/python/digital/Makefile.am index 2bc44816..f151c432 100644 --- a/gnuradio-examples/python/digital/Makefile.am +++ b/gnuradio-examples/python/digital/Makefile.am @@ -41,5 +41,3 @@ dist_ourdata_SCRIPTS = \ transmit_path_lb.py \ tunnel.py \ tx_voice.py - -MOSTLYCLEANFILES = *.pyc *.pyo *~ diff --git a/gnuradio-examples/python/network/Makefile.am b/gnuradio-examples/python/network/Makefile.am index a5dddeec..77cacbfd 100644 --- a/gnuradio-examples/python/network/Makefile.am +++ b/gnuradio-examples/python/network/Makefile.am @@ -30,5 +30,3 @@ dist_ourdata_SCRIPTS = \ dial_tone_source.py \ vector_sink.py \ vector_source.py - -MOSTLYCLEANFILES = *.pyc *~ diff --git a/gr-atsc/src/lib/Makefile.am b/gr-atsc/src/lib/Makefile.am index 21a25bc1..905eaa57 100644 --- a/gr-atsc/src/lib/Makefile.am +++ b/gr-atsc/src/lib/Makefile.am @@ -21,13 +21,6 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.atsc module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ $(CPPUNIT_INCLUDES) $(WITH_INCLUDES) @@ -37,17 +30,10 @@ EXTRA_DIST = \ qa_atsci_trellis_encoder_t1_input.dat \ qa_atsci_trellis_encoder_t1_output.dat \ qa_atsci_viterbi_decoder_t1_input.dat \ - qa_atsci_viterbi_decoder_t1_output.dat - - -BUILT_SOURCES = \ - atsci_viterbi_mux.cc \ - $(swig_built_sources) - + qa_atsci_viterbi_decoder_t1_output.dat TESTS = \ - test_atsci - + test_atsci # We build two libtool convenience libraries @@ -60,7 +46,7 @@ noinst_LTLIBRARIES = libatsc.la libatsc-qa.la # atsci_vsbtx_lp.cc \ # -libatsc_la_SOURCES = \ +libatsc_la_SOURCES = \ atsc_derandomizer.cc \ atsc_randomizer.cc \ atsc_rs_decoder.cc \ @@ -102,6 +88,9 @@ libatsc_la_SOURCES = \ create_atsci_fs_correlator.cc \ plinfo.cc +libatsc_la_LIBADD = \ + $(GNURADIO_CORE_LA) + libatsc_qa_la_SOURCES = \ qa_atsci_basic_trellis_encoder.cc \ qa_atsci_data_interleaver.cc \ @@ -118,6 +107,8 @@ libatsc_qa_la_SOURCES = \ qa_atsci.cc \ qa_interleaver_fifo.cc +libatsc_qa_la_LIBADD = \ + $(GNURADIO_CORE_LA) # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ @@ -186,14 +177,13 @@ grinclude_HEADERS = \ qa_atsci_trellis_encoder.h \ qa_atsci_viterbi_decoder.h \ qa_convolutional_interleaver.h \ - qa_interleaver_fifo.h + qa_interleaver_fifo.h # programs we build but don't install # FIXME add test_atsc noinst_PROGRAMS = \ - test_atsci - + test_atsci atsci_viterbi_gen$(EXEEXT): $(srcdir)/atsci_viterbi_gen.cc $(CXX_FOR_BUILD) -O2 $(srcdir)/atsci_viterbi_gen.cc -o atsci_viterbi_gen$(EXEEXT) @@ -201,75 +191,43 @@ atsci_viterbi_gen$(EXEEXT): $(srcdir)/atsci_viterbi_gen.cc atsci_viterbi_mux.cc: atsci_viterbi_gen$(EXEEXT) ./atsci_viterbi_gen$(EXEEXT) -o atsci_viterbi_mux.cc - test_atsci_SOURCES = test_atsci.cc test_atsci_LDADD = \ libatsc-qa.la \ libatsc.la \ - $(GNURADIO_CORE_LA) \ $(CPPUNIT_LIBS) # ------------------------------------------------------------------------ -# This is the swig-ish part of the Makefile. -# It builds the atsc module which we'll load into python +# Cleanup # ------------------------------------------------------------------------ -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -LOCAL_IFILES = \ - $(srcdir)/atsc.i +CLEANFILES = atsci_viterbi_mux.cc atsci_viterbi_gen$(EXEEXT) -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the _atsc shared library -# and knows how to call our extensions. - -swig_built_sources = \ - atsc.cc \ - atsc.py - -# This gets atsc.py installed in the right place -ourpython_PYTHON = \ - atsc.py - -ourlib_LTLIBRARIES = _atsc.la - -# These are the source files that go into the shared library -_atsc_la_SOURCES = \ - atsc.cc - -# magic flags -_atsc_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -# link the library against some comon swig runtime code and the -# c++ standard library -_atsc_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - $(PYTHON_LDFLAGS) \ - libatsc.la \ - -lstdc++ +# ------------------------------------------------------------------------ +# This is the swig-ish part of the Makefile. +# It builds the atsc module which we'll load into python +# ------------------------------------------------------------------------ -atsc.cc atsc.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module atsc \ - -o atsc.cc $(LOCAL_IFILES) +TOP_SWIG_IFILES = \ + atsc.i -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +# Install so that they end up available as: +# import gnuradio +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +atsc_pythondir_category = \ + gnuradio -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# additional libraries for linking with the SWIG-generated library +atsc_la_swig_libadd = \ + libatsc.la -# ------------------------------------------------------------------------ -# Cleanup -# ------------------------------------------------------------------------ +include $(top_srcdir)/Makefile.swig -CLEANFILES = atsci_viterbi_mux.cc atsci_viterbi_gen -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = \ + atsci_viterbi_mux.cc \ + $(swig_built_sources) +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-atsc/src/lib/Makefile.swig.gen b/gr-atsc/src/lib/Makefile.swig.gen new file mode 100644 index 00000000..e52d6533 --- /dev/null +++ b/gr-atsc/src/lib/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for atsc.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/atsc +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/atsc +## +## 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. + +atsc_pythondir_category ?= gnuradio/atsc +atsc_pylibdir_category ?= $(atsc_pythondir_category) +atsc_pythondir = $(pythondir)/$(atsc_pythondir_category) +atsc_pylibdir = $(pyexecdir)/$(atsc_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +atsc_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/atsc-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 += atsc.py atsc.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +atsc_swiginclude_HEADERS = \ + atsc.i \ + $(atsc_swiginclude_headers) + +atsc_pylib_LTLIBRARIES = \ + _atsc.la + +_atsc_la_SOURCES = \ + atsc.cc \ + $(atsc_la_swig_sources) + +_atsc_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(atsc_la_swig_libadd) + +_atsc_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(atsc_la_swig_ldflags) + +_atsc_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(atsc_la_swig_cxxflags) + +atsc_python_PYTHON = \ + atsc.py \ + $(atsc_python) + +## Entry rule for running SWIG + +atsc.h atsc.py atsc.cc: atsc.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)/atsc-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)/atsc-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)/atsc-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)/atsc-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/atsc-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)/atsc-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)/atsc-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)/atsc-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/atsc-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) $(atsc_swig_args) \ + -MD -MF $(DEPDIR)/atsc.Std \ + -module atsc -o atsc.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/atsc.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/atsc.Std \ + > $(DEPDIR)/atsc.Sd; \ + $(RM) $(DEPDIR)/atsc.Std; \ + $(MV) $(DEPDIR)/atsc.Sd $(DEPDIR)/atsc.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/atsc.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)/atsc.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/atsc.Std $(DEPDIR)/atsc.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/atsc.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)/atsc.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/atsc.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/atsc.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)/atsc-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/atsc.d@am__quote@ + diff --git a/gr-audio-alsa/src/Makefile.am b/gr-audio-alsa/src/Makefile.am index d7c787d5..8230ab56 100644 --- a/gr-audio-alsa/src/Makefile.am +++ b/gr-audio-alsa/src/Makefile.am @@ -21,85 +21,63 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.audio_alsa module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - EXTRA_DIST = run_tests.in TESTS = run_tests -LOCAL_IFILES = \ - $(srcdir)/audio_alsa.i - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) +DISTCLEANFILES = run_tests -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) +# C/C++ headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + audio_alsa_sink.h \ + audio_alsa_source.h -BUILT_SOURCES = \ - audio_alsa.cc \ - audio_alsa.py +noinst_HEADERS = \ + gri_alsa.h -ourpython_PYTHON = \ - audio_alsa.py +noinst_PYTHON = \ + qa_alsa.py AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -ourlib_LTLIBRARIES = _audio_alsa.la +################################### +# ALSA library, including OS interface, sink, and source lib_LTLIBRARIES = libgnuradio-audio-alsa.la -_audio_alsa_la_SOURCES = \ - audio_alsa.cc - libgnuradio_audio_alsa_la_SOURCES = \ audio_alsa_sink.cc \ audio_alsa_source.cc \ gri_alsa.cc -grinclude_HEADERS = \ - audio_alsa_sink.h \ - audio_alsa_source.h - -noinst_HEADERS = \ - gri_alsa.h - -swiginclude_HEADERS = \ - $(LOCAL_IFILES) - -_audio_alsa_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - $(ALSA_LIBS) \ - libgnuradio-audio-alsa.la \ - -lstdc++ - libgnuradio_audio_alsa_la_LIBADD = \ + $(GNURADIO_CORE_LA) \ $(ALSA_LIBS) -_audio_alsa_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version +libgnuradio_audio_alsa_la_LDFLAGS = \ + $(NO_UNDEFINED) -libgnuradio_audio_alsa_la_LDFLAGS = $(NO_UNDEFINED) +################################### +# SWIG Python interface and library -_audio_alsa_la_CXXFLAGS = @swig_CXXFLAGS@ +TOP_SWIG_IFILES = \ + audio_alsa.i -audio_alsa.cc audio_alsa.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module audio_alsa \ - -o audio_alsa.cc $(LOCAL_IFILES) +# Install so that they end up available as: +# import gnuradio.audio_alsa +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +audio_alsa_pythondir_category = \ + gnuradio -noinst_PYTHON = \ - qa_alsa.py +# additional libraries for linking with the SWIG-generated library +audio_alsa_la_swig_libadd = \ + libgnuradio-audio-alsa.la + +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-audio-alsa/src/Makefile.swig.gen b/gr-audio-alsa/src/Makefile.swig.gen new file mode 100644 index 00000000..3a84a02b --- /dev/null +++ b/gr-audio-alsa/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for audio_alsa.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/audio_alsa +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/audio_alsa +## +## 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. + +audio_alsa_pythondir_category ?= gnuradio/audio_alsa +audio_alsa_pylibdir_category ?= $(audio_alsa_pythondir_category) +audio_alsa_pythondir = $(pythondir)/$(audio_alsa_pythondir_category) +audio_alsa_pylibdir = $(pyexecdir)/$(audio_alsa_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +audio_alsa_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/audio_alsa-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 += audio_alsa.py audio_alsa.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +audio_alsa_swiginclude_HEADERS = \ + audio_alsa.i \ + $(audio_alsa_swiginclude_headers) + +audio_alsa_pylib_LTLIBRARIES = \ + _audio_alsa.la + +_audio_alsa_la_SOURCES = \ + audio_alsa.cc \ + $(audio_alsa_la_swig_sources) + +_audio_alsa_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(audio_alsa_la_swig_libadd) + +_audio_alsa_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(audio_alsa_la_swig_ldflags) + +_audio_alsa_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(audio_alsa_la_swig_cxxflags) + +audio_alsa_python_PYTHON = \ + audio_alsa.py \ + $(audio_alsa_python) + +## Entry rule for running SWIG + +audio_alsa.h audio_alsa.py audio_alsa.cc: audio_alsa.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)/audio_alsa-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)/audio_alsa-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)/audio_alsa-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)/audio_alsa-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/audio_alsa-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)/audio_alsa-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)/audio_alsa-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)/audio_alsa-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/audio_alsa-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) $(audio_alsa_swig_args) \ + -MD -MF $(DEPDIR)/audio_alsa.Std \ + -module audio_alsa -o audio_alsa.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/audio_alsa.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/audio_alsa.Std \ + > $(DEPDIR)/audio_alsa.Sd; \ + $(RM) $(DEPDIR)/audio_alsa.Std; \ + $(MV) $(DEPDIR)/audio_alsa.Sd $(DEPDIR)/audio_alsa.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/audio_alsa.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)/audio_alsa.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/audio_alsa.Std $(DEPDIR)/audio_alsa.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/audio_alsa.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)/audio_alsa.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/audio_alsa.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/audio_alsa.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)/audio_alsa-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/audio_alsa.d@am__quote@ + diff --git a/gr-audio-jack/src/Makefile.am b/gr-audio-jack/src/Makefile.am index 4ac3d1a4..bd8694a2 100644 --- a/gr-audio-jack/src/Makefile.am +++ b/gr-audio-jack/src/Makefile.am @@ -21,44 +21,13 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.audio_jack module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - EXTRA_DIST = run_tests.in TESTS = run_tests -LOCAL_IFILES = \ - $(srcdir)/audio_jack.i - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -BUILT_SOURCES = \ - audio_jack.cc \ - audio_jack.py - -ourpython_PYTHON = \ - audio_jack.py - -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) - -ourlib_LTLIBRARIES = _audio_jack.la - -_audio_jack_la_SOURCES = \ - audio_jack.cc \ - audio_jack_sink.cc \ - audio_jack_source.cc \ - gri_jack.cc +DISTCLEANFILES = run_tests +# C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ audio_jack_sink.h \ audio_jack_source.h @@ -66,30 +35,39 @@ grinclude_HEADERS = \ noinst_HEADERS = \ gri_jack.h -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +noinst_PYTHON = \ + qa_jack.py -_audio_jack_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - $(JACK_LIBS) \ - -lstdc++ +AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -_audio_jack_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version +################################### +# SWIG Python interface and library -_audio_jack_la_CXXFLAGS = @swig_CXXFLAGS@ +TOP_SWIG_IFILES = \ + audio_jack.i -audio_jack.cc audio_jack.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module audio_jack \ - -o audio_jack.cc $(LOCAL_IFILES) +# Install so that they end up available as: +# import gnuradio.audio_jack +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +audio_jack_pythondir_category = \ + gnuradio -noinst_PYTHON = \ - qa_jack.py +# additional sources for the SWIG-generated library +audio_jack_la_swig_sources = \ + audio_jack_sink.cc \ + audio_jack_source.cc \ + gri_jack.cc + +# additional libraries for linking with the SWIG-generated library +audio_jack_la_swig_libadd = \ + $(GNURADIO_CORE_LA) \ + $(JACK_LIBS) + +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-audio-jack/src/Makefile.swig.gen b/gr-audio-jack/src/Makefile.swig.gen new file mode 100644 index 00000000..9b1f158c --- /dev/null +++ b/gr-audio-jack/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for audio_jack.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/audio_jack +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/audio_jack +## +## 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. + +audio_jack_pythondir_category ?= gnuradio/audio_jack +audio_jack_pylibdir_category ?= $(audio_jack_pythondir_category) +audio_jack_pythondir = $(pythondir)/$(audio_jack_pythondir_category) +audio_jack_pylibdir = $(pyexecdir)/$(audio_jack_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +audio_jack_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/audio_jack-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 += audio_jack.py audio_jack.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +audio_jack_swiginclude_HEADERS = \ + audio_jack.i \ + $(audio_jack_swiginclude_headers) + +audio_jack_pylib_LTLIBRARIES = \ + _audio_jack.la + +_audio_jack_la_SOURCES = \ + audio_jack.cc \ + $(audio_jack_la_swig_sources) + +_audio_jack_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(audio_jack_la_swig_libadd) + +_audio_jack_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(audio_jack_la_swig_ldflags) + +_audio_jack_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(audio_jack_la_swig_cxxflags) + +audio_jack_python_PYTHON = \ + audio_jack.py \ + $(audio_jack_python) + +## Entry rule for running SWIG + +audio_jack.h audio_jack.py audio_jack.cc: audio_jack.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)/audio_jack-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)/audio_jack-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)/audio_jack-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)/audio_jack-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/audio_jack-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)/audio_jack-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)/audio_jack-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)/audio_jack-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/audio_jack-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) $(audio_jack_swig_args) \ + -MD -MF $(DEPDIR)/audio_jack.Std \ + -module audio_jack -o audio_jack.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/audio_jack.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/audio_jack.Std \ + > $(DEPDIR)/audio_jack.Sd; \ + $(RM) $(DEPDIR)/audio_jack.Std; \ + $(MV) $(DEPDIR)/audio_jack.Sd $(DEPDIR)/audio_jack.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/audio_jack.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)/audio_jack.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/audio_jack.Std $(DEPDIR)/audio_jack.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/audio_jack.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)/audio_jack.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/audio_jack.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/audio_jack.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)/audio_jack-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/audio_jack.d@am__quote@ + diff --git a/gr-audio-oss/src/Makefile.am b/gr-audio-oss/src/Makefile.am index eb038a97..f83ba68c 100644 --- a/gr-audio-oss/src/Makefile.am +++ b/gr-audio-oss/src/Makefile.am @@ -21,70 +21,48 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.audio_oss module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - EXTRA_DIST = run_tests.in -TESTS = run_tests -LOCAL_IFILES = \ - $(srcdir)/audio_oss.i - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) +TESTS = run_tests -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) +DISTCLEANFILES = run_tests -BUILT_SOURCES = \ - audio_oss.cc \ - audio_oss.py +# C/C++ headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + audio_oss_sink.h \ + audio_oss_source.h -ourpython_PYTHON = \ - audio_oss.py +noinst_PYTHON = qa_oss.py AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -ourlib_LTLIBRARIES = _audio_oss.la +################################### +# SWIG Python interface and library -_audio_oss_la_SOURCES = \ - audio_oss.cc \ - audio_oss_sink.cc \ - audio_oss_source.cc +TOP_SWIG_IFILES = \ + audio_oss.i -grinclude_HEADERS = \ - audio_oss_sink.h \ - audio_oss_source.h - -swiginclude_HEADERS = \ - $(LOCAL_IFILES) - -_audio_oss_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - $(OSS_LIBS) \ - -lstdc++ - -_audio_oss_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -_audio_oss_la_CXXFLAGS = @swig_CXXFLAGS@ +# Install so that they end up available as: +# import gnuradio.audio_oss +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +audio_oss_pythondir_category = \ + gnuradio -audio_oss.cc audio_oss.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module audio_oss \ - -o audio_oss.cc $(LOCAL_IFILES) +# additional sources for the SWIG-generated library +audio_oss_la_swig_sources = \ + audio_oss_sink.cc \ + audio_oss_source.cc -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# additional libraries for linking with the SWIG-generated library +audio_oss_la_swig_libadd = \ + $(GNURADIO_CORE_LA) \ + $(OSS_LIBS) -noinst_PYTHON = qa_oss.py +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc +# 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) diff --git a/gr-audio-oss/src/Makefile.swig.gen b/gr-audio-oss/src/Makefile.swig.gen new file mode 100644 index 00000000..6fce10c1 --- /dev/null +++ b/gr-audio-oss/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for audio_oss.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/audio_oss +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/audio_oss +## +## 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. + +audio_oss_pythondir_category ?= gnuradio/audio_oss +audio_oss_pylibdir_category ?= $(audio_oss_pythondir_category) +audio_oss_pythondir = $(pythondir)/$(audio_oss_pythondir_category) +audio_oss_pylibdir = $(pyexecdir)/$(audio_oss_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +audio_oss_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/audio_oss-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 += audio_oss.py audio_oss.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +audio_oss_swiginclude_HEADERS = \ + audio_oss.i \ + $(audio_oss_swiginclude_headers) + +audio_oss_pylib_LTLIBRARIES = \ + _audio_oss.la + +_audio_oss_la_SOURCES = \ + audio_oss.cc \ + $(audio_oss_la_swig_sources) + +_audio_oss_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(audio_oss_la_swig_libadd) + +_audio_oss_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(audio_oss_la_swig_ldflags) + +_audio_oss_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(audio_oss_la_swig_cxxflags) + +audio_oss_python_PYTHON = \ + audio_oss.py \ + $(audio_oss_python) + +## Entry rule for running SWIG + +audio_oss.h audio_oss.py audio_oss.cc: audio_oss.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)/audio_oss-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)/audio_oss-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)/audio_oss-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)/audio_oss-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/audio_oss-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)/audio_oss-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)/audio_oss-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)/audio_oss-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/audio_oss-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) $(audio_oss_swig_args) \ + -MD -MF $(DEPDIR)/audio_oss.Std \ + -module audio_oss -o audio_oss.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/audio_oss.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/audio_oss.Std \ + > $(DEPDIR)/audio_oss.Sd; \ + $(RM) $(DEPDIR)/audio_oss.Std; \ + $(MV) $(DEPDIR)/audio_oss.Sd $(DEPDIR)/audio_oss.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/audio_oss.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)/audio_oss.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/audio_oss.Std $(DEPDIR)/audio_oss.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/audio_oss.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)/audio_oss.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/audio_oss.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/audio_oss.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)/audio_oss-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/audio_oss.d@am__quote@ + diff --git a/gr-audio-osx/src/Makefile.am b/gr-audio-osx/src/Makefile.am index e70c9a41..a4e69096 100644 --- a/gr-audio-osx/src/Makefile.am +++ b/gr-audio-osx/src/Makefile.am @@ -21,74 +21,60 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.audio_osx module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - EXTRA_DIST = run_tests.in -TESTS = run_tests -LOCAL_IFILES = \ - $(srcdir)/audio_osx.i - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -BUILT_SOURCES = \ - audio_osx.cc \ - audio_osx.py +TESTS = run_tests -ourpython_PYTHON = \ - audio_osx.py +DISTCLEANFILES = run_tests AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -ourlib_LTLIBRARIES = _audio_osx.la - -_audio_osx_la_SOURCES = \ - audio_osx.cc \ - audio_osx_sink.cc \ - audio_osx_source.cc +# C/C++ headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + audio_osx_sink.h \ + audio_osx_source.h noinst_HEADERS = \ audio_osx.h \ circular_buffer.h \ mld_threads.h -grinclude_HEADERS = \ - audio_osx_sink.h \ - audio_osx_source.h +noinst_PYTHON = \ + qa_osx.py \ + test_audio_loop.py -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +################################### +# SWIG Python interface and library -_audio_osx_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - -lstdc++ +TOP_SWIG_IFILES = \ + audio_osx.i -_audio_osx_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version -framework AudioUnit -framework CoreAudio -framework AudioToolbox +# Install so that they end up available as: +# import gnuradio.audio_osx +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +audio_osx_pythondir_category = \ + gnuradio -_audio_osx_la_CXXFLAGS = @swig_CXXFLAGS@ +# additional sources for the SWIG-generated library +audio_osx_la_swig_sources = \ + audio_osx_sink.cc \ + audio_osx_source.cc -audio_osx.cc audio_osx.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module audio_osx \ - -o audio_osx.cc $(LOCAL_IFILES) +# additional libraries for linking with the SWIG-generated library +audio_osx_la_swig_libadd = \ + $(GNURADIO_CORE_LA) -noinst_PYTHON = qa_osx.py test_audio_loop.py +# additional LD flags for linking the SWIG-generated library +audio_osx_la_swig_ldflags = \ + -framework AudioUnit \ + -framework CoreAudio \ + -framework AudioToolbox -MOSTLYCLEANFILES = $(BUILT_SOURCES) *~ *.pyc run_tests *.loT +include $(top_srcdir)/Makefile.swig -CONFIG_CLEAN_FILES = run_tests *.loT +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-audio-osx/src/Makefile.swig.gen b/gr-audio-osx/src/Makefile.swig.gen new file mode 100644 index 00000000..b4fd7135 --- /dev/null +++ b/gr-audio-osx/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for audio_osx.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/audio_osx +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/audio_osx +## +## 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. + +audio_osx_pythondir_category ?= gnuradio/audio_osx +audio_osx_pylibdir_category ?= $(audio_osx_pythondir_category) +audio_osx_pythondir = $(pythondir)/$(audio_osx_pythondir_category) +audio_osx_pylibdir = $(pyexecdir)/$(audio_osx_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +audio_osx_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/audio_osx-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 += audio_osx.py audio_osx.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +audio_osx_swiginclude_HEADERS = \ + audio_osx.i \ + $(audio_osx_swiginclude_headers) + +audio_osx_pylib_LTLIBRARIES = \ + _audio_osx.la + +_audio_osx_la_SOURCES = \ + audio_osx.cc \ + $(audio_osx_la_swig_sources) + +_audio_osx_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(audio_osx_la_swig_libadd) + +_audio_osx_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(audio_osx_la_swig_ldflags) + +_audio_osx_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(audio_osx_la_swig_cxxflags) + +audio_osx_python_PYTHON = \ + audio_osx.py \ + $(audio_osx_python) + +## Entry rule for running SWIG + +audio_osx.h audio_osx.py audio_osx.cc: audio_osx.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)/audio_osx-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)/audio_osx-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)/audio_osx-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)/audio_osx-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/audio_osx-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)/audio_osx-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)/audio_osx-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)/audio_osx-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/audio_osx-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) $(audio_osx_swig_args) \ + -MD -MF $(DEPDIR)/audio_osx.Std \ + -module audio_osx -o audio_osx.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/audio_osx.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/audio_osx.Std \ + > $(DEPDIR)/audio_osx.Sd; \ + $(RM) $(DEPDIR)/audio_osx.Std; \ + $(MV) $(DEPDIR)/audio_osx.Sd $(DEPDIR)/audio_osx.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/audio_osx.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)/audio_osx.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/audio_osx.Std $(DEPDIR)/audio_osx.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/audio_osx.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)/audio_osx.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/audio_osx.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/audio_osx.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)/audio_osx-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/audio_osx.d@am__quote@ + diff --git a/gr-audio-portaudio/src/Makefile.am b/gr-audio-portaudio/src/Makefile.am index 314ed72a..4b44807d 100644 --- a/gr-audio-portaudio/src/Makefile.am +++ b/gr-audio-portaudio/src/Makefile.am @@ -21,45 +21,16 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.audio_portaudio module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - EXTRA_DIST = run_tests.in TESTS = run_tests -LOCAL_IFILES = \ - $(srcdir)/audio_portaudio.i - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -BUILT_SOURCES = \ - audio_portaudio.cc \ - audio_portaudio.py - -ourpython_PYTHON = \ - audio_portaudio.py +DISTCLEANFILES = run_tests AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ $(PORTAUDIO_CFLAGS) $(WITH_INCLUDES) -ourlib_LTLIBRARIES = _audio_portaudio.la - -_audio_portaudio_la_SOURCES = \ - audio_portaudio.cc \ - audio_portaudio_sink.cc \ - audio_portaudio_source.cc \ - gri_portaudio.cc - +# C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ audio_portaudio_sink.h \ audio_portaudio_source.h @@ -67,30 +38,37 @@ grinclude_HEADERS = \ noinst_HEADERS = \ gri_portaudio.h -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +noinst_PYTHON = \ + qa_portaudio.py -_audio_portaudio_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - $(PORTAUDIO_LIBS) \ - -lstdc++ +################################### +# SWIG Python interface and library -_audio_portaudio_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version +TOP_SWIG_IFILES = \ + audio_portaudio.i + +# Install so that they end up available as: +# import gnuradio.audio_portaudio +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +audio_portaudio_pythondir_category = \ + gnuradio -_audio_portaudio_la_CXXFLAGS = @swig_CXXFLAGS@ +# additional sources for the SWIG-generated library +audio_portaudio_la_swig_sources = \ + audio_portaudio_sink.cc \ + audio_portaudio_source.cc \ + gri_portaudio.cc -audio_portaudio.cc audio_portaudio.py: $(ALL_IFILES) audio_portaudio_sink.h audio_portaudio_source.h - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module audio_portaudio \ - -o audio_portaudio.cc $(LOCAL_IFILES) +# additional libraries for linking with the SWIG-generated library +audio_portaudio_la_swig_libadd = \ + $(GNURADIO_CORE_LA) \ + $(PORTAUDIO_LIBS) -noinst_PYTHON = \ - qa_portaudio.py +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-audio-portaudio/src/Makefile.swig.gen b/gr-audio-portaudio/src/Makefile.swig.gen new file mode 100644 index 00000000..368f2e32 --- /dev/null +++ b/gr-audio-portaudio/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for audio_portaudio.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/audio_portaudio +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/audio_portaudio +## +## 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. + +audio_portaudio_pythondir_category ?= gnuradio/audio_portaudio +audio_portaudio_pylibdir_category ?= $(audio_portaudio_pythondir_category) +audio_portaudio_pythondir = $(pythondir)/$(audio_portaudio_pythondir_category) +audio_portaudio_pylibdir = $(pyexecdir)/$(audio_portaudio_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +audio_portaudio_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/audio_portaudio-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 += audio_portaudio.py audio_portaudio.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +audio_portaudio_swiginclude_HEADERS = \ + audio_portaudio.i \ + $(audio_portaudio_swiginclude_headers) + +audio_portaudio_pylib_LTLIBRARIES = \ + _audio_portaudio.la + +_audio_portaudio_la_SOURCES = \ + audio_portaudio.cc \ + $(audio_portaudio_la_swig_sources) + +_audio_portaudio_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(audio_portaudio_la_swig_libadd) + +_audio_portaudio_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(audio_portaudio_la_swig_ldflags) + +_audio_portaudio_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(audio_portaudio_la_swig_cxxflags) + +audio_portaudio_python_PYTHON = \ + audio_portaudio.py \ + $(audio_portaudio_python) + +## Entry rule for running SWIG + +audio_portaudio.h audio_portaudio.py audio_portaudio.cc: audio_portaudio.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)/audio_portaudio-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)/audio_portaudio-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)/audio_portaudio-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)/audio_portaudio-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/audio_portaudio-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)/audio_portaudio-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)/audio_portaudio-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)/audio_portaudio-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/audio_portaudio-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) $(audio_portaudio_swig_args) \ + -MD -MF $(DEPDIR)/audio_portaudio.Std \ + -module audio_portaudio -o audio_portaudio.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/audio_portaudio.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/audio_portaudio.Std \ + > $(DEPDIR)/audio_portaudio.Sd; \ + $(RM) $(DEPDIR)/audio_portaudio.Std; \ + $(MV) $(DEPDIR)/audio_portaudio.Sd $(DEPDIR)/audio_portaudio.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/audio_portaudio.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)/audio_portaudio.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/audio_portaudio.Std $(DEPDIR)/audio_portaudio.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/audio_portaudio.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)/audio_portaudio.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/audio_portaudio.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/audio_portaudio.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)/audio_portaudio-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/audio_portaudio.d@am__quote@ + diff --git a/gr-audio-windows/src/Makefile.am b/gr-audio-windows/src/Makefile.am index 8618dd54..1a8ededa 100644 --- a/gr-audio-windows/src/Makefile.am +++ b/gr-audio-windows/src/Makefile.am @@ -21,71 +21,52 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.audio_windows module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - EXTRA_DIST = run_tests.in -TESTS = run_tests - -LOCAL_IFILES = \ - $(srcdir)/audio_windows.i -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) +TESTS = run_tests -BUILT_SOURCES = \ - audio_windows.cc \ - audio_windows.py +DISTCLEANFILES = run_tests -ourpython_PYTHON = \ - audio_windows.py +noinst_PYTHON = qa_audio_windows.py AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -ourlib_LTLIBRARIES = _audio_windows.la - -_audio_windows_la_SOURCES = \ - audio_windows.cc \ - audio_windows_sink.cc \ - audio_windows_source.cc - - +# C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ audio_windows_sink.h \ - audio_windows_source.h + audio_windows_source.h -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +################################### +# SWIG Python interface and library -_audio_windows_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - $(WINAUDIO_LIBS) \ - -lstdc++ +TOP_SWIG_IFILES = \ + audio_windows.i -_audio_windows_la_LDFLAGS = -no-undefined -module -avoid-version \ - $(LIBGNURADIO_CORE_EXTRA_LDFLAGS) +# Install so that they end up available as: +# import gnuradio.audio_windows +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +audio_windows_pythondir_category = \ + gnuradio -_audio_windows_la_CXXFLAGS = @swig_CXXFLAGS@ +# additional sources for the SWIG-generated library +audio_windows_la_swig_sources = \ + audio_windows_sink.cc \ + audio_windows_source.cc + +# additional libraries for linking with the SWIG-generated library +audio_windows_la_swig_libadd = \ + $(GNURADIO_CORE_LA) \ + $(WINAUDIO_LIBS) -audio_windows.cc audio_windows.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module audio_windows \ - -o audio_windows.cc $(LOCAL_IFILES) +# additional LD flags for linking the SWIG-generated library +audio_windows_la_swig_ldflags = \ + $(LIBGNURADIO_CORE_EXTRA_LDFLAGS) -noinst_PYTHON = qa_audio_windows.py +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-audio-windows/src/Makefile.swig.gen b/gr-audio-windows/src/Makefile.swig.gen new file mode 100644 index 00000000..61215b89 --- /dev/null +++ b/gr-audio-windows/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for audio_windows.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/audio_windows +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/audio_windows +## +## 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. + +audio_windows_pythondir_category ?= gnuradio/audio_windows +audio_windows_pylibdir_category ?= $(audio_windows_pythondir_category) +audio_windows_pythondir = $(pythondir)/$(audio_windows_pythondir_category) +audio_windows_pylibdir = $(pyexecdir)/$(audio_windows_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +audio_windows_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/audio_windows-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 += audio_windows.py audio_windows.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +audio_windows_swiginclude_HEADERS = \ + audio_windows.i \ + $(audio_windows_swiginclude_headers) + +audio_windows_pylib_LTLIBRARIES = \ + _audio_windows.la + +_audio_windows_la_SOURCES = \ + audio_windows.cc \ + $(audio_windows_la_swig_sources) + +_audio_windows_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(audio_windows_la_swig_libadd) + +_audio_windows_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(audio_windows_la_swig_ldflags) + +_audio_windows_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(audio_windows_la_swig_cxxflags) + +audio_windows_python_PYTHON = \ + audio_windows.py \ + $(audio_windows_python) + +## Entry rule for running SWIG + +audio_windows.h audio_windows.py audio_windows.cc: audio_windows.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)/audio_windows-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)/audio_windows-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)/audio_windows-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)/audio_windows-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/audio_windows-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)/audio_windows-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)/audio_windows-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)/audio_windows-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/audio_windows-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) $(audio_windows_swig_args) \ + -MD -MF $(DEPDIR)/audio_windows.Std \ + -module audio_windows -o audio_windows.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/audio_windows.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/audio_windows.Std \ + > $(DEPDIR)/audio_windows.Sd; \ + $(RM) $(DEPDIR)/audio_windows.Std; \ + $(MV) $(DEPDIR)/audio_windows.Sd $(DEPDIR)/audio_windows.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/audio_windows.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)/audio_windows.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/audio_windows.Std $(DEPDIR)/audio_windows.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/audio_windows.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)/audio_windows.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/audio_windows.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/audio_windows.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)/audio_windows-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/audio_windows.d@am__quote@ + diff --git a/gr-comedi/src/Makefile.am b/gr-comedi/src/Makefile.am index c276629e..bd26e695 100644 --- a/gr-comedi/src/Makefile.am +++ b/gr-comedi/src/Makefile.am @@ -21,77 +21,53 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.comedi module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - EXTRA_DIST = run_tests.in TESTS = run_tests -LOCAL_IFILES = \ - $(srcdir)/comedi.i - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -BUILT_SOURCES = \ - comedi.cc \ - comedi.py - -ourpython_PYTHON = \ - comedi.py +DISTCLEANFILES = run_tests AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -ourlib_LTLIBRARIES = _comedi.la - -_comedi_la_SOURCES = \ - comedi.cc \ - comedi_sink_s.cc \ - comedi_source_s.cc \ - gri_comedi.cc - +# C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ comedi_sink_s.h \ - comedi_source_s.h + comedi_source_s.h -noinst_HEADERS = \ - gri_comedi.h +noinst_HEADERS = \ + gri_comedi.h +noinst_PYTHON = \ + qa_comedi.py -swiginclude_HEADERS = \ - $(LOCAL_IFILES) - -_comedi_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - $(COMEDI_LIBS) \ - -lstdc++ +################################### +# SWIG Python interface and library -_comedi_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version +TOP_SWIG_IFILES = \ + comedi.i -_comedi_la_CXXFLAGS = @swig_CXXFLAGS@ +# Install so that they end up available as: +# import gnuradio.comedi +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +comedi_pythondir_category = \ + gnuradio -comedi.cc comedi.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module comedi \ - -o comedi.cc $(LOCAL_IFILES) +# additional sources for the SWIG-generated library +comedi_la_swig_sources = \ + comedi_sink_s.cc \ + comedi_source_s.cc \ + gri_comedi.cc -noinst_PYTHON = \ - qa_comedi.py +# additional libraries for linking with the SWIG-generated library +comedi_la_swig_libadd = \ + $(GNURADIO_CORE_LA) \ + $(COMEDI_LIBS) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc +# 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) diff --git a/gr-comedi/src/Makefile.swig.gen b/gr-comedi/src/Makefile.swig.gen new file mode 100644 index 00000000..dd2c235c --- /dev/null +++ b/gr-comedi/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for comedi.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/comedi +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/comedi +## +## 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. + +comedi_pythondir_category ?= gnuradio/comedi +comedi_pylibdir_category ?= $(comedi_pythondir_category) +comedi_pythondir = $(pythondir)/$(comedi_pythondir_category) +comedi_pylibdir = $(pyexecdir)/$(comedi_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +comedi_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/comedi-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 += comedi.py comedi.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +comedi_swiginclude_HEADERS = \ + comedi.i \ + $(comedi_swiginclude_headers) + +comedi_pylib_LTLIBRARIES = \ + _comedi.la + +_comedi_la_SOURCES = \ + comedi.cc \ + $(comedi_la_swig_sources) + +_comedi_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(comedi_la_swig_libadd) + +_comedi_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(comedi_la_swig_ldflags) + +_comedi_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(comedi_la_swig_cxxflags) + +comedi_python_PYTHON = \ + comedi.py \ + $(comedi_python) + +## Entry rule for running SWIG + +comedi.h comedi.py comedi.cc: comedi.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)/comedi-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)/comedi-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)/comedi-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)/comedi-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/comedi-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)/comedi-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)/comedi-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)/comedi-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/comedi-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) $(comedi_swig_args) \ + -MD -MF $(DEPDIR)/comedi.Std \ + -module comedi -o comedi.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/comedi.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/comedi.Std \ + > $(DEPDIR)/comedi.Sd; \ + $(RM) $(DEPDIR)/comedi.Std; \ + $(MV) $(DEPDIR)/comedi.Sd $(DEPDIR)/comedi.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/comedi.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)/comedi.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/comedi.Std $(DEPDIR)/comedi.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/comedi.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)/comedi.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/comedi.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/comedi.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)/comedi-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/comedi.d@am__quote@ + diff --git a/gr-cvsd-vocoder/src/lib/Makefile.am b/gr-cvsd-vocoder/src/lib/Makefile.am index 2306bc3b..78a7c640 100644 --- a/gr-cvsd-vocoder/src/lib/Makefile.am +++ b/gr-cvsd-vocoder/src/lib/Makefile.am @@ -21,75 +21,39 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.vocoder module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/vocoder - -ourpythondir = $(grpythondir)/vocoder -ourlibdir = $(grpyexecdir)/vocoder - AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -LOCAL_IFILES = \ - $(srcdir)/cvsd_vocoder.i - -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the _howto shared library -# and knows how to call our extensions. +# These headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + cvsd_decode_bs.h \ + cvsd_encode_sb.h -BUILT_SOURCES = \ - cvsd_vocoder.cc \ - cvsd_vocoder.py +################################### +# SWIG Python interface and library -# This gets cvsd_vocoder.py installed in the right place -ourpython_PYTHON = \ - cvsd_vocoder.py +TOP_SWIG_IFILES = \ + cvsd_vocoder.i -ourlib_LTLIBRARIES = _cvsd_vocoder.la +# Install so that they end up available as: +# import gnuradio.vocoder.cvsd_vocoder +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/vocoder +cvsd_vocoder_pythondir_category = \ + gnuradio/vocoder -# These are the source files that go into the shared library -_cvsd_vocoder_la_SOURCES = \ +# additional sources for the SWIG-generated library +cvsd_vocoder_la_swig_sources = \ cvsd_decode_bs.cc \ - cvsd_encode_sb.cc \ - cvsd_vocoder.cc - - -# magic flags -_cvsd_vocoder_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -# link the library against the c++ standard library -_cvsd_vocoder_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - -lstdc++ - -_cvsd_vocoder_la_CXXFLAGS = @swig_CXXFLAGS@ - -cvsd_vocoder.cc cvsd_vocoder.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module cvsd_vocoder \ - -o cvsd_vocoder.cc $(LOCAL_IFILES) - -# These headers get installed in ${prefix}/include/gnuradio -grinclude_HEADERS = \ - cvsd_decode_bs.h \ - cvsd_encode_sb.h - -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) + cvsd_encode_sb.cc +# additional libraries for linking with the SWIG-generated library +cvsd_vocoder_la_swig_libadd = \ + $(GNURADIO_CORE_LA) -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc +include $(top_srcdir)/Makefile.swig -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# 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) diff --git a/gr-cvsd-vocoder/src/lib/Makefile.swig.gen b/gr-cvsd-vocoder/src/lib/Makefile.swig.gen new file mode 100644 index 00000000..e192abc7 --- /dev/null +++ b/gr-cvsd-vocoder/src/lib/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for cvsd_vocoder.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/cvsd_vocoder +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/cvsd_vocoder +## +## 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. + +cvsd_vocoder_pythondir_category ?= gnuradio/cvsd_vocoder +cvsd_vocoder_pylibdir_category ?= $(cvsd_vocoder_pythondir_category) +cvsd_vocoder_pythondir = $(pythondir)/$(cvsd_vocoder_pythondir_category) +cvsd_vocoder_pylibdir = $(pyexecdir)/$(cvsd_vocoder_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +cvsd_vocoder_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/cvsd_vocoder-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 += cvsd_vocoder.py cvsd_vocoder.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +cvsd_vocoder_swiginclude_HEADERS = \ + cvsd_vocoder.i \ + $(cvsd_vocoder_swiginclude_headers) + +cvsd_vocoder_pylib_LTLIBRARIES = \ + _cvsd_vocoder.la + +_cvsd_vocoder_la_SOURCES = \ + cvsd_vocoder.cc \ + $(cvsd_vocoder_la_swig_sources) + +_cvsd_vocoder_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(cvsd_vocoder_la_swig_libadd) + +_cvsd_vocoder_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(cvsd_vocoder_la_swig_ldflags) + +_cvsd_vocoder_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(cvsd_vocoder_la_swig_cxxflags) + +cvsd_vocoder_python_PYTHON = \ + cvsd_vocoder.py \ + $(cvsd_vocoder_python) + +## Entry rule for running SWIG + +cvsd_vocoder.h cvsd_vocoder.py cvsd_vocoder.cc: cvsd_vocoder.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)/cvsd_vocoder-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)/cvsd_vocoder-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)/cvsd_vocoder-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)/cvsd_vocoder-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/cvsd_vocoder-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)/cvsd_vocoder-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)/cvsd_vocoder-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)/cvsd_vocoder-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/cvsd_vocoder-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) $(cvsd_vocoder_swig_args) \ + -MD -MF $(DEPDIR)/cvsd_vocoder.Std \ + -module cvsd_vocoder -o cvsd_vocoder.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/cvsd_vocoder.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/cvsd_vocoder.Std \ + > $(DEPDIR)/cvsd_vocoder.Sd; \ + $(RM) $(DEPDIR)/cvsd_vocoder.Std; \ + $(MV) $(DEPDIR)/cvsd_vocoder.Sd $(DEPDIR)/cvsd_vocoder.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/cvsd_vocoder.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)/cvsd_vocoder.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/cvsd_vocoder.Std $(DEPDIR)/cvsd_vocoder.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/cvsd_vocoder.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)/cvsd_vocoder.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/cvsd_vocoder.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/cvsd_vocoder.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)/cvsd_vocoder-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/cvsd_vocoder.d@am__quote@ + diff --git a/gr-cvsd-vocoder/src/python/Makefile.am b/gr-cvsd-vocoder/src/python/Makefile.am index e22ad323..801dc8fb 100644 --- a/gr-cvsd-vocoder/src/python/Makefile.am +++ b/gr-cvsd-vocoder/src/python/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -36,5 +36,3 @@ grblkspython_PYTHON = \ noinst_PYTHON = \ encdec.py \ qa_cvsd_vocoder.py - -CLEANFILES = *.pyc *.pyo diff --git a/gr-gcell/src/Makefile.am b/gr-gcell/src/Makefile.am index 4ed607c5..83dc30f4 100644 --- a/gr-gcell/src/Makefile.am +++ b/gr-gcell/src/Makefile.am @@ -23,20 +23,20 @@ include $(top_srcdir)/Makefile.common SUBDIRS = . examples EXTRA_DIST = run_tests.in -TESTS = run_tests - - -# Install the python portion so that it ends up as the gnuradio.gcell module -# ${prefix}/lib/python${python_version}/site-packages/gnuradio -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) +TESTS = run_tests AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(GCELL_INCLUDES) \ $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -# Special swig arguments -LOCAL_SWIG_DEFINES_AND_INCLUDES = $(GCELL_INCLUDES) +# ---------------------------------------------------------------- + +noinst_PYTHON = \ + qa_fft.py + +DISTCLEANFILES = \ + gcell.d \ + run_tests # ---------------------------------------------------------------- # The C++ blocks @@ -48,6 +48,7 @@ lib_LTLIBRARIES = libgr_gcell.la libgr_gcell_la_SOURCES = \ gcell_fft_vcc.cc +# C/C++ headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ gcell_fft_vcc.h @@ -57,80 +58,37 @@ libgr_gcell_la_LIBADD = \ libgr_gcell_la_LDFLAGS = $(NO_UNDEFINED) - # ---------------------------------------------------------------- # SWIG stuff # ---------------------------------------------------------------- -# the library for the swig interface -ourlib_LTLIBRARIES = _gcell.la - -LOCAL_IFILES = \ - $(srcdir)/gc_job_manager.i \ - $(srcdir)/gcell.i \ - $(srcdir)/gcell_fft_vcc.i - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) +TOP_SWIG_IFILES = \ + gcell.i -swig_built_sources = \ - gcell.cc \ - gcell.py - -ourpython_PYTHON = \ - gcell.py - -_gcell_la_SOURCES = \ - gcell.cc - -_gcell_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - libgr_gcell.la \ - -lstdc++ - -_gcell_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -_gcell_la_CXXFLAGS = @swig_CXXFLAGS@ - -swiginclude_HEADERS = \ - $(LOCAL_IFILES) - -#gcell.cc gcell.py: $(ALL_IFILES) -# $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module gcell \ -# -o gcell.cc $(LOCAL_IFILES) - -# KLUDGE: Force runtime include of gcell.d 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. -@am__include@ @am__quote@./gcell.d@am__quote@ +# Install so that they end up available as: +# import gnuradio.gcell +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +gcell_pythondir_category = \ + gnuradio -gcell.py gcell.h: gcell.cc +# additional arguments to the SWIG command +gcell_swig_args = \ + $(GCELL_INCLUDES) -gcell.cc : $(srcdir)/gcell.i $(GNURADIO_I) - if $(SWIG) $(STD_SWIG_PYTHON_ARGS) -MMD -MF gcell.Td -module gcell \ - -o gcell.cc $(srcdir)/gcell.i ;\ - then if test $(host_os) = mingw32; \ - then sed 's,\\\\,/,g' gcell.d; rm -f gcell.Td; \ - else mv -f gcell.Td gcell.d; fi \ - else rm -f gcell.Td; exit 1; fi +# additional libraries for linking with the SWIG-generated library +gcell_la_swig_libadd = \ + libgr_gcell.la +# additional SWIG files to be installed +gcell_swiginclude_headers = \ + gc_job_manager.i \ + gcell_fft_vcc.i -noinst_PYTHON = \ - qa_fft.py +include $(top_srcdir)/Makefile.swig -# ---------------------------------------------------------------- +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -MOSTLYCLEANFILES = \ - $(swig_built_sources) *~ *.pyc - -# Don't distribute output of swig -dist-hook: - @for file in $(swig_built_sources); do echo $(RM) $(distdir)/$$file; done - @for file in $(swig_built_sources); do $(RM) $(distdir)/$$file; done - -DISTCLEANFILES = \ - gcell.d +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-gcell/src/Makefile.swig.gen b/gr-gcell/src/Makefile.swig.gen new file mode 100644 index 00000000..75353c34 --- /dev/null +++ b/gr-gcell/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for gcell.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/gcell +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gcell +## +## 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. + +gcell_pythondir_category ?= gnuradio/gcell +gcell_pylibdir_category ?= $(gcell_pythondir_category) +gcell_pythondir = $(pythondir)/$(gcell_pythondir_category) +gcell_pylibdir = $(pyexecdir)/$(gcell_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +gcell_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/gcell-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 += gcell.py gcell.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +gcell_swiginclude_HEADERS = \ + gcell.i \ + $(gcell_swiginclude_headers) + +gcell_pylib_LTLIBRARIES = \ + _gcell.la + +_gcell_la_SOURCES = \ + gcell.cc \ + $(gcell_la_swig_sources) + +_gcell_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gcell_la_swig_libadd) + +_gcell_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gcell_la_swig_ldflags) + +_gcell_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(gcell_la_swig_cxxflags) + +gcell_python_PYTHON = \ + gcell.py \ + $(gcell_python) + +## Entry rule for running SWIG + +gcell.h gcell.py gcell.cc: gcell.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)/gcell-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)/gcell-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)/gcell-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)/gcell-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gcell-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)/gcell-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)/gcell-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)/gcell-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/gcell-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) $(gcell_swig_args) \ + -MD -MF $(DEPDIR)/gcell.Std \ + -module gcell -o gcell.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gcell.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gcell.Std \ + > $(DEPDIR)/gcell.Sd; \ + $(RM) $(DEPDIR)/gcell.Std; \ + $(MV) $(DEPDIR)/gcell.Sd $(DEPDIR)/gcell.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gcell.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)/gcell.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/gcell.Std $(DEPDIR)/gcell.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/gcell.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)/gcell.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gcell.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/gcell.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)/gcell-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/gcell.d@am__quote@ + diff --git a/gr-gcell/src/examples/Makefile.am b/gr-gcell/src/examples/Makefile.am index dc5aa307..bdea961e 100644 --- a/gr-gcell/src/examples/Makefile.am +++ b/gr-gcell/src/examples/Makefile.am @@ -26,5 +26,3 @@ include $(top_srcdir)/Makefile.common #dist_ourdata_DATA = README #dist_ourdata_SCRIPTS = fsm_utils.py - -MOSTLYCLEANFILES = *.pyc diff --git a/gr-gpio/src/fpga/top/Makefile.am b/gr-gpio/src/fpga/top/Makefile.am index 8cf8f40b..c4b4e1fd 100644 --- a/gr-gpio/src/fpga/top/Makefile.am +++ b/gr-gpio/src/fpga/top/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -30,7 +30,7 @@ EXTRA_DIST = \ usrp_gpio.qsf \ usrp_gpio.v -MOSTLYCLEANFILES = \ +MOSTLYCLEANFILES += \ db/* \ *.rpt \ *.summary \ @@ -38,5 +38,4 @@ MOSTLYCLEANFILES = \ *.smsg \ *.done \ *.pin \ - *.sof \ - *~ + *.sof diff --git a/gr-gpio/src/python/Makefile.am b/gr-gpio/src/python/Makefile.am index ee5bdaad..427047cd 100644 --- a/gr-gpio/src/python/Makefile.am +++ b/gr-gpio/src/python/Makefile.am @@ -35,5 +35,3 @@ dist_bin_SCRIPTS = \ gpio_rx_sfile.py \ gpio_usrp_siggen.py \ gpio_usrp_fft.py - -MOSTLYCLEANFILES = *.pyo *.pyc *~ diff --git a/gr-gsm-fr-vocoder/src/lib/Makefile.am b/gr-gsm-fr-vocoder/src/lib/Makefile.am index 82646adb..0cf0fb07 100644 --- a/gr-gsm-fr-vocoder/src/lib/Makefile.am +++ b/gr-gsm-fr-vocoder/src/lib/Makefile.am @@ -23,75 +23,39 @@ include $(top_srcdir)/Makefile.common SUBDIRS = gsm . -# Install this stuff so that it ends up as the gnuradio.vocoder module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/vocoder - -ourpythondir = $(grpythondir)/vocoder -ourlibdir = $(grpyexecdir)/vocoder - AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -LOCAL_IFILES = \ - $(srcdir)/gsm_full_rate.i - -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the _howto shared library -# and knows how to call our extensions. +# C/C++ headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + gsm_fr_decode_ps.h \ + gsm_fr_encode_sp.h -BUILT_SOURCES = \ - gsm_full_rate.cc \ - gsm_full_rate.py +# SWIG interface and library -# This gets gsm_full_rate.py installed in the right place -ourpython_PYTHON = \ - gsm_full_rate.py +TOP_SWIG_IFILES = \ + gsm_full_rate.i -ourlib_LTLIBRARIES = _gsm_full_rate.la +# Install so that they end up available as: +# import gnuradio.vocoder.gsm_full_rate +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/vocoder +gsm_full_rate_pythondir_category = \ + gnuradio/vocoder -# These are the source files that go into the shared library -_gsm_full_rate_la_SOURCES = \ +# additional sources for the SWIG-generated library +gsm_full_rate_la_swig_sources = \ gsm_fr_decode_ps.cc \ - gsm_fr_encode_sp.cc \ - gsm_full_rate.cc - - -# magic flags -_gsm_full_rate_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -# link the library against the gsm library and the -# c++ standard library -_gsm_full_rate_la_LIBADD = \ - gsm/libgsm.la \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - -lstdc++ - -gsm_full_rate.cc gsm_full_rate.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module gsm_full_rate \ - -o gsm_full_rate.cc $(LOCAL_IFILES) - -# These headers get installed in ${prefix}/include/gnuradio -grinclude_HEADERS = \ - gsm_fr_decode_ps.h \ - gsm_fr_encode_sp.h - -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) + gsm_fr_encode_sp.cc +# additional libraries for linking with the SWIG-generated library +gsm_full_rate_la_swig_libadd = \ + $(GNURADIO_CORE_LA) \ + gsm/libgsm.la -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc +include $(top_srcdir)/Makefile.swig -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# 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) diff --git a/gr-gsm-fr-vocoder/src/lib/Makefile.swig.gen b/gr-gsm-fr-vocoder/src/lib/Makefile.swig.gen new file mode 100644 index 00000000..5446f346 --- /dev/null +++ b/gr-gsm-fr-vocoder/src/lib/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for gsm_full_rate.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/gsm_full_rate +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/gsm_full_rate +## +## 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. + +gsm_full_rate_pythondir_category ?= gnuradio/gsm_full_rate +gsm_full_rate_pylibdir_category ?= $(gsm_full_rate_pythondir_category) +gsm_full_rate_pythondir = $(pythondir)/$(gsm_full_rate_pythondir_category) +gsm_full_rate_pylibdir = $(pyexecdir)/$(gsm_full_rate_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +gsm_full_rate_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/gsm_full_rate-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 += gsm_full_rate.py gsm_full_rate.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +gsm_full_rate_swiginclude_HEADERS = \ + gsm_full_rate.i \ + $(gsm_full_rate_swiginclude_headers) + +gsm_full_rate_pylib_LTLIBRARIES = \ + _gsm_full_rate.la + +_gsm_full_rate_la_SOURCES = \ + gsm_full_rate.cc \ + $(gsm_full_rate_la_swig_sources) + +_gsm_full_rate_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(gsm_full_rate_la_swig_libadd) + +_gsm_full_rate_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(gsm_full_rate_la_swig_ldflags) + +_gsm_full_rate_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(gsm_full_rate_la_swig_cxxflags) + +gsm_full_rate_python_PYTHON = \ + gsm_full_rate.py \ + $(gsm_full_rate_python) + +## Entry rule for running SWIG + +gsm_full_rate.h gsm_full_rate.py gsm_full_rate.cc: gsm_full_rate.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)/gsm_full_rate-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)/gsm_full_rate-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)/gsm_full_rate-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)/gsm_full_rate-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/gsm_full_rate-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)/gsm_full_rate-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)/gsm_full_rate-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)/gsm_full_rate-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/gsm_full_rate-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) $(gsm_full_rate_swig_args) \ + -MD -MF $(DEPDIR)/gsm_full_rate.Std \ + -module gsm_full_rate -o gsm_full_rate.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/gsm_full_rate.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/gsm_full_rate.Std \ + > $(DEPDIR)/gsm_full_rate.Sd; \ + $(RM) $(DEPDIR)/gsm_full_rate.Std; \ + $(MV) $(DEPDIR)/gsm_full_rate.Sd $(DEPDIR)/gsm_full_rate.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/gsm_full_rate.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)/gsm_full_rate.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/gsm_full_rate.Std $(DEPDIR)/gsm_full_rate.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/gsm_full_rate.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)/gsm_full_rate.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/gsm_full_rate.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/gsm_full_rate.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)/gsm_full_rate-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/gsm_full_rate.d@am__quote@ + diff --git a/gr-howto-write-a-block/Makefile.am b/gr-howto-write-a-block/Makefile.am index a230be80..56307aad 100644 --- a/gr-howto-write-a-block/Makefile.am +++ b/gr-howto-write-a-block/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004,2008 Free Software Foundation, Inc. +# Copyright 2004,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,7 +23,9 @@ ACLOCAL_AMFLAGS = -I config include $(top_srcdir)/Makefile.common -EXTRA_DIST = bootstrap configure config.h.in +EXTRA_DIST = bootstrap configure config.h.in \ + Makefile.swig Makefile.swig.gen.t + SUBDIRS = config src DIST_SUBDIRS = config src doc diff --git a/gr-howto-write-a-block/Makefile.common b/gr-howto-write-a-block/Makefile.common index 6b62f25f..4b808112 100644 --- a/gr-howto-write-a-block/Makefile.common +++ b/gr-howto-write-a-block/Makefile.common @@ -1,6 +1,6 @@ # -*- Makefile -*- # -# Copyright 2004,2006 Free Software Foundation, Inc. +# Copyright 2004,2006,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -20,8 +20,25 @@ # Boston, MA 02110-1301, USA. # +# these flags are used when compiling non-SWIG-wrapper files +# when going in to non-SWIG libraries +AM_CXXFLAGS = @autoconf_default_CXXFLAGS@ + +# these flags are used when compiling any CXX file +AM_CPPFLAGS = \ + $(STD_DEFINES_AND_INCLUDES) \ + $(PYTHON_CPPFLAGS) \ + $(CPPUNIT_INCLUDES) \ + $(GNURADIO_CORE_CPPFLAGS) + +# these are used by both SWIG and CXX +STD_DEFINES_AND_INCLUDES = \ + $(DEFINES) \ + -I$(GNURADIO_CORE_INCLUDEDIR) \ + -I$(GNURADIO_CORE_INCLUDEDIR)/swig + # includes -grincludedir = $(includedir)/gnuradio +grincludedir = $(includedir)/gnuradio # swig includes swigincludedir = $(grincludedir)/swig @@ -33,11 +50,18 @@ swigincludedir = $(grincludedir)/swig grpythondir = $(pythondir)/gnuradio grpyexecdir = $(pyexecdir)/gnuradio -# swig flags -SWIGPYTHONFLAGS = -fvirtual -python -modern -SWIGGRFLAGS = -I$(GNURADIO_CORE_INCLUDEDIR)/swig -I$(GNURADIO_CORE_INCLUDEDIR) - # Don't assume that make predefines $(RM), because BSD make does # not. We define it now in configure.ac using AM_PATH_PROG, but now # 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 + +# 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; diff --git a/gr-howto-write-a-block/Makefile.swig b/gr-howto-write-a-block/Makefile.swig new file mode 100644 index 00000000..9e14835e --- /dev/null +++ b/gr-howto-write-a-block/Makefile.swig @@ -0,0 +1,117 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +## This makefile should be included using +## include $(top_srcdir)/Makefile.swig +## in Makefile.am's which require SWIG wrapping / compilation. +## For just installing .i files, this Makefile is not required. + +## swig flags +## -w511 turns off keyword argument warning +## "-outdir $(builddir)" writes all generated output files to +## the local builddir (which should always be '.') +## In some older autotools, $(builddir) is not defined, so +## just use '.' instead. + +SWIG_PYTHON_FLAGS = \ + -fvirtual \ + -python \ + -modern \ + -keyword \ + -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) + +## standard SWIG LD flags for library creation + +STD_SWIG_LA_LD_FLAGS = \ + $(PYTHON_LDFLAGS) \ + -module \ + -avoid-version \ + $(NO_UNDEFINED) + +## standard SWIG library additions for library creation + +STD_SWIG_LA_LIB_ADD = \ + -lstdc++ + +## standard SWIG CXXFLAGS +## This allows for code to be compiled with "-O1" instead of "-g -O2" +## for some systems, avoiding some optimization issues. + +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 +## full path to the file and full filename including extension. This +## Makefile addition will be made only if either it does not exist or +## if the top-level template has been modified. + +generate-makefile-swig $(srcdir)/Makefile.swig.gen: $(top_srcdir)/Makefile.swig.gen.t +## recreate $(srcdir)/Makefile.swig.gen only if ... + @do_recreate=0; \ + if test -f $(srcdir)/Makefile.swig.gen; then \ +## the file exists and can be removed; or ... + if $(RM) $(srcdir)/Makefile.swig.gen 2>/dev/null; then \ + if touch $(srcdir)/Makefile.swig.gen 2>/dev/null; then \ + do_recreate=1; \ + fi; \ + fi; \ + else \ +## the file doesn't exist, but can be created (e.g., by touching it). + if touch $(srcdir)/Makefile.swig.gen 2>/dev/null; then \ + do_recreate=1; \ + fi; \ + fi; \ + if test "$$do_recreate" == "1"; then \ + echo "Regenerating $(srcdir)/Makefile.swig.gen"; \ + for TFILE in $(TOP_SWIG_IFILES); do \ +## retrieve just the filename, without path or extension + TNAME=`python -c "import os.path as op; (dN, fN) = op.split ('$$TFILE'); (fbN, fE) = op.splitext (fN); print fbN;"`; \ +## Replace the @-named strings in the template Makefile for SWIG. + $(SED) -e 's|@NAME@|'$$TNAME'|g;' < $(top_srcdir)/Makefile.swig.gen.t >> $(srcdir)/Makefile.swig.gen; \ + echo "" >> $(srcdir)/Makefile.swig.gen; \ + done; \ + else \ + echo "Cannot recreate $(srcdir)/Makefile.swig.gen because the directory or file is write-protected."; \ + 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 new file mode 100644 index 00000000..c15a8172 --- /dev/null +++ b/gr-howto-write-a-block/Makefile.swig.gen.t @@ -0,0 +1,258 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for @NAME@.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${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/[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_category ?= gnuradio/@NAME@ +@NAME@_pylibdir_category ?= $(@NAME@_pythondir_category) +@NAME@_pythondir = $(pythondir)/$(@NAME@_pythondir_category) +@NAME@_pylibdir = $(pyexecdir)/$(@NAME@_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +@NAME@_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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@.py @NAME@.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +@NAME@_swiginclude_HEADERS = \ + @NAME@.i \ + $(@NAME@_swiginclude_headers) + +@NAME@_pylib_LTLIBRARIES = \ + _@NAME@.la + +_@NAME@_la_SOURCES = \ + @NAME@.cc \ + $(@NAME@_la_swig_sources) + +_@NAME@_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(@NAME@_la_swig_libadd) + +_@NAME@_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(@NAME@_la_swig_ldflags) + +_@NAME@_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(@NAME@_la_swig_cxxflags) + +@NAME@_python_PYTHON = \ + @NAME@.py \ + $(@NAME@_python) + +## Entry rule for running SWIG + +@NAME@.h @NAME@.py @NAME@.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; + +$(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@ -o @NAME@.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 + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/@NAME@.d@am__quote@ diff --git a/gr-howto-write-a-block/config.guess b/gr-howto-write-a-block/config.guess index 0f0fe712..f32079ab 100644 --- 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 Free Software Foundation, -# Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2007-03-06' +timestamp='2008-01-23' # 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,8 +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 -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." @@ -330,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:*) + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) @@ -532,7 +532,7 @@ EOF echo rs6000-ibm-aix3.2 fi exit ;; - *:AIX:*:[45]) + *: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 @@ -793,12 +793,15 @@ EOF exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in - x86) + x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks @@ -833,7 +836,14 @@ EOF echo ${UNAME_MACHINE}-pc-minix exit ;; arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu @@ -954,8 +964,8 @@ EOF x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit ;; - xtensa:Linux:*:*) - echo xtensa-unknown-linux-gnu + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so @@ -1474,9 +1484,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD and - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/gr-howto-write-a-block/config.sub b/gr-howto-write-a-block/config.sub index 5defff65..6759825a 100644 --- 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 Free Software Foundation, -# Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. -timestamp='2007-01-18' +timestamp='2008-01-16' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -72,8 +72,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 -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." @@ -369,10 +369,14 @@ case $basic_machine in | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ + | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-*) ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -443,6 +447,14 @@ case $basic_machine in basic_machine=ns32k-sequent os=-dynix ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; c90) basic_machine=c90-cray os=-unicos @@ -475,8 +487,8 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16c) - basic_machine=cr16c-unknown + cr16) + basic_machine=cr16-unknown os=-elf ;; crds | unos) @@ -668,6 +680,14 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; m88k-omron*) basic_machine=m88k-omron ;; @@ -683,6 +703,10 @@ case $basic_machine in basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -809,6 +833,14 @@ case $basic_machine in basic_machine=i860-intel os=-osf ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; pbd) basic_machine=sparc-tti ;; @@ -1017,6 +1049,10 @@ case $basic_machine in basic_machine=tic6x-unknown os=-coff ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; tx39) basic_machine=mipstx39-unknown ;; diff --git a/gr-howto-write-a-block/config/gr_standalone.m4 b/gr-howto-write-a-block/config/gr_standalone.m4 index a00d502d..44d9235f 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 Free Software Foundation, Inc. +dnl Copyright 2008,2009 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -37,10 +37,41 @@ m4_define([GR_STANDALONE], AM_INIT_AUTOMAKE + dnl Remember if the user explicity set CXXFLAGS + if test -n "${CXXFLAGS}"; then + user_set_cxxflags=yes + fi + LF_CONFIGURE_CC LF_CONFIGURE_CXX GR_LIB64 dnl check for lib64 suffix after choosing compilers + dnl The three macros above are known to override CXXFLAGS if the user + dnl didn't specify them. Though I'm sure somebody thought this was + dnl a good idea, it makes it hard to use other than -g -O2 when compiling + dnl selected files. Thus we "undo" the damage here... + dnl + dnl If the user specified CXXFLAGS, we use them. Otherwise when compiling + dnl the output of swig use use -O1 if we're using g++. + dnl See Makefile.common for the rest of the magic. + if test "$user_set_cxxflags" != yes; then + autoconf_default_CXXFLAGS="$CXXFLAGS" + if test "$GXX" = yes; then + case "$host_cpu" in + powerpc*) + dnl "-O1" is broken on the PPC for some reason + dnl (at least as of g++ 4.1.1) + swig_CXXFLAGS="-g1 -O2 -Wno-strict-aliasing -Wno-parentheses" + ;; + *) + swig_CXXFLAGS="-g -O1 -Wno-strict-aliasing -Wno-parentheses" + ;; + esac + fi + fi + AC_SUBST(autoconf_default_CXXFLAGS) + AC_SUBST(swig_CXXFLAGS) + dnl add ${prefix}/lib${gr_libdir_suffix}/pkgconfig to the head of the PKG_CONFIG_PATH if test x${PKG_CONFIG_PATH} = x; then PKG_CONFIG_PATH=${prefix}/lib${gr_libdir_suffix}/pkgconfig @@ -67,13 +98,6 @@ m4_define([GR_STANDALONE], GR_NO_UNDEFINED dnl do we need the -no-undefined linker flag GR_SCRIPTING dnl Locate python, SWIG, etc - dnl Set the c++ compiler that we use for the build system when cross compiling - if test "x$CXX_FOR_BUILD" = x - then - CXX_FOR_BUILD=${CXX} - fi - AC_SUBST(CXX_FOR_BUILD) - dnl Checks for header files. AC_HEADER_STDC diff --git a/gr-howto-write-a-block/config/lf_cc.m4 b/gr-howto-write-a-block/config/lf_cc.m4 index b9d1c9c0..b75e1a4c 100644 --- a/gr-howto-write-a-block/config/lf_cc.m4 +++ b/gr-howto-write-a-block/config/lf_cc.m4 @@ -36,7 +36,6 @@ AC_DEFUN([LF_CONFIGURE_CC],[ AC_REQUIRE([AC_PROG_CPP])dnl AC_REQUIRE([AC_AIX])dnl AC_REQUIRE([AC_ISC_POSIX])dnl - AC_REQUIRE([AC_MINIX])dnl AC_REQUIRE([AC_HEADER_STDC])dnl ]) diff --git a/gr-howto-write-a-block/configure.ac b/gr-howto-write-a-block/configure.ac index c1a7c77f..da456e03 100644 --- a/gr-howto-write-a-block/configure.ac +++ b/gr-howto-write-a-block/configure.ac @@ -59,10 +59,6 @@ dnl AX_BOOST_TEST_EXEC_MONITOR dnl AX_BOOST_UNIT_TEST_FRAMEWORK dnl AX_BOOST_WSERIALIZATION - -STD_DEFINES_AND_INCLUDES="$GNURADIO_CORE_CFLAGS" -AC_SUBST(STD_DEFINES_AND_INCLUDES) - AC_CONFIG_FILES([\ Makefile \ config/Makefile \ diff --git a/gr-howto-write-a-block/src/lib/Makefile.am b/gr-howto-write-a-block/src/lib/Makefile.am index c6fe7ca4..5b6d5136 100644 --- a/gr-howto-write-a-block/src/lib/Makefile.am +++ b/gr-howto-write-a-block/src/lib/Makefile.am @@ -21,75 +21,57 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.howto module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) - -SWIG_PYTHON_ARGS = $(SWIG_PYTHON_FLAGS) $(SWIGGRFLAGS) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) +# C/C++ headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + howto_square_ff.h \ + howto_square2_ff.h -NON_LOCAL_IFILES = \ - $(GNURADIO_CORE_INCLUDEDIR)/swig/gnuradio.i +################################### +# SWIG Python interface and library +TOP_SWIG_IFILES = \ + howto.i -LOCAL_IFILES = \ - $(srcdir)/howto.i - -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the _howto shared library -# and knows how to call our extensions. - -BUILT_SOURCES = \ - howto.cc \ - howto.py - -# This gets howto.py installed in the right place -ourpython_PYTHON = \ - howto.py - -ourlib_LTLIBRARIES = _howto.la +# Install so that they end up available as: +# import gnuradio.howto +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +howto_pythondir_category = \ + gnuradio -# These are the source files that go into the shared library -_howto_la_SOURCES = \ - howto.cc \ - howto_square_ff.cc \ - howto_square2_ff.cc +# additional arguments to the SWIG command +#howto_la_swig_args = \ +# -g -# magic flags -_howto_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version +# additional sources for the SWIG-generated library +howto_la_swig_sources = \ + howto_square_ff.cc \ + howto_square2_ff.cc -# link the library against some comon swig runtime code and the -# c++ standard library -_howto_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - -lstdc++ +# additional arguments to the SWIG command +#howto_la_swig_args = \ +# $(SWIG_PYTHON_ARGS) -howto.cc howto.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module howto \ - -o howto.cc $(LOCAL_IFILES) +# additional libraries for linking with the SWIG-generated library +#howto_la_swig_libadd = \ +# libm.dylib -# These headers get installed in ${prefix}/include/gnuradio -grinclude_HEADERS = \ - howto_square_ff.h \ - howto_square2_ff.h +# additional LD flags for linking the SWIG-generated library +#howto_la_swig_ldflags = \ +# -L/opt/local/bin +# additional Python files to be installed along with the SWIG-generated one +#howto_python = \ +# __init__.py -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +# additional SWIG files to be installed +#howto_swiginclude_headers = \ +# nothing.i +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-howto-write-a-block/src/lib/Makefile.swig.gen b/gr-howto-write-a-block/src/lib/Makefile.swig.gen new file mode 100644 index 00000000..f76cc637 --- /dev/null +++ b/gr-howto-write-a-block/src/lib/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for howto.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${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/[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_category ?= gnuradio/howto +howto_pylibdir_category ?= $(howto_pythondir_category) +howto_pythondir = $(pythondir)/$(howto_pythondir_category) +howto_pylibdir = $(pyexecdir)/$(howto_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +howto_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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.py howto.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +howto_swiginclude_HEADERS = \ + howto.i \ + $(howto_swiginclude_headers) + +howto_pylib_LTLIBRARIES = \ + _howto.la + +_howto_la_SOURCES = \ + howto.cc \ + $(howto_la_swig_sources) + +_howto_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(howto_la_swig_libadd) + +_howto_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(howto_la_swig_ldflags) + +_howto_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(howto_la_swig_cxxflags) + +howto_python_PYTHON = \ + howto.py \ + $(howto_python) + +## Entry rule for running SWIG + +howto.h howto.py howto.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; + +$(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 -o howto.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 + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/howto.d@am__quote@ + diff --git a/gr-msdd6000/src/Makefile.am b/gr-msdd6000/src/Makefile.am index 2d0899ca..b2bf22ab 100644 --- a/gr-msdd6000/src/Makefile.am +++ b/gr-msdd6000/src/Makefile.am @@ -21,86 +21,41 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.howto module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - - -#EXTRA_DIST = run_tests.in - -#TESTS = run_tests - - -#INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) - AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ $(WITH_INCLUDES) -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -LOCAL_IFILES = \ - $(srcdir)/msdd.i - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - - -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the _howto shared library -# and knows how to call our extensions. +# C/C++ headers get installed in ${prefix}/include/gnuradio +grinclude_HEADERS = \ + msdd_source_simple.h \ + msdd_buffer_copy_behaviors.h \ + msdd6000.h -BUILT_SOURCES = \ - msdd.cc \ - msdd.py +################################# +# SWIG interface and library -# This gets howto.py installed in the right place -ourpython_PYTHON = \ - msdd.py +TOP_SWIG_IFILES = \ + msdd.i -ourlib_LTLIBRARIES = _msdd.la +# Install so that they end up available as: +# import gnuradio.msdd +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +msdd_pythondir_category = \ + gnuradio -# These are the source files that go into the shared library -_msdd_la_SOURCES = \ - msdd.cc \ - msdd_source_simple.cc \ +# additional sources for the SWIG-generated library +msdd_la_swig_sources = \ + msdd_source_simple.cc \ msdd6000.cc -# magic flag -_msdd_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version -#-lfftw3 -lfftw3f -lfann - -# link the library against some comon swig runtime code and the -# c++ standard library -_msdd_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - $(PYTHON_LDFLAGS) \ - -lstdc++ - - -msdd.cc msdd.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module msdd \ - -o msdd.cc $(LOCAL_IFILES) - -# These headers get installed in ${prefix}/include/gnuradio -grinclude_HEADERS = \ - msdd_source_simple.h \ - msdd_buffer_copy_behaviors.h \ - msdd6000.h - - -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +# additional libraries for linking with the SWIG-generated library +msdd_la_swig_libadd = \ + $(GNURADIO_CORE_LA) +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-msdd6000/src/Makefile.swig.gen b/gr-msdd6000/src/Makefile.swig.gen new file mode 100644 index 00000000..5c292023 --- /dev/null +++ b/gr-msdd6000/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for msdd.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/msdd +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/msdd +## +## 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. + +msdd_pythondir_category ?= gnuradio/msdd +msdd_pylibdir_category ?= $(msdd_pythondir_category) +msdd_pythondir = $(pythondir)/$(msdd_pythondir_category) +msdd_pylibdir = $(pyexecdir)/$(msdd_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +msdd_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/msdd-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 += msdd.py msdd.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +msdd_swiginclude_HEADERS = \ + msdd.i \ + $(msdd_swiginclude_headers) + +msdd_pylib_LTLIBRARIES = \ + _msdd.la + +_msdd_la_SOURCES = \ + msdd.cc \ + $(msdd_la_swig_sources) + +_msdd_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(msdd_la_swig_libadd) + +_msdd_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(msdd_la_swig_ldflags) + +_msdd_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(msdd_la_swig_cxxflags) + +msdd_python_PYTHON = \ + msdd.py \ + $(msdd_python) + +## Entry rule for running SWIG + +msdd.h msdd.py msdd.cc: msdd.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)/msdd-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)/msdd-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)/msdd-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)/msdd-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/msdd-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)/msdd-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)/msdd-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)/msdd-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/msdd-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) $(msdd_swig_args) \ + -MD -MF $(DEPDIR)/msdd.Std \ + -module msdd -o msdd.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/msdd.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/msdd.Std \ + > $(DEPDIR)/msdd.Sd; \ + $(RM) $(DEPDIR)/msdd.Std; \ + $(MV) $(DEPDIR)/msdd.Sd $(DEPDIR)/msdd.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/msdd.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)/msdd.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/msdd.Std $(DEPDIR)/msdd.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/msdd.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)/msdd.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/msdd.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/msdd.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)/msdd-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/msdd.d@am__quote@ + diff --git a/gr-pager/Makefile.am b/gr-pager/Makefile.am index e4f76c54..7297661a 100644 --- a/gr-pager/Makefile.am +++ b/gr-pager/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2006 Free Software Foundation, Inc. +# Copyright 2006,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,5 +22,3 @@ include $(top_srcdir)/Makefile.common SUBDIRS = src - -MOSTLYCLEANFILES = *~ *.tmp \ No newline at end of file diff --git a/gr-pager/src/Makefile.am b/gr-pager/src/Makefile.am index 7f6f5c12..b12f7b8f 100644 --- a/gr-pager/src/Makefile.am +++ b/gr-pager/src/Makefile.am @@ -21,103 +21,75 @@ include $(top_srcdir)/Makefile.common -EXTRA_DIST = \ - run_tests.in +EXTRA_DIST = run_tests.in -TESTS = \ - run_tests +TESTS = run_tests -dist_bin_SCRIPTS = \ - usrp_flex.py \ - usrp_flex_all.py \ - usrp_flex_band.py - -noinst_PYTHON = \ - qa_pager.py - -# Install this stuff so that it ends up as the gnuradio.pgr module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/pager - -ourpythondir = $(grpythondir)/pager -ourlibdir = $(grpyexecdir)/pager +DISTCLEANFILES = run_tests AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) \ - $(srcdir)/pager_flex_frame.i - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -LOCAL_IFILES = \ - $(srcdir)/pager.i - -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the _howto shared library -# and knows how to call our extensions. - -BUILT_SOURCES = \ - pager_swig.cc \ - pager_swig.py - -# This gets imported Python objects installed in the right place -ourpython_PYTHON = \ - __init__.py \ - pager_swig.py \ - pager_utils.py \ - flex_demod.py - -ourlib_LTLIBRARIES = _pager_swig.la - -# These are the source files that go into the shared library -_pager_swig_la_SOURCES = \ - pager_swig.cc \ - pager_flex_frame.cc \ - pager_slicer_fb.cc \ - pager_flex_sync.cc \ - pager_flex_deinterleave.cc \ - pager_flex_parse.cc \ - pageri_bch3221.cc \ - pageri_flex_modes.cc \ - pageri_util.cc - # Additional source modules here - -# magic flags -_pager_swig_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -# link the library against the c++ standard library -_pager_swig_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - -lstdc++ - -pager_swig.cc pager_swig.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module pager_swig \ - -o pager_swig.cc $(LOCAL_IFILES) +dist_bin_SCRIPTS = \ + usrp_flex.py \ + usrp_flex_all.py \ + usrp_flex_band.py + +noinst_PYTHON = \ + qa_pager.py # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ - pager_slicer_fb.h \ - pager_flex_sync.h \ - pager_flex_deinterleave.h \ - pager_flex_parse.h \ - pager_flex_frame.h \ - pageri_bch3221.h \ - pageri_flex_modes.h \ - pageri_util.h - # Additional header files here - -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) \ - pager_flex_frame.i - -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc *~ *.tmp - -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done + pager_slicer_fb.h \ + pager_flex_sync.h \ + pager_flex_deinterleave.h \ + pager_flex_parse.h \ + pager_flex_frame.h \ + pageri_bch3221.h \ + pageri_flex_modes.h \ + pageri_util.h + +############################## +# SWIG interface and library + +TOP_SWIG_IFILES = \ + pager_swig.i + +# Install so that they end up available as: +# import gnuradio.pager +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/pager +pager_swig_pythondir_category = \ + gnuradio/pager + +# additional sources for the SWIG-generated library +pager_swig_la_swig_sources = \ + pager_flex_frame.cc \ + pager_slicer_fb.cc \ + pager_flex_sync.cc \ + pager_flex_deinterleave.cc \ + pager_flex_parse.cc \ + pageri_bch3221.cc \ + pageri_flex_modes.cc \ + pageri_util.cc + +# additional libraries for linking with the SWIG-generated library +pager_swig_la_swig_libadd = \ + $(GNURADIO_CORE_LA) + +# additional Python files to be installed along with the SWIG-generated one +pager_swig_python = \ + __init__.py \ + pager_utils.py \ + flex_demod.py + +# additional SWIG files to be installed +pager_swig_swiginclude_headers = \ + pager_flex_frame.i + +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) diff --git a/gr-pager/src/Makefile.swig.gen b/gr-pager/src/Makefile.swig.gen new file mode 100644 index 00000000..5cfbc66b --- /dev/null +++ b/gr-pager/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for pager_swig.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/pager_swig +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/pager_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. + +pager_swig_pythondir_category ?= gnuradio/pager_swig +pager_swig_pylibdir_category ?= $(pager_swig_pythondir_category) +pager_swig_pythondir = $(pythondir)/$(pager_swig_pythondir_category) +pager_swig_pylibdir = $(pyexecdir)/$(pager_swig_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +pager_swig_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/pager_swig-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 += pager_swig.py pager_swig.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +pager_swig_swiginclude_HEADERS = \ + pager_swig.i \ + $(pager_swig_swiginclude_headers) + +pager_swig_pylib_LTLIBRARIES = \ + _pager_swig.la + +_pager_swig_la_SOURCES = \ + pager_swig.cc \ + $(pager_swig_la_swig_sources) + +_pager_swig_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(pager_swig_la_swig_libadd) + +_pager_swig_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(pager_swig_la_swig_ldflags) + +_pager_swig_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(pager_swig_la_swig_cxxflags) + +pager_swig_python_PYTHON = \ + pager_swig.py \ + $(pager_swig_python) + +## Entry rule for running SWIG + +pager_swig.h pager_swig.py pager_swig.cc: pager_swig.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)/pager_swig-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)/pager_swig-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)/pager_swig-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)/pager_swig-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/pager_swig-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)/pager_swig-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)/pager_swig-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)/pager_swig-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/pager_swig-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) $(pager_swig_swig_args) \ + -MD -MF $(DEPDIR)/pager_swig.Std \ + -module pager_swig -o pager_swig.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/pager_swig.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/pager_swig.Std \ + > $(DEPDIR)/pager_swig.Sd; \ + $(RM) $(DEPDIR)/pager_swig.Std; \ + $(MV) $(DEPDIR)/pager_swig.Sd $(DEPDIR)/pager_swig.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/pager_swig.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)/pager_swig.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/pager_swig.Std $(DEPDIR)/pager_swig.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/pager_swig.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)/pager_swig.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/pager_swig.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/pager_swig.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)/pager_swig-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/pager_swig.d@am__quote@ + diff --git a/gr-pager/src/pager.i b/gr-pager/src/pager_swig.i similarity index 100% rename from gr-pager/src/pager.i rename to gr-pager/src/pager_swig.i diff --git a/gr-qtgui/src/lib/Makefile.am b/gr-qtgui/src/lib/Makefile.am index 034eff05..eee58990 100644 --- a/gr-qtgui/src/lib/Makefile.am +++ b/gr-qtgui/src/lib/Makefile.am @@ -21,30 +21,9 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.qtgui module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/qtgui - -ourpythondir = $(grpythondir)/qtgui -ourlibdir = $(grpyexecdir)/qtgui - AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ $(QT_INCLUDES) -I. $(WITH_INCLUDES) -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -LOCAL_IFILES = \ - $(srcdir)/qtgui.i - -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the shared library -# and knows how to call our extensions. - # Only include these files in the build if qtgui passes configure checks # This is mostly to help make distcheck pass if BUILD_QT @@ -60,18 +39,6 @@ endif EXTRA_DIST = spectrumdisplayform.ui -BUILT_SOURCES = \ - qtgui.cc \ - qtgui.py \ - $(QMAKE_SOURCES) - -# This gets qtgui.py installed in the right place -ourpython_PYTHON = \ - qtgui.py - -# Build the library for Python module to link against -ourlib_LTLIBRARIES = _qtgui.la - # Build the normal library for C++ apps to link against lib_LTLIBRARIES = libqtgui.la @@ -91,10 +58,6 @@ libqtgui_la_SOURCES = \ qtgui_sink_c.cc \ qtgui_sink_f.cc -_qtgui_la_SOURCES = \ - $(libqtgui_la_SOURCES) \ - qtgui.cc - # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ FrequencyDisplayPlot.h \ @@ -127,34 +90,36 @@ else endif # magic flags -_qtgui_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version libqtgui_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 -# link the library against the c++ standard library -_qtgui_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ +libqtgui_la_LIBADD = \ $(GNURADIO_CORE_LA) \ -lstdc++ \ $(QT_LIBS) +############################## +# SWIG interface and library -libqtgui_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - -lstdc++ \ - $(QT_LIBS) +TOP_SWIG_IFILES = \ + qtgui.i -qtgui.cc qtgui.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module qtgui \ - -o qtgui.cc $(LOCAL_IFILES) +# Install so that they end up available as: +# import gnuradio.qtgui +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +qtgui_pythondir_category = \ + gnuradio -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +# additional libraries for linking with the SWIG-generated library +qtgui_la_swig_libadd = \ + libqtgui.la +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = \ + $(QMAKE_SOURCES) \ + $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-qtgui/src/lib/Makefile.swig.gen b/gr-qtgui/src/lib/Makefile.swig.gen new file mode 100644 index 00000000..f40f0d88 --- /dev/null +++ b/gr-qtgui/src/lib/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for qtgui.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/qtgui +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/qtgui +## +## 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. + +qtgui_pythondir_category ?= gnuradio/qtgui +qtgui_pylibdir_category ?= $(qtgui_pythondir_category) +qtgui_pythondir = $(pythondir)/$(qtgui_pythondir_category) +qtgui_pylibdir = $(pyexecdir)/$(qtgui_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +qtgui_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/qtgui-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 += qtgui.py qtgui.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +qtgui_swiginclude_HEADERS = \ + qtgui.i \ + $(qtgui_swiginclude_headers) + +qtgui_pylib_LTLIBRARIES = \ + _qtgui.la + +_qtgui_la_SOURCES = \ + qtgui.cc \ + $(qtgui_la_swig_sources) + +_qtgui_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(qtgui_la_swig_libadd) + +_qtgui_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(qtgui_la_swig_ldflags) + +_qtgui_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(qtgui_la_swig_cxxflags) + +qtgui_python_PYTHON = \ + qtgui.py \ + $(qtgui_python) + +## Entry rule for running SWIG + +qtgui.h qtgui.py qtgui.cc: qtgui.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)/qtgui-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)/qtgui-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)/qtgui-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)/qtgui-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/qtgui-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)/qtgui-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)/qtgui-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)/qtgui-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/qtgui-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) $(qtgui_swig_args) \ + -MD -MF $(DEPDIR)/qtgui.Std \ + -module qtgui -o qtgui.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/qtgui.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/qtgui.Std \ + > $(DEPDIR)/qtgui.Sd; \ + $(RM) $(DEPDIR)/qtgui.Std; \ + $(MV) $(DEPDIR)/qtgui.Sd $(DEPDIR)/qtgui.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/qtgui.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)/qtgui.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/qtgui.Std $(DEPDIR)/qtgui.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/qtgui.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)/qtgui.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/qtgui.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/qtgui.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)/qtgui-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/qtgui.d@am__quote@ + diff --git a/gr-qtgui/src/python/Makefile.am b/gr-qtgui/src/python/Makefile.am index ce862c2b..ad578734 100644 --- a/gr-qtgui/src/python/Makefile.am +++ b/gr-qtgui/src/python/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -29,5 +29,3 @@ qtguipythondir = $(grpythondir)/qtgui qtguipython_PYTHON = \ __init__.py - -CLEANFILES = *.pyc *.pyo diff --git a/gr-radar-mono/src/fpga/lib/Makefile.am b/gr-radar-mono/src/fpga/lib/Makefile.am index 2c520538..a48e4f87 100644 --- a/gr-radar-mono/src/fpga/lib/Makefile.am +++ b/gr-radar-mono/src/fpga/lib/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,4 +31,4 @@ EXTRA_DIST = \ fifo32_2k.v \ cordic_nco.v -MOSTLYCLEANFILES = *~ *.bak +MOSTLYCLEANFILES += *.bak diff --git a/gr-radar-mono/src/fpga/models/Makefile.am b/gr-radar-mono/src/fpga/models/Makefile.am index 1d51f485..ca59fe78 100644 --- a/gr-radar-mono/src/fpga/models/Makefile.am +++ b/gr-radar-mono/src/fpga/models/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,5 +23,3 @@ include $(top_srcdir)/Makefile.common EXTRA_DIST = \ fifo_1clk.v - -MOSTLYCLEANFILES = *~ diff --git a/gr-radar-mono/src/fpga/tb/Makefile.am b/gr-radar-mono/src/fpga/tb/Makefile.am index 44394db1..1bff8795 100644 --- a/gr-radar-mono/src/fpga/tb/Makefile.am +++ b/gr-radar-mono/src/fpga/tb/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -27,4 +27,4 @@ EXTRA_DIST = \ radar_tb.sh \ radar_tb_wave.sh -MOSTLYCLEANFILES = *~ *.vcd *.out* radar_tb +MOSTLYCLEANFILES += *.vcd *.out* radar_tb diff --git a/gr-radar-mono/src/fpga/top/Makefile.am b/gr-radar-mono/src/fpga/top/Makefile.am index 606aa6c4..f51f3def 100644 --- a/gr-radar-mono/src/fpga/top/Makefile.am +++ b/gr-radar-mono/src/fpga/top/Makefile.am @@ -37,7 +37,7 @@ EXTRA_DIST = \ usrp_radar_mono.qsf \ usrp_radar_mono.v -MOSTLYCLEANFILES = \ +MOSTLYCLEANFILES += \ db/* \ *.rpt \ *.summary \ @@ -45,5 +45,4 @@ MOSTLYCLEANFILES = \ *.smsg \ *.done \ *.pin \ - *.sof \ - *~ + *.sof diff --git a/gr-radar-mono/src/python/Makefile.am b/gr-radar-mono/src/python/Makefile.am index 366e8176..8a44b681 100644 --- a/gr-radar-mono/src/python/Makefile.am +++ b/gr-radar-mono/src/python/Makefile.am @@ -29,5 +29,3 @@ dist_bin_SCRIPTS = \ dist_ourpython_PYTHON = \ radar_mono.py - -MOSTLYCLEANFILES = *~ *.pyc *.pyo diff --git a/gr-radio-astronomy/src/lib/Makefile.am b/gr-radio-astronomy/src/lib/Makefile.am index bfd1928b..33a8a859 100644 --- a/gr-radio-astronomy/src/lib/Makefile.am +++ b/gr-radio-astronomy/src/lib/Makefile.am @@ -21,67 +21,22 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.ra module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -LOCAL_IFILES = \ - $(srcdir)/ra.i - -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the _howto shared library -# and knows how to call our extensions. - -BUILT_SOURCES = \ - ra.cc \ - ra.py - -# This gets ra.py installed in the right place -ourpython_PYTHON = \ - ra.py +TOP_SWIG_IFILES = \ + ra.i -ourlib_LTLIBRARIES = _ra.la - -# These are the source files that go into the shared library -_ra_la_SOURCES = \ - ra.cc - -# magic flags -_ra_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -# link the library against some comon swig runtime code and the -# c++ standard library -_ra_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - -lstdc++ - -ra.cc ra.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module ra -o ra.cc $(LOCAL_IFILES) - -# These headers get installed in ${prefix}/include/gnuradio -grinclude_HEADERS = - -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +# Install so that they end up available as: +# import gnuradio.ra +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +ra_pythondir_category = \ + gnuradio +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-radio-astronomy/src/lib/Makefile.swig.gen b/gr-radio-astronomy/src/lib/Makefile.swig.gen new file mode 100644 index 00000000..26f2373f --- /dev/null +++ b/gr-radio-astronomy/src/lib/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for ra.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/ra +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/ra +## +## 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. + +ra_pythondir_category ?= gnuradio/ra +ra_pylibdir_category ?= $(ra_pythondir_category) +ra_pythondir = $(pythondir)/$(ra_pythondir_category) +ra_pylibdir = $(pyexecdir)/$(ra_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +ra_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/ra-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 += ra.py ra.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +ra_swiginclude_HEADERS = \ + ra.i \ + $(ra_swiginclude_headers) + +ra_pylib_LTLIBRARIES = \ + _ra.la + +_ra_la_SOURCES = \ + ra.cc \ + $(ra_la_swig_sources) + +_ra_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(ra_la_swig_libadd) + +_ra_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(ra_la_swig_ldflags) + +_ra_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(ra_la_swig_cxxflags) + +ra_python_PYTHON = \ + ra.py \ + $(ra_python) + +## Entry rule for running SWIG + +ra.h ra.py ra.cc: ra.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)/ra-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)/ra-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)/ra-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)/ra-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/ra-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)/ra-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)/ra-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)/ra-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/ra-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) $(ra_swig_args) \ + -MD -MF $(DEPDIR)/ra.Std \ + -module ra -o ra.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/ra.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/ra.Std \ + > $(DEPDIR)/ra.Sd; \ + $(RM) $(DEPDIR)/ra.Std; \ + $(MV) $(DEPDIR)/ra.Sd $(DEPDIR)/ra.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/ra.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)/ra.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/ra.Std $(DEPDIR)/ra.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/ra.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)/ra.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/ra.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/ra.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)/ra-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/ra.d@am__quote@ + diff --git a/gr-sounder/src/fpga/lib/Makefile.am b/gr-sounder/src/fpga/lib/Makefile.am index 0dfb19b2..3aae9637 100644 --- a/gr-sounder/src/fpga/lib/Makefile.am +++ b/gr-sounder/src/fpga/lib/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -28,5 +28,3 @@ EXTRA_DIST = \ sounder_ctrl.v \ sounder_rx.v \ sounder_tx.v - -MOSTLYCLEANFILES = *~ \ No newline at end of file diff --git a/gr-sounder/src/fpga/tb/Makefile.am b/gr-sounder/src/fpga/tb/Makefile.am index e873fa59..ec15f28d 100644 --- a/gr-sounder/src/fpga/tb/Makefile.am +++ b/gr-sounder/src/fpga/tb/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -27,4 +27,4 @@ EXTRA_DIST = \ sounder_tb.sh \ sounder_tb_wave.sh -MOSTLYCLEANFILES = *~ *.vcd *.out* sounder_tb \ No newline at end of file +MOSTLYCLEANFILES += *.vcd *.out* sounder_tb diff --git a/gr-sounder/src/fpga/top/Makefile.am b/gr-sounder/src/fpga/top/Makefile.am index 33e8c860..63e07dc5 100644 --- a/gr-sounder/src/fpga/top/Makefile.am +++ b/gr-sounder/src/fpga/top/Makefile.am @@ -37,7 +37,7 @@ EXTRA_DIST = \ usrp_sounder.psf \ usrp_sounder.qpf -MOSTLYCLEANFILES = \ +MOSTLYCLEANFILES += \ db/* \ *.rpt \ *.summary \ @@ -45,5 +45,4 @@ MOSTLYCLEANFILES = \ *.smsg \ *.done \ *.pin \ - *.sof \ - *~ + *.sof diff --git a/gr-sounder/src/python/Makefile.am b/gr-sounder/src/python/Makefile.am index cec94847..546a9d64 100644 --- a/gr-sounder/src/python/Makefile.am +++ b/gr-sounder/src/python/Makefile.am @@ -38,5 +38,3 @@ dist_bin_SCRIPTS = \ ourpython_PYTHON = \ sounder.py - -MOSTLYCLEANFILES = *~ *.pyc *.pyo \ No newline at end of file diff --git a/gr-trellis/src/examples/Makefile.am b/gr-trellis/src/examples/Makefile.am index c8ba44f9..8fb727ac 100644 --- a/gr-trellis/src/examples/Makefile.am +++ b/gr-trellis/src/examples/Makefile.am @@ -43,5 +43,3 @@ dist_ourdata_SCRIPTS = \ test_turbo_equalization.py \ test_turbo_equalization1.py \ test_turbo_equalization2.py - -MOSTLYCLEANFILES = *.pyc diff --git a/gr-trellis/src/lib/Makefile.am b/gr-trellis/src/lib/Makefile.am index ea43a37f..2e7591e4 100644 --- a/gr-trellis/src/lib/Makefile.am +++ b/gr-trellis/src/lib/Makefile.am @@ -21,13 +21,6 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.trellis module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) # ---------------------------------------------------------------- @@ -42,17 +35,13 @@ core_generator = \ trellis_metrics_X.cc.t \ trellis_metrics_X.h.t \ trellis_metrics_X.i.t \ - trellis_viterbi_combined_XX.cc.t \ + trellis_viterbi_combined_XX.cc.t \ trellis_viterbi_combined_XX.h.t \ trellis_viterbi_combined_XX.i.t \ trellis_viterbi_X.cc.t \ trellis_viterbi_X.h.t \ trellis_viterbi_X.i.t -# include the srcdir's Makefile.gen; doing this creates an implicit -# dependency between $(srcdir)/Makefile.in and $(srcdir)/Makefile.gen. -include $(srcdir)/Makefile.gen - # Source built by Python into $(builddir) python_built_sources = \ $(GENERATED_H) \ @@ -60,76 +49,9 @@ python_built_sources = \ $(GENERATED_CC) \ trellis_generated.i -# Required when including Makefile.gen.gen - -STAMPS = -gen_sources = $(python_built_sources) -gen_sources_deps = $(core_generator) -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc - -# common way for generating sources from templates, using the above parameters -include $(top_srcdir)/Makefile.gen.gen - -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the _trellis shared library -# and knows how to call our extensions. - -swig_built_sources = \ - trellis.cc \ - trellis.py - -BUILT_SOURCES = \ - $(python_built_sources) \ - $(swig_built_sources) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -LOCAL_IFILES = \ - $(srcdir)/trellis.i - EXTRA_DIST = \ $(core_generator) -# This gets trellis.py installed in the right place -ourpython_PYTHON = \ - trellis.py - -ourlib_LTLIBRARIES = _trellis.la - -# These are the source files that go into the shared library -_trellis_la_SOURCES = \ - trellis.cc \ - fsm.cc \ - quicksort_index.cc \ - base.cc \ - interleaver.cc \ - trellis_calc_metric.cc \ - trellis_permutation.cc \ - trellis_siso_f.cc \ - trellis_siso_combined_f.cc \ - $(GENERATED_CC) - -# magic flags -_trellis_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -# link the library against some comon swig runtime code and the -# c++ standard library -_trellis_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - -lstdc++ - -_trellis_la_CXXFLAGS = @swig_CXXFLAGS@ - -trellis.cc trellis.py: $(ALL_IFILES) $(grinclude_HEADERS) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module trellis \ - -o trellis.cc $(LOCAL_IFILES) - # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ fsm.h \ @@ -144,9 +66,37 @@ grinclude_HEADERS = \ trellis_siso_combined_f.h \ $(GENERATED_H) -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) \ +################################# +# SWIG interface and library + +TOP_SWIG_IFILES = \ + trellis.i + +# Install so that they end up available as: +# import gnuradio.trellis +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +trellis_pythondir_category = \ + gnuradio + +# additional sources for the SWIG-generated library +trellis_la_swig_sources = \ + fsm.cc \ + quicksort_index.cc \ + base.cc \ + interleaver.cc \ + trellis_calc_metric.cc \ + trellis_permutation.cc \ + trellis_siso_f.cc \ + trellis_siso_combined_f.cc \ + $(GENERATED_CC) + +# additional libraries for linking with the SWIG-generated library +trellis_la_swig_libadd = \ + $(GNURADIO_CORE_LA) + +# additional SWIG files to be installed +trellis_swiginclude_headers = \ $(GENERATED_I) \ fsm.i \ interleaver.i \ @@ -155,7 +105,29 @@ swiginclude_HEADERS = \ trellis_siso_combined_f.i \ trellis_generated.i -# Don't distribute output of swig -dist-hook: - @for file in $(swig_built_sources); do echo $(RM) $(distdir)/$$file; done - @for file in $(swig_built_sources); do $(RM) $(distdir)/$$file; done +# Do creation and inclusion of other Makefiles last + +# include the srcdir's Makefile.gen; doing this creates an implicit +# dependency between $(srcdir)/Makefile.in and $(srcdir)/Makefile.gen. +include $(srcdir)/Makefile.gen + +# common way for generating local Makefile.gen +makefile_gen_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) do_makefile=1 do_sources=0 $(PYTHON) $(srcdir)/generate_all.py +include $(top_srcdir)/Makefile.gen.gen + +# common way for generating sources from templates when using +# BUILT_SOURCES, using parallel build protection. +gen_sources = $(python_built_sources) +gen_sources_deps = $(core_generator) +par_gen_command = PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py +include $(top_srcdir)/Makefile.par.gen + +include $(top_srcdir)/Makefile.swig + +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = \ + $(python_built_sources) \ + $(swig_built_sources) + +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-trellis/src/lib/Makefile.swig.gen b/gr-trellis/src/lib/Makefile.swig.gen new file mode 100644 index 00000000..1a9656b8 --- /dev/null +++ b/gr-trellis/src/lib/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for trellis.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/trellis +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/trellis +## +## 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. + +trellis_pythondir_category ?= gnuradio/trellis +trellis_pylibdir_category ?= $(trellis_pythondir_category) +trellis_pythondir = $(pythondir)/$(trellis_pythondir_category) +trellis_pylibdir = $(pyexecdir)/$(trellis_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +trellis_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/trellis-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 += trellis.py trellis.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +trellis_swiginclude_HEADERS = \ + trellis.i \ + $(trellis_swiginclude_headers) + +trellis_pylib_LTLIBRARIES = \ + _trellis.la + +_trellis_la_SOURCES = \ + trellis.cc \ + $(trellis_la_swig_sources) + +_trellis_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(trellis_la_swig_libadd) + +_trellis_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(trellis_la_swig_ldflags) + +_trellis_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(trellis_la_swig_cxxflags) + +trellis_python_PYTHON = \ + trellis.py \ + $(trellis_python) + +## Entry rule for running SWIG + +trellis.h trellis.py trellis.cc: trellis.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)/trellis-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)/trellis-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)/trellis-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)/trellis-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/trellis-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)/trellis-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)/trellis-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)/trellis-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/trellis-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) $(trellis_swig_args) \ + -MD -MF $(DEPDIR)/trellis.Std \ + -module trellis -o trellis.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/trellis.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/trellis.Std \ + > $(DEPDIR)/trellis.Sd; \ + $(RM) $(DEPDIR)/trellis.Std; \ + $(MV) $(DEPDIR)/trellis.Sd $(DEPDIR)/trellis.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/trellis.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)/trellis.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/trellis.Std $(DEPDIR)/trellis.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/trellis.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)/trellis.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/trellis.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/trellis.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)/trellis-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/trellis.d@am__quote@ + diff --git a/gr-trellis/src/python/Makefile.am b/gr-trellis/src/python/Makefile.am index 37b8f1a0..76ec9d0c 100644 --- a/gr-trellis/src/python/Makefile.am +++ b/gr-trellis/src/python/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004 Free Software Foundation, Inc. +# Copyright 2004,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,5 +31,3 @@ TESTS = \ noinst_PYTHON = \ qa_trellis.py - -MOSTLYCLEANFILES = *.pyc diff --git a/gr-usrp/apps/Makefile.am b/gr-usrp/apps/Makefile.am index f28fac8d..824a4897 100644 --- a/gr-usrp/apps/Makefile.am +++ b/gr-usrp/apps/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -51,5 +51,3 @@ usrp_rx_cfile_SOURCES = \ usrp_siggen_SOURCES = \ usrp_siggen.cc - -MOSTLYCLEANFILES = *~ diff --git a/gr-usrp/src/Makefile.am b/gr-usrp/src/Makefile.am index 7b897ea0..9b8737d7 100644 --- a/gr-usrp/src/Makefile.am +++ b/gr-usrp/src/Makefile.am @@ -21,6 +21,17 @@ include $(top_srcdir)/Makefile.common +# ---------------------------------------------------------------- +# Misc. build/installation activities + +EXTRA_DIST = run_tests.in + +TESTS = run_tests + +DISTCLEANFILES = run_tests + +noinst_PYTHON = qa_usrp.py + # ---------------------------------------------------------------- # The straight C++ library @@ -58,76 +69,45 @@ grinclude_HEADERS = \ usrp_source_s.h # ---------------------------------------------------------------- -# The SWIG library and Python modules -# -# Install this stuff so that it ends up as the gnuradio.usrp module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/usrp - -ourpythondir = $(grpythondir)/usrp -ourlibdir = $(grpyexecdir)/usrp - -BUILT_SOURCES = \ - usrp_swig.cc \ - usrp_swig.py +# The SWIG library -LOCAL_IFILES = \ - $(srcdir)/usrp.i \ - $(srcdir)/usrp_base.i \ - $(srcdir)/usrp_source_base.i \ - $(srcdir)/usrp_source_c.i \ - $(srcdir)/usrp_source_s.i \ - $(srcdir)/usrp_sink_base.i \ - $(srcdir)/usrp_sink_c.i \ - $(srcdir)/usrp_sink_s.i \ - $(srcdir)/usrp_standard.i +TOP_SWIG_IFILES = \ + usrp_swig.i -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -ourlib_LTLIBRARIES = \ - _usrp_swig.la - -ourlib_PYTHON = \ - __init__.py \ - usrp_swig.py +# Install so that they end up available as: +# import gnuradio.usrp +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/usrp +usrp_swig_pythondir_category = \ + gnuradio/usrp -_usrp_swig_la_SOURCES = \ - usrp_swig.cc +# additional arguments to the SWIG command +usrp_swig_swig_args = \ + $(USRP_INCLUDES) -_usrp_swig_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ +# additional libraries for linking with the SWIG-generated library +usrp_swig_la_swig_libadd = \ libgnuradio-usrp.la -_usrp_swig_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -_usrp_swig_la_CXXFLAGS = @swig_CXXFLAGS@ - -# Special swig arguments -LOCAL_SWIG_DEFINES_AND_INCLUDES = $(USRP_INCLUDES) +# additional Python files to be installed along with the SWIG-generated one +usrp_swig_python = \ + __init__.py -usrp_swig.cc usrp_swig.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module usrp_swig \ - -o usrp_swig.cc $(srcdir)/usrp.i +# additional SWIG files to be installed +usrp_swig_swiginclude_headers = \ + usrp_base.i \ + usrp_source_base.i \ + usrp_source_c.i \ + usrp_source_s.i \ + usrp_sink_base.i \ + usrp_sink_c.i \ + usrp_sink_s.i \ + usrp_standard.i -noinst_PYTHON = \ - qa_usrp.py +include $(top_srcdir)/Makefile.swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done - -# ---------------------------------------------------------------- -# Misc. build/installation activities - -MOSTLYCLEANFILES = $(BUILT_SOURCES) *~ *.pyc -EXTRA_DIST = run_tests.in -TESTS = run_tests +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-usrp/src/Makefile.swig.gen b/gr-usrp/src/Makefile.swig.gen new file mode 100644 index 00000000..9884b3d4 --- /dev/null +++ b/gr-usrp/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for usrp_swig.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp_swig +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp_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. + +usrp_swig_pythondir_category ?= gnuradio/usrp_swig +usrp_swig_pylibdir_category ?= $(usrp_swig_pythondir_category) +usrp_swig_pythondir = $(pythondir)/$(usrp_swig_pythondir_category) +usrp_swig_pylibdir = $(pyexecdir)/$(usrp_swig_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +usrp_swig_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/usrp_swig-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 += usrp_swig.py usrp_swig.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +usrp_swig_swiginclude_HEADERS = \ + usrp_swig.i \ + $(usrp_swig_swiginclude_headers) + +usrp_swig_pylib_LTLIBRARIES = \ + _usrp_swig.la + +_usrp_swig_la_SOURCES = \ + usrp_swig.cc \ + $(usrp_swig_la_swig_sources) + +_usrp_swig_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(usrp_swig_la_swig_libadd) + +_usrp_swig_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(usrp_swig_la_swig_ldflags) + +_usrp_swig_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(usrp_swig_la_swig_cxxflags) + +usrp_swig_python_PYTHON = \ + usrp_swig.py \ + $(usrp_swig_python) + +## Entry rule for running SWIG + +usrp_swig.h usrp_swig.py usrp_swig.cc: usrp_swig.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)/usrp_swig-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)/usrp_swig-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)/usrp_swig-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)/usrp_swig-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/usrp_swig-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)/usrp_swig-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)/usrp_swig-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)/usrp_swig-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/usrp_swig-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) $(usrp_swig_swig_args) \ + -MD -MF $(DEPDIR)/usrp_swig.Std \ + -module usrp_swig -o usrp_swig.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/usrp_swig.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/usrp_swig.Std \ + > $(DEPDIR)/usrp_swig.Sd; \ + $(RM) $(DEPDIR)/usrp_swig.Std; \ + $(MV) $(DEPDIR)/usrp_swig.Sd $(DEPDIR)/usrp_swig.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/usrp_swig.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)/usrp_swig.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/usrp_swig.Std $(DEPDIR)/usrp_swig.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/usrp_swig.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)/usrp_swig.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/usrp_swig.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/usrp_swig.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)/usrp_swig-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/usrp_swig.d@am__quote@ + diff --git a/gr-usrp/src/usrp.i b/gr-usrp/src/usrp_swig.i similarity index 100% rename from gr-usrp/src/usrp.i rename to gr-usrp/src/usrp_swig.i diff --git a/gr-usrp2/src/Makefile.am b/gr-usrp2/src/Makefile.am index 90796cea..bd9034f1 100644 --- a/gr-usrp2/src/Makefile.am +++ b/gr-usrp2/src/Makefile.am @@ -21,6 +21,22 @@ include $(top_srcdir)/Makefile.common +# ---------------------------------------------------------------------- +# Local Python files, not installed +# +# qa_usrp2.py +# ---------------------------------------------------------------------- + +noinst_PYTHON = qa_usrp2.py + +# ---------------------------------------------------------------------- +# Miscellaneous build operations +# ---------------------------------------------------------------------- + +EXTRA_DIST = run_tests.in +TESTS = run_tests +DISTCLEANFILES = run_tests + # ---------------------------------------------------------------------- # C++ block API interface librar(ies) # @@ -70,64 +86,28 @@ noinst_HEADERS = \ # _usrp2.so # ---------------------------------------------------------------------- -# Python installation locations -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - -# SWIG interface files -LOCAL_IFILES = $(srcdir)/usrp2.i -NON_LOCAL_IFILES = $(GNURADIO_I) -ALL_IFILES = $(LOCAL_IFILES) $(NON_LOCAL_IFILES) - -# Install the SWIG interface files -swiginclude_HEADERS = $(LOCAL_IFILES) +TOP_SWIG_IFILES = \ + usrp2.i -# Generated by SWIG wrapper generator -BUILT_SOURCES = usrp2.cc usrp2.py +# Install so that they end up available as: +# import gnuradio.usrp2 +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +usrp2_pythondir_category = \ + gnuradio -# Install the SWIG python output -ourpython_PYTHON = usrp2.py +# additional arguments to the SWIG command +usrp2_swig_args = \ + $(USRP2_INCLUDES) -# Special swig arguments -LOCAL_SWIG_DEFINES_AND_INCLUDES = $(USRP2_INCLUDES) +# additional libraries for linking with the SWIG-generated library +usrp2_la_swig_libadd = \ + libgr-usrp2.la -# Invoke SWIG wrapper generator -usrp2.cc usrp2.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module usrp2 \ - -o usrp2.cc $(LOCAL_IFILES) +include $(top_srcdir)/Makefile.swig -# Create the Python shared library -ourlib_LTLIBRARIES = _usrp2.la -_usrp2_la_SOURCES = usrp2.cc -_usrp2_la_CXXFLAGS = @swig_CXXFLAGS@ -_usrp2_la_LDFLAGS = $(swig_CXXFLAGS) $(NO_UNDEFINED) -module -avoid-version +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Link the library as needed -_usrp2_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - libgr-usrp2.la \ - $(GNURADIO_CORE_LA) \ - $(USRP2_LIBS) \ - -lstdc++ - -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done - -# ---------------------------------------------------------------------- -# Local Python files, not installed -# -# qa_usrp2.py -# ---------------------------------------------------------------------- - -noinst_PYTHON = qa_usrp2.py - - -# ---------------------------------------------------------------------- -# Miscellaneous build operations -# ---------------------------------------------------------------------- - -EXTRA_DIST = run_tests.in -TESTS = run_tests -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-usrp2/src/Makefile.swig.gen b/gr-usrp2/src/Makefile.swig.gen new file mode 100644 index 00000000..24d9f17c --- /dev/null +++ b/gr-usrp2/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for usrp2.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp2 +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp2 +## +## 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. + +usrp2_pythondir_category ?= gnuradio/usrp2 +usrp2_pylibdir_category ?= $(usrp2_pythondir_category) +usrp2_pythondir = $(pythondir)/$(usrp2_pythondir_category) +usrp2_pylibdir = $(pyexecdir)/$(usrp2_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +usrp2_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/usrp2-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 += usrp2.py usrp2.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +usrp2_swiginclude_HEADERS = \ + usrp2.i \ + $(usrp2_swiginclude_headers) + +usrp2_pylib_LTLIBRARIES = \ + _usrp2.la + +_usrp2_la_SOURCES = \ + usrp2.cc \ + $(usrp2_la_swig_sources) + +_usrp2_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(usrp2_la_swig_libadd) + +_usrp2_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(usrp2_la_swig_ldflags) + +_usrp2_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(usrp2_la_swig_cxxflags) + +usrp2_python_PYTHON = \ + usrp2.py \ + $(usrp2_python) + +## Entry rule for running SWIG + +usrp2.h usrp2.py usrp2.cc: usrp2.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)/usrp2-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)/usrp2-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)/usrp2-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)/usrp2-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/usrp2-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)/usrp2-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)/usrp2-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)/usrp2-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/usrp2-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) $(usrp2_swig_args) \ + -MD -MF $(DEPDIR)/usrp2.Std \ + -module usrp2 -o usrp2.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/usrp2.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/usrp2.Std \ + > $(DEPDIR)/usrp2.Sd; \ + $(RM) $(DEPDIR)/usrp2.Std; \ + $(MV) $(DEPDIR)/usrp2.Sd $(DEPDIR)/usrp2.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/usrp2.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)/usrp2.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/usrp2.Std $(DEPDIR)/usrp2.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/usrp2.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)/usrp2.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/usrp2.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/usrp2.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)/usrp2-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/usrp2.d@am__quote@ + diff --git a/gr-utils/src/python/Makefile.am b/gr-utils/src/python/Makefile.am index 5eb2ae55..b58faa9b 100644 --- a/gr-utils/src/python/Makefile.am +++ b/gr-utils/src/python/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -56,5 +56,3 @@ bin_SCRIPTS = \ usrp2_rx_cfile.py \ usrp2_siggen.py \ usrp2_siggen_gui.py - -MOSTLYCLEANFILES = *~ *.pyc diff --git a/gr-video-sdl/src/Makefile.am b/gr-video-sdl/src/Makefile.am index a42531f0..04139afd 100644 --- a/gr-video-sdl/src/Makefile.am +++ b/gr-video-sdl/src/Makefile.am @@ -21,69 +21,49 @@ include $(top_srcdir)/Makefile.common -# Install this stuff so that it ends up as the gnuradio.video_sdl module -# This usually ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio - -ourpythondir = $(grpythondir) -ourlibdir = $(grpyexecdir) - EXTRA_DIST = run_tests.in -TESTS = run_tests -LOCAL_IFILES = \ - $(top_srcdir)/gr-video-sdl/src/video_sdl.i - -NON_LOCAL_IFILES = \ - $(GNURADIO_I) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) +TESTS = run_tests -BUILT_SOURCES = \ - video_sdl.cc \ - video_sdl.py +DISTCLEANFILES = run_tests -ourpython_PYTHON = \ - video_sdl.py +noinst_PYTHON = \ + qa_video_sdl.py AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(SDL_CFLAGS) \ $(WITH_INCLUDES) -ourlib_LTLIBRARIES = _video_sdl.la - -_video_sdl_la_SOURCES = \ - video_sdl.cc \ - video_sdl_sink_uc.cc \ - video_sdl_sink_s.cc - - grinclude_HEADERS = \ video_sdl_sink_uc.h \ video_sdl_sink_s.h -swiginclude_HEADERS = \ - $(LOCAL_IFILES) +################################# +# SWIG interface and library -_video_sdl_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - $(SDL_LIBS) \ - -lstdc++ +TOP_SWIG_IFILES = \ + video_sdl.i -_video_sdl_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version +# Install so that they end up available as: +# import gnuradio.video_sdl +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/gnuradio +video_sdl_pythondir_category = \ + gnuradio + +# additional sources for the SWIG-generated library +video_sdl_la_swig_sources = \ + video_sdl_sink_uc.cc \ + video_sdl_sink_s.cc -video_sdl.cc video_sdl.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module video_sdl \ - -o video_sdl.cc $(LOCAL_IFILES) +# additional libraries for linking with the SWIG-generated library +video_sdl_la_swig_libadd = \ + $(SDL_LIBS) \ + $(GNURADIO_CORE_LA) -noinst_PYTHON = qa_video_sdl.py +include $(top_srcdir)/Makefile.swig -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/gr-video-sdl/src/Makefile.swig.gen b/gr-video-sdl/src/Makefile.swig.gen new file mode 100644 index 00000000..a2728a4f --- /dev/null +++ b/gr-video-sdl/src/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for video_sdl.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/video_sdl +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/video_sdl +## +## 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. + +video_sdl_pythondir_category ?= gnuradio/video_sdl +video_sdl_pylibdir_category ?= $(video_sdl_pythondir_category) +video_sdl_pythondir = $(pythondir)/$(video_sdl_pythondir_category) +video_sdl_pylibdir = $(pyexecdir)/$(video_sdl_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +video_sdl_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/video_sdl-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 += video_sdl.py video_sdl.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +video_sdl_swiginclude_HEADERS = \ + video_sdl.i \ + $(video_sdl_swiginclude_headers) + +video_sdl_pylib_LTLIBRARIES = \ + _video_sdl.la + +_video_sdl_la_SOURCES = \ + video_sdl.cc \ + $(video_sdl_la_swig_sources) + +_video_sdl_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(video_sdl_la_swig_libadd) + +_video_sdl_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(video_sdl_la_swig_ldflags) + +_video_sdl_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(video_sdl_la_swig_cxxflags) + +video_sdl_python_PYTHON = \ + video_sdl.py \ + $(video_sdl_python) + +## Entry rule for running SWIG + +video_sdl.h video_sdl.py video_sdl.cc: video_sdl.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)/video_sdl-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)/video_sdl-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)/video_sdl-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)/video_sdl-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/video_sdl-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)/video_sdl-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)/video_sdl-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)/video_sdl-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/video_sdl-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) $(video_sdl_swig_args) \ + -MD -MF $(DEPDIR)/video_sdl.Std \ + -module video_sdl -o video_sdl.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/video_sdl.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/video_sdl.Std \ + > $(DEPDIR)/video_sdl.Sd; \ + $(RM) $(DEPDIR)/video_sdl.Std; \ + $(MV) $(DEPDIR)/video_sdl.Sd $(DEPDIR)/video_sdl.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/video_sdl.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)/video_sdl.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/video_sdl.Std $(DEPDIR)/video_sdl.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/video_sdl.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)/video_sdl.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/video_sdl.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/video_sdl.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)/video_sdl-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/video_sdl.d@am__quote@ + diff --git a/grc/freedesktop/Makefile.am b/grc/freedesktop/Makefile.am index fab6f87a..b167a0c6 100644 --- a/grc/freedesktop/Makefile.am +++ b/grc/freedesktop/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -41,7 +41,6 @@ grc_setup_freedesktop: Makefile grc_setup_freedesktop.in EXTRA_DIST = $(srcdir)/grc_setup_freedesktop.in BUILT_SOURCES = grc_setup_freedesktop -MOSTLYCLEANFILES = $(BUILT_SOURCES) install-data-hook: @printf "\n*** GRC Post-Install Message ***\ diff --git a/grc/src/platforms/base/Makefile.am b/grc/src/platforms/base/Makefile.am index 48209d8b..e3912833 100644 --- a/grc/src/platforms/base/Makefile.am +++ b/grc/src/platforms/base/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -43,4 +43,3 @@ Constants.py: Makefile Constants.py.in EXTRA_DIST = $(srcdir)/Constants.py.in BUILT_SOURCES = Constants.py -MOSTLYCLEANFILES = $(BUILT_SOURCES) diff --git a/grc/src/platforms/python/Makefile.am b/grc/src/platforms/python/Makefile.am index 4232234a..3790b84f 100644 --- a/grc/src/platforms/python/Makefile.am +++ b/grc/src/platforms/python/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -46,4 +46,3 @@ Constants.py: Makefile Constants.py.in EXTRA_DIST = $(srcdir)/Constants.py.in BUILT_SOURCES = Constants.py -MOSTLYCLEANFILES = $(BUILT_SOURCES) diff --git a/mblock/src/lib/Makefile.am b/mblock/src/lib/Makefile.am index 269c8ae2..81079f03 100644 --- a/mblock/src/lib/Makefile.am +++ b/mblock/src/lib/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2006,2007,2008 Free Software Foundation, Inc. +# Copyright 2006,2007,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -130,5 +130,3 @@ test_mblock_LDADD = libmblock-qa.la benchmark_send_SOURCES = benchmark_send.cc benchmark_send_LDADD = libmblock-qa.la - -CLEANFILES = $(BUILT_SOURCES) *.pyc diff --git a/pmt/src/lib/Makefile.am b/pmt/src/lib/Makefile.am index 5565e098..32e5210d 100644 --- a/pmt/src/lib/Makefile.am +++ b/pmt/src/lib/Makefile.am @@ -31,7 +31,7 @@ lib_LTLIBRARIES = libpmt.la libpmt-qa.la # ---------------------------------------------------------------- # these scripts generate code -CODE_GENERATOR = \ +code_generator = \ generate_unv.py \ unv_template.h.t \ unv_template.cc.t \ @@ -45,49 +45,14 @@ GENERATED_CC = \ pmt_unv.cc \ qa_pmt_unv.cc +python_built_sources = $(GENERATED_H) $(GENERATED_I) $(GENERATED_CC) - -# Ensure parallel make does the right thing. -# http://sources.redhat.com/automake/automake.html#Multiple-Outputs - -STAMPS = generate-stamp - -generate-stamp: $(CODE_GENERATOR) - @rm -f generate-tmp - @touch generate-tmp - PYTHONPATH=$(top_srcdir)/pmt/src/lib srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_unv.py - @mv -f generate-tmp $@ - -$(GENERATED_H) $(GENERATED_I) $(GENERATED_CC): generate-stamp -## Recover from the removal of $@ - @if test -f $@; then :; else \ - trap 'rm -rf generate-lock generate-stamp' 1 2 13 15; \ - if mkdir generate-lock 2>/dev/null; then \ -## This code is being executed by the first process. - rm -f generate-stamp; \ - $(MAKE) $(AM_MAKEFLAGS) generate-stamp; \ - rmdir generate-lock; \ - else \ -## This code is being executed by the follower processes. -## Wait until the first process is done. - while test -d generate-lock; do sleep 1; done; \ -## Succeed if and only if the first process succeeded. - test -f generate-stamp; exit $$?; \ - fi; \ - fi - - -pmt_serial_tags.h: $(srcdir)/../scheme/gnuradio/gen-serial-tags.scm $(srcdir)/../scheme/gnuradio/pmt-serial-tags.scm - $(RUN_GUILE) $(srcdir)/../scheme/gnuradio/gen-serial-tags.scm $(srcdir)/../scheme/gnuradio/pmt-serial-tags.scm pmt_serial_tags.h - -BUILT_SOURCES = $(GENERATED_H) $(GENERATED_CC) pmt_serial_tags.h +BUILT_SOURCES = $(python_built_sources) pmt_serial_tags.h # ---------------------------------------------------------------- EXTRA_DIST = \ - $(CODE_GENERATOR) \ - $(STAMPS) - + $(code_generator) # These are the source files that go into the pmt shared library libpmt_la_SOURCES = \ @@ -143,5 +108,16 @@ LIBPMTQA = libpmt-qa.la $(LIBPMT) test_pmt_SOURCES = test_pmt.cc test_pmt_LDADD = $(LIBPMTQA) +# Do creation and inclusion of other Makefiles last -CLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc +# common way for generating sources from templates when using +# BUILT_SOURCES, using parallel build protection. +gen_sources = $(python_built_sources) +gen_sources_deps = $(core_generator) +par_gen_command = PYTHONPATH=$(top_srcdir)/pmt/src/lib srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_unv.py +include $(top_srcdir)/Makefile.par.gen + +# Rule to create the build header file using GUILE +# Doesn't need parallel protections because there is a single target +pmt_serial_tags.h: $(srcdir)/../scheme/gnuradio/gen-serial-tags.scm $(srcdir)/../scheme/gnuradio/pmt-serial-tags.scm + $(RUN_GUILE) $(srcdir)/../scheme/gnuradio/gen-serial-tags.scm $(srcdir)/../scheme/gnuradio/pmt-serial-tags.scm pmt_serial_tags.h diff --git a/usrp/host/lib/inband/Makefile.am b/usrp/host/lib/inband/Makefile.am index ca9009f5..650a25ff 100644 --- a/usrp/host/lib/inband/Makefile.am +++ b/usrp/host/lib/inband/Makefile.am @@ -112,6 +112,3 @@ noinst_PROGRAMS = \ test_inband_SOURCES = test_inband.cc test_inband_LDADD = libusrp-inband-qa.la - -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc diff --git a/usrp/host/lib/legacy/Makefile.am b/usrp/host/lib/legacy/Makefile.am index 7b880924..7063bbad 100644 --- a/usrp/host/lib/legacy/Makefile.am +++ b/usrp/host/lib/legacy/Makefile.am @@ -1,7 +1,7 @@ # # USRP - Universal Software Radio Peripheral # -# Copyright (C) 2003,2004,2006,2007,2008 Free Software Foundation, Inc. +# Copyright (C) 2003,2004,2006,2007,2008,2009 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -184,10 +184,11 @@ noinst_PYTHON = \ check_data.py \ dump_data.py -usrp_dbid.py usrp_dbid.h usrp_dbid.cc: gen_usrp_dbid.py usrp_dbid.dat - PYTHONPATH=$(top_srcdir)/usrp/src srcdir=$(srcdir) $(PYTHON) $(srcdir)/gen_usrp_dbid.py $(srcdir)/usrp_dbid.dat - swiginclude_HEADERS = db_base.i -MOSTLYCLEANFILES = \ - $(BUILT_SOURCES) *~ *.pyc +# common way for generating sources from templates when using +# BUILT_SOURCES, using parallel build protection. +gen_sources = $(BUILT_SOURCES) +gen_sources_deps = gen_usrp_dbid.py usrp_dbid.dat +par_gen_command = PYTHONPATH=$(top_srcdir)/usrp/src srcdir=$(srcdir) $(PYTHON) $(srcdir)/gen_usrp_dbid.py $(srcdir)/usrp_dbid.dat +include $(top_srcdir)/Makefile.par.gen diff --git a/usrp/host/swig/Makefile.am b/usrp/host/swig/Makefile.am index 08e6c436..6af452b0 100644 --- a/usrp/host/swig/Makefile.am +++ b/usrp/host/swig/Makefile.am @@ -21,63 +21,42 @@ include $(top_srcdir)/Makefile.common -ourpythondir = $(usrppythondir) -ourlibdir = $(usrppyexecdir) +AM_CPPFLAGS = \ + $(USRP_INCLUDES) \ + $(PYTHON_CPPFLAGS) \ + -I$(srcdir) \ + $(WITH_INCLUDES) +################################# +# SWIG interface and library -AM_CPPFLAGS = $(USRP_INCLUDES) \ - $(PYTHON_CPPFLAGS) \ - -I$(srcdir) \ - $(WITH_INCLUDES) +TOP_SWIG_IFILES = \ + usrp_prims.i -LOCAL_IFILES = \ - prims.i +# Install so that they end up available as: +# import usrpm.usrp_prims +# This ends up at: +# ${prefix}/lib/python${python_version}/site-packages/usrpm +usrp_prims_pythondir_category = \ + usrpm +# additional arguments to the SWIG command +usrp_prims_swig_args = \ + $(USRP_INCLUDES) -ALL_IFILES = \ - $(LOCAL_IFILES) +# additional libraries for linking with the SWIG-generated library +usrp_prims_la_swig_libadd = \ + $(USRP_LA) +# additional Python files to be installed along with the SWIG-generated one +usrp_prims_python = \ + __init__.py \ + usrp_fpga_regs.py -EXTRA_DIST = \ - $(LOCAL_IFILES) +include $(top_srcdir)/Makefile.swig +# add some of the variables generated inside the Makefile.swig.gen +BUILT_SOURCES = $(swig_built_sources) -BUILT_SOURCES = \ - prims.cc \ - usrp_prims.py - - -ourpython_PYTHON = \ - __init__.py \ - usrp_fpga_regs.py \ - usrp_prims.py - -# special SWIG flags -LOCAL_SWIG_DEFINES_AND_INCLUDES = $(USRP_INCLUDES) - -ourlib_LTLIBRARIES = \ - _usrp_prims.la - -_usrp_prims_la_SOURCES = \ - prims.cc - - -noinst_HEADERS = - -_usrp_prims_la_LIBADD = $(USRP_LA) -lstdc++ $(PYTHON_LDFLAGS) -_usrp_prims_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -_usrp_prims_la_CXXFLAGS = @swig_CXXFLAGS@ - -prims.cc usrp_prims.py : $(srcdir)/prims.i ../../firmware/include/fpga_regs_common.h ../../firmware/include/fpga_regs_standard.h - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module usrp_prims \ - -o prims.cc $(srcdir)/prims.i - -MOSTLYCLEANFILES = \ - prims.cc usrp_prims.py *~ *.pyc - -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done - +# Do not distribute the output of SWIG +no_dist_files = $(swig_built_sources) diff --git a/usrp/host/swig/Makefile.swig.gen b/usrp/host/swig/Makefile.swig.gen new file mode 100644 index 00000000..00de3e42 --- /dev/null +++ b/usrp/host/swig/Makefile.swig.gen @@ -0,0 +1,259 @@ +# -*- Makefile -*- +# +# Copyright 2009 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 GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# Makefile.swig.gen for usrp_prims.i + +## Default install locations for these files: +## +## Default location for the Python directory is: +## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp_prims +## Default location for the Python exec directory is: +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp_prims +## +## 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. + +usrp_prims_pythondir_category ?= gnuradio/usrp_prims +usrp_prims_pylibdir_category ?= $(usrp_prims_pythondir_category) +usrp_prims_pythondir = $(pythondir)/$(usrp_prims_pythondir_category) +usrp_prims_pylibdir = $(pyexecdir)/$(usrp_prims_pylibdir_category) + +## SWIG headers are always installed into the same directory. + +usrp_prims_swigincludedir = $(swigincludedir) + +## This is a template file for a "generated" Makefile addition (in +## this case, "Makefile.swig.gen"). By including the top-level +## Makefile.swig, this file will be used to generate the SWIG +## dependencies. Assign the variable TOP_SWIG_FILES to be the list of +## SWIG .i files to generated wrappings for; there can be more than 1 +## so long as the names are unique (no sorting is done on the +## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i +## file will generate .cc, .py, and possibly .h files -- meaning that +## all of these files will have the same base name (that provided for +## the SWIG .i file). +## +## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the +## 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)/usrp_prims-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 += usrp_prims.py usrp_prims.cc + +## Various SWIG variables. These can be overloaded in the including +## Makefile.am by setting the variable value there, then including +## Makefile.swig . + +usrp_prims_swiginclude_HEADERS = \ + usrp_prims.i \ + $(usrp_prims_swiginclude_headers) + +usrp_prims_pylib_LTLIBRARIES = \ + _usrp_prims.la + +_usrp_prims_la_SOURCES = \ + usrp_prims.cc \ + $(usrp_prims_la_swig_sources) + +_usrp_prims_la_LIBADD = \ + $(STD_SWIG_LA_LIB_ADD) \ + $(usrp_prims_la_swig_libadd) + +_usrp_prims_la_LDFLAGS = \ + $(STD_SWIG_LA_LD_FLAGS) \ + $(usrp_prims_la_swig_ldflags) + +_usrp_prims_la_CXXFLAGS = \ + $(STD_SWIG_CXX_FLAGS) \ + $(usrp_prims_la_swig_cxxflags) + +usrp_prims_python_PYTHON = \ + usrp_prims.py \ + $(usrp_prims_python) + +## Entry rule for running SWIG + +usrp_prims.h usrp_prims.py usrp_prims.cc: usrp_prims.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)/usrp_prims-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)/usrp_prims-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)/usrp_prims-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)/usrp_prims-generate-stamp; \ +## +## Tell MAKE to run the rule for creating this stamp. +## + $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/usrp_prims-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)/usrp_prims-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)/usrp_prims-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)/usrp_prims-generate-stamp; \ + exit $$?; \ + fi; + +$(DEPDIR)/usrp_prims-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) $(usrp_prims_swig_args) \ + -MD -MF $(DEPDIR)/usrp_prims.Std \ + -module usrp_prims -o usrp_prims.cc $(WHAT); then \ + if test $(host_os) = mingw32; then \ + $(RM) $(DEPDIR)/usrp_prims.Sd; \ + $(SED) 's,\\\\,/,g' < $(DEPDIR)/usrp_prims.Std \ + > $(DEPDIR)/usrp_prims.Sd; \ + $(RM) $(DEPDIR)/usrp_prims.Std; \ + $(MV) $(DEPDIR)/usrp_prims.Sd $(DEPDIR)/usrp_prims.Std; \ + fi; \ + else \ + $(RM) $(DEPDIR)/usrp_prims.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)/usrp_prims.d +## +## (2) Copy the whole SWIG file: +## + cp $(DEPDIR)/usrp_prims.Std $(DEPDIR)/usrp_prims.d +## +## (3) all a carriage return to the end of the dependency file. +## + echo "" >> $(DEPDIR)/usrp_prims.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)/usrp_prims.Std | \ + awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/usrp_prims.d +## +## (5) remove the SWIG-generated file +## + $(RM) $(DEPDIR)/usrp_prims.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)/usrp_prims-generate-stamp + +# 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. + +@am__include@ @am__quote@./$(DEPDIR)/usrp_prims.d@am__quote@ + diff --git a/usrp/host/swig/prims.i b/usrp/host/swig/usrp_prims.i similarity index 100% rename from usrp/host/swig/prims.i rename to usrp/host/swig/usrp_prims.i -- 2.30.2