summaryrefslogtreecommitdiff
path: root/gnuradio-core/src
diff options
context:
space:
mode:
authoreb2009-02-25 21:58:41 +0000
committereb2009-02-25 21:58:41 +0000
commit4d192c227e6c7a00b82aef4aca71a3a77ac0dbd1 (patch)
tree046d96d87a19b3e45c23ba74aecce057ab8f5292 /gnuradio-core/src
parent274f8a56f0d2bad59fb8cef6a11431ccfe6a1e6e (diff)
downloadgnuradio-4d192c227e6c7a00b82aef4aca71a3a77ac0dbd1.tar.gz
gnuradio-4d192c227e6c7a00b82aef4aca71a3a77ac0dbd1.tar.bz2
gnuradio-4d192c227e6c7a00b82aef4aca71a3a77ac0dbd1.zip
Merged mld/fix_makefile_gen -r10446:10509 to trunk. This cleans up
the generation of the Makefile.gen's that occurs in gr-trellis, lib/gengen and lib/filter. If you change any code generator such that it generates a different set of generated file names, you must execute "make generate-makefile" in a non-VPATH build to regenerate the Makefile.gen's. Once they are regenerated, commit them to the repo. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10511 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gnuradio-core/src')
-rw-r--r--gnuradio-core/src/lib/filter/Makefile.am58
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py8
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py6
-rwxr-xr-xgnuradio-core/src/lib/filter/generate_gr_fir_util.py6
-rw-r--r--gnuradio-core/src/lib/gengen/Makefile.am55
-rw-r--r--gnuradio-core/src/python/build_utils.py65
6 files changed, 105 insertions, 93 deletions
diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am
index 20c7da3a2..aaf7d41e0 100644
--- a/gnuradio-core/src/lib/filter/Makefile.am
+++ b/gnuradio-core/src/lib/filter/Makefile.am
@@ -1,5 +1,5 @@
#
-# Copyright 2001,2002,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
+# Copyright 2001,2002,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -34,7 +34,7 @@ noinst_LTLIBRARIES = libfilter.la libfilter-qa.la
# these scripts generate FIR code
#
-CODE_GENERATOR = \
+code_generator = \
generate_all.py \
generate_gr_fir_XXX.py \
generate_gr_fir_filter_XXX.py \
@@ -62,41 +62,28 @@ CODE_GENERATOR = \
gr_freq_xlating_fir_filter_XXX.h.t \
gr_freq_xlating_fir_filter_XXX.i.t
-include Makefile.gen
+# include the srcdir's Makefile.gen; doing this creates an implicit
+# dependency between $(srcdir)/Makefile.in and $(srcdir)/Makefile.gen.
+include $(srcdir)/Makefile.gen
-# Ensure parallel make does the right thing.
-# http://sources.redhat.com/automake/automake.html#Multiple-Outputs
+# Source built by Python into $(builddir)
+python_built_sources = \
+ $(GENERATED_H) \
+ $(GENERATED_I) \
+ $(GENERATED_CC) \
+ filter_generated.i
-STAMPS = generate-stamp
+BUILT_SOURCES = $(python_built_sources)
-generate-stamp: $(CODE_GENERATOR)
- @rm -f generate-tmp
- @touch generate-tmp
- PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py
- @mv -f generate-tmp $@
+# Required when including Makefile.gen.gen
+STAMPS =
+gen_sources = $(BUILT_SOURCES)
+gen_sources_deps = $(core_generator)
+MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc
-$(GENERATED_H) $(GENERATED_I) $(GENERATED_CC) filter_generated.i: 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
-
-
-BUILT_SOURCES = $(GENERATED_H) $(GENERATED_I) $(GENERATED_CC)
-
+# 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
@@ -195,9 +182,7 @@ EXTRA_libfilter_la_SOURCES = \
EXTRA_DIST = \
3dnow_float_dotprod_really_simple.S \
3dnow_float_dotprod_simple.S \
- $(CODE_GENERATOR) \
- $(STAMPS)
-
+ $(code_generator)
# work around automake deficiency
libfilter_la_common_SOURCES = \
@@ -341,6 +326,3 @@ swiginclude_HEADERS = \
gr_single_pole_iir_filter_ff.i \
gr_single_pole_iir_filter_cc.i \
$(GENERATED_I)
-
-
-CLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc
diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py
index 16e64bb0c..b39672193 100755
--- a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py
+++ b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py
@@ -1,7 +1,7 @@
#!/bin/env python
# -*- python -*-
#
-# Copyright 2003 Free Software Foundation, Inc.
+# Copyright 2003,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -28,6 +28,9 @@ from generate_utils import *
def make_gr_fir_sysconfig_h ():
out = open_and_log_name ('gr_fir_sysconfig.h', 'w')
+ if not out:
+ return
+
out.write (copyright)
out.write (
@@ -96,6 +99,9 @@ gr_fir_sysconfig *gr_fir_sysconfig_singleton ();
def make_gr_fir_sysconfig_cc ():
out = open_and_log_name ('gr_fir_sysconfig.cc', 'w')
+ if not out:
+ return
+
out.write (copyright)
out.write (
diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py
index 8f79c020d..03caadaf9 100755
--- a/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py
+++ b/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py
@@ -1,7 +1,7 @@
#!/bin/env python
# -*- python -*-
#
-# Copyright 2003 Free Software Foundation, Inc.
+# Copyright 2003,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -28,6 +28,8 @@ from generate_utils import *
def make_gr_fir_sysconfig_generic_h ():
out = open_and_log_name ('gr_fir_sysconfig_generic.h', 'w')
+ if not out:
+ return
out.write (copyright)
out.write (
@@ -110,6 +112,8 @@ gr_fir_sysconfig_generic::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info)
def make_gr_fir_sysconfig_generic_cc ():
out = open_and_log_name ('gr_fir_sysconfig_generic.cc', 'w')
+ if not out:
+ return
out.write (copyright)
out.write (
diff --git a/gnuradio-core/src/lib/filter/generate_gr_fir_util.py b/gnuradio-core/src/lib/filter/generate_gr_fir_util.py
index 3119562c4..4f5f5ce06 100755
--- a/gnuradio-core/src/lib/filter/generate_gr_fir_util.py
+++ b/gnuradio-core/src/lib/filter/generate_gr_fir_util.py
@@ -1,6 +1,6 @@
#!/bin/env python
#
-# Copyright 2003 Free Software Foundation, Inc.
+# Copyright 2003,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -44,6 +44,8 @@ def make_info (out, sig):
def make_gr_fir_util_h ():
out = open_and_log_name ('gr_fir_util.h', 'w')
+ if not out:
+ return
out.write (copyright)
out.write (
@@ -142,6 +144,8 @@ gr_fir_util::get_gr_fir_%s_info (std::vector<gr_fir_%s_info> *info)
def make_gr_fir_util_cc ():
out = open_and_log_name ('gr_fir_util.cc', 'w')
+ if not out:
+ return
out.write (copyright)
out.write ('''
diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am
index aaf9dd5fc..85ab94f38 100644
--- a/gnuradio-core/src/lib/gengen/Makefile.am
+++ b/gnuradio-core/src/lib/gengen/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
#
@@ -29,7 +29,7 @@ noinst_LTLIBRARIES = libgengen.la
# ----------------------------------------------------------------
# these scripts generate code
-CODE_GENERATOR = \
+core_generator = \
generate_all.py \
generate_common.py \
gr_add_XX.cc.t \
@@ -117,46 +117,33 @@ CODE_GENERATOR = \
gr_moving_average_XX.h.t \
gr_moving_average_XX.i.t
-include Makefile.gen
+# include the srcdir's Makefile.gen; doing this creates an implicit
+# dependency between $(srcdir)/Makefile.in and $(srcdir)/Makefile.gen.
+include $(srcdir)/Makefile.gen
-# Ensure parallel make does the right thing.
-# http://sources.redhat.com/automake/automake.html#Multiple-Outputs
+# Source built by Python into $(builddir)
+python_built_sources = \
+ $(GENERATED_H) \
+ $(GENERATED_I) \
+ $(GENERATED_CC) \
+ gengen_generated.i
-STAMPS = generate-stamp
+BUILT_SOURCES = $(python_built_sources)
-generate-stamp: $(CODE_GENERATOR)
- @rm -f generate-tmp
- @touch generate-tmp
- PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python srcdir=$(srcdir) $(PYTHON) $(srcdir)/generate_all.py
- @mv -f generate-tmp $@
+# Required when including Makefile.gen.gen
+STAMPS =
+gen_sources = $(BUILT_SOURCES)
+gen_sources_deps = $(core_generator)
+MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc
-$(GENERATED_H) $(GENERATED_I) $(GENERATED_CC) gengen_generated.i : 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
-
-
-BUILT_SOURCES = $(GENERATED_H) $(GENERATED_I) $(GENERATED_CC)
+# common way for generating sources from templates, using the above parameters
+include $(top_srcdir)/Makefile.gen.gen
# ----------------------------------------------------------------
EXTRA_DIST = \
- $(CODE_GENERATOR) \
- $(STAMPS)
+ $(core_generator)
libgengen_la_SOURCES = \
$(GENERATED_CC)
@@ -177,4 +164,4 @@ swiginclude_HEADERS = \
gengen.i \
gengen_generated.i
-CLEANFILES = $(BUILT_SOURCES) $(STAMPS) *.pyc
+CLEANFILES = $(BUILT_SOURCES) *.pyc
diff --git a/gnuradio-core/src/python/build_utils.py b/gnuradio-core/src/python/build_utils.py
index f1c533a23..c7acf6bd0 100644
--- a/gnuradio-core/src/python/build_utils.py
+++ b/gnuradio-core/src/python/build_utils.py
@@ -1,5 +1,5 @@
#
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright 2004,2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -33,6 +33,23 @@ except KeyError, e:
srcdir = "."
srcdir = srcdir + '/'
+# set do_makefile to either true or false dependeing on the environment
+try:
+ if os.environ['do_makefile'] == '0':
+ do_makefile = False
+ else:
+ do_makefile = True
+except KeyError, e:
+ do_makefile = False
+
+# set do_sources to either true or false dependeing on the environment
+try:
+ if os.environ['do_sources'] == '0':
+ do_sources = False
+ else:
+ do_sources = True
+except KeyError, e:
+ do_sources = True
name_dict = {}
@@ -44,28 +61,39 @@ def log_output_name (name):
entry.append (name)
def open_and_log_name (name, dir):
- f = open (name, dir)
+ global do_sources
+ if do_sources:
+ f = open (name, dir)
+ else:
+ f = None
log_output_name (name)
return f
def expand_template (d, template_filename, extra = ""):
'''Given a dictionary D and a TEMPLATE_FILENAME, expand template into output file
'''
+ global do_sources
output_extension = extract_extension (template_filename)
template = open_src (template_filename, 'r')
output_name = d['NAME'] + extra + '.' + output_extension
log_output_name (output_name)
- output = open (output_name, 'w')
- do_substitution (d, template, output)
+ if do_sources:
+ output = open (output_name, 'w')
+ do_substitution (d, template, output)
+ output.close ()
template.close ()
- output.close ()
def output_glue (dirname):
output_makefile_fragment ()
output_ifile_include (dirname)
-
+
def output_makefile_fragment ():
- f = open ('Makefile.gen', 'w')
+ global do_makefile
+ if not do_makefile:
+ return
+# overwrite the source, which must be writable; this should have been
+# checked for beforehand in the top-level Makefile.gen.gen .
+ f = open_src ('Makefile.gen', 'w')
f.write ('#\n# This file is machine generated. All edits will be overwritten\n#\n')
output_subfrag (f, 'h')
output_subfrag (f, 'i')
@@ -73,16 +101,18 @@ def output_makefile_fragment ():
f.close ()
def output_ifile_include (dirname):
- f = open ('%s_generated.i' % (dirname,), 'w')
- f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n')
- files = name_dict.setdefault ('i', [])
- files.sort ()
- f.write ('%{\n')
- for file in files:
- f.write ('#include <%s>\n' % (file[0:-1] + 'h',))
- f.write ('%}\n\n')
- for file in files:
- f.write ('%%include <%s>\n' % (file,))
+ global do_sources
+ if do_sources:
+ f = open ('%s_generated.i' % (dirname,), 'w')
+ f.write ('//\n// This file is machine generated. All edits will be overwritten\n//\n')
+ files = name_dict.setdefault ('i', [])
+ files.sort ()
+ f.write ('%{\n')
+ for file in files:
+ f.write ('#include <%s>\n' % (file[0:-1] + 'h',))
+ f.write ('%}\n\n')
+ for file in files:
+ f.write ('%%include <%s>\n' % (file,))
def output_subfrag (f, ext):
files = name_dict.setdefault (ext, [])
@@ -91,7 +121,6 @@ def output_subfrag (f, ext):
for file in files:
f.write (" \\\n\t%s" % (file,))
f.write ("\n\n")
-
def extract_extension (template_name):
# template name is something like: GrFIRfilterXXX.h.t