commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10466 - in gnuradio/branches/developers/michaelld/fix


From: michaelld
Subject: [Commit-gnuradio] r10466 - in gnuradio/branches/developers/michaelld/fix_makefile_gen: . gnuradio-core/src/lib/filter gnuradio-core/src/python
Date: Wed, 18 Feb 2009 20:12:44 -0700 (MST)

Author: michaelld
Date: 2009-02-18 20:12:42 -0700 (Wed, 18 Feb 2009)
New Revision: 10466

Modified:
   gnuradio/branches/developers/michaelld/fix_makefile_gen/Makefile.gen.gen
   
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py
   
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py
   
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_util.py
   
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/python/build_utils.py
Log:
Changed Python functions to return None and check for that return
value correctly (instead of -1).  Changed Makefile.gen regeneration to
happen only if the $(srcdir) and/or Makefile.gen is writable.  Added
rule for automatic regeneration of the $(srcdir)/Makefile.gen if it is
deleted.  Passes check on OSX and Ubuntu.



Modified: 
gnuradio/branches/developers/michaelld/fix_makefile_gen/Makefile.gen.gen
===================================================================
--- gnuradio/branches/developers/michaelld/fix_makefile_gen/Makefile.gen.gen    
2009-02-19 01:31:05 UTC (rev 10465)
+++ gnuradio/branches/developers/michaelld/fix_makefile_gen/Makefile.gen.gen    
2009-02-19 03:12:42 UTC (rev 10466)
@@ -54,14 +54,35 @@
 
 STAMPS += $(DEPDIR)/generate-makefile-generate-*
 
-generate-makefile:
+generate-makefile $(srcdir)/Makefile.gen:
 ## parallel make protection; can't hurt
-       trap 'rm -rf $(DEPDIR)/address@hidden' 1 2 13 15; \
-       if mkdir $(DEPDIR)/address@hidden 2>/dev/null; then \
+       @trap 'rm -rf $(DEPDIR)/Makefile.gen-generate-*' 1 2 13 15; \
+       if mkdir $(DEPDIR)/Makefile.gen-generate-lock 2>/dev/null; then \
 ## This code is being executed by the first process.
-               rm -f $(DEPDIR)/address@hidden; \
-               $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/address@hidden; \
-               rmdir $(DEPDIR)/address@hidden; \
+               rm -f $(DEPDIR)/Makefile.gen-generate-stamp; \
+               rm -f $(DEPDIR)/Makefile.gen-generate-tmp; \
+               touch $(DEPDIR)/Makefile.gen-generate-tmp; \
+## recreate $(srcdir)/Makefile.gen only if ...
+               do_recreate=0; \
+               if test -f $(srcdir)/Makefile.gen; then \
+## the file exists and can be removed; or ...
+                       if $(RM) $(srcdir)/Makefile.gen 2>/dev/null; then \
+                               do_recreate=1; \
+                       fi; \
+               else \
+## the file doesn't exist, but can be created (e.g., by touching it).
+                       if touch $(srcdir)/Makefile.gen 2>/dev/null; then \
+                               do_recreate=1; \
+                       fi; \
+               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; \
+               else \
+                       echo "Cannot recreate $(srcdir)/Makefile.gen because 
the directory or file is write-protected."; \
+               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.
@@ -70,12 +91,7 @@
                test -f $(DEPDIR)/address@hidden; exit $$?; \
        fi;
 
-$(DEPDIR)/generate-makefile-generate-stamp:
-       @rm -f $(DEPDIR)/Makefile.gen-generate-tmp
-       @touch $(DEPDIR)/Makefile.gen-generate-tmp
-               PYTHONPATH=$(top_srcdir)/gnuradio-core/src/python 
srcdir=$(srcdir) do_makefile=1 do_sources=0 $(PYTHON) $(srcdir)/generate_all.py
-       @mv -f $(DEPDIR)/Makefile.gen-generate-tmp $@
-
 ## ----------------------------------------------------------------
 
-MOSTLYCLEANFILES += $(STAMPS) Makefile.gen
+MOSTLYCLEANFILES += $(STAMPS)
+

Modified: 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py
===================================================================
--- 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py
   2009-02-19 01:31:05 UTC (rev 10465)
+++ 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig.py
   2009-02-19 03:12:42 UTC (rev 10466)
@@ -28,7 +28,7 @@
 
 def make_gr_fir_sysconfig_h ():
     out = open_and_log_name ('gr_fir_sysconfig.h', 'w')
-    if out == -1:
+    if not out:
         return
 
     out.write (copyright)
@@ -99,7 +99,7 @@
 
 def make_gr_fir_sysconfig_cc ():
     out = open_and_log_name ('gr_fir_sysconfig.cc', 'w')
-    if out == -1:
+    if not out:
         return
 
     out.write (copyright)

Modified: 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py
===================================================================
--- 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py
   2009-02-19 01:31:05 UTC (rev 10465)
+++ 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_sysconfig_generic.py
   2009-02-19 03:12:42 UTC (rev 10466)
@@ -28,7 +28,7 @@
 
 def make_gr_fir_sysconfig_generic_h ():
     out = open_and_log_name ('gr_fir_sysconfig_generic.h', 'w')
-    if out == -1:
+    if not out:
         return
     out.write (copyright)
 
@@ -112,7 +112,7 @@
 
 def make_gr_fir_sysconfig_generic_cc ():
     out = open_and_log_name ('gr_fir_sysconfig_generic.cc', 'w')
-    if out == -1:
+    if not out:
         return
     out.write (copyright)
 

Modified: 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_util.py
===================================================================
--- 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_util.py
        2009-02-19 01:31:05 UTC (rev 10465)
+++ 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/lib/filter/generate_gr_fir_util.py
        2009-02-19 03:12:42 UTC (rev 10466)
@@ -44,7 +44,7 @@
 
 def make_gr_fir_util_h ():
     out = open_and_log_name ('gr_fir_util.h', 'w')
-    if out == -1:
+    if not out:
         return
     out.write (copyright)
 
@@ -144,7 +144,7 @@
     
 def make_gr_fir_util_cc ():
     out = open_and_log_name ('gr_fir_util.cc', 'w')
-    if out == -1:
+    if not out:
         return
     out.write (copyright)
     out.write ('''

Modified: 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/python/build_utils.py
===================================================================
--- 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/python/build_utils.py
     2009-02-19 01:31:05 UTC (rev 10465)
+++ 
gnuradio/branches/developers/michaelld/fix_makefile_gen/gnuradio-core/src/python/build_utils.py
     2009-02-19 03:12:42 UTC (rev 10466)
@@ -65,7 +65,7 @@
     if do_sources:
         f = open (name, dir)
     else:
-        f = -1
+        f = None
     log_output_name (name)
     return f
 
@@ -89,13 +89,16 @@
 
 def output_makefile_fragment ():
     global do_makefile
-    if do_makefile:
-        f = open ('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')
-        output_subfrag (f, 'cc')
-        f.close ()
+    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')
+    output_subfrag (f, 'cc')
+    f.close ()
 
 def output_ifile_include (dirname):
     global do_sources





reply via email to

[Prev in Thread] Current Thread [Next in Thread]