[Cbe-oss-dev] [patch 2/4] MARS: Build file cleanup

Geoff Levand geoffrey.levand at am.sony.com
Tue Sep 2 10:41:06 EST 2008


On 08/31/2008 09:22 PM, Kazunori Asayama wrote:
> Geoff Levand wrote:
>> On 08/24/2008 07:28 PM, Kazunori Asayama wrote:
>>> Some of these are just indentation changes. Are there any strict rules
>>> of indentation of Makefile? Otherwise, I suggest keeping the original one.
>> 
>> These replace tabs with spaces.  I know of no rules.  I'm not sure how safe
>> tabs are to use between arguments, nor what kind of processing make does on
>> these.  It sounds like it could cause portability problems though.  I know
>> tabs in makefile conditionals will not work reliably:
>> 
>> if ABC
>> 	"d=not seen!!"
>> endif
> 
> I can't understand what you're trying to show by this example...

Sorry, this tries to show some trouble I've found with automake
conditionals.  Maybe the following diffs show it better.  

When using a tab for indentation in the Makefile.am conditional,
automake will not generate a correct makefile.  When a tab is used,
the conditional extra_cppflags assignment is placed at the end of
the makefile, so it is not evaluated before the time extra_cppflags is
used for the compiler command line.

The automake docs don't have any info regarding what is allowed.

--- Makefile.am.1
+++ Makefile.am.2
@@ -43,9 +43,9 @@
  if DEBUG
- extra_cppflags += "-DDEBUG"
+	extra_cppflags += "-DDEBUG"
 else
- extra_cppflags += "-DNDEBUG"
+	extra_cppflags += "-DNDEBUG"
 endif

--- Makefile.in.1
+++ Makefile.in.2
@@ -70,8 +70,6 @@
 build_triplet = @build@
 host_triplet = @host@
- at DEBUG_TRUE@am__append_1 = "-DDEBUG"
- at DEBUG_FALSE@am__append_2 = "-DNDEBUG"
 subdir = .
@@ -240,7 +238,7 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-extra_cppflags = $(am__append_1) $(am__append_2)
+extra_cppflags = 
 extra_cflags = 
 extra_ldflags = 
@@ -758,6 +756,9 @@
 	uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS
 
 
+ at DEBUG_TRUE@	extra_cppflags += "-DDEBUG"
+ at DEBUG_FALSE@	extra_cppflags += "-DNDEBUG"
+
 mars-kernel.eo: ${MARS_KERNEL}
 	$(EMBEDSPU) $(CFLAGS) mars_kernel_entry  $< $@
  
> According to the POSIX, shell's default field separators are <space>,
> <tab> and <newline>, and field separator in Makefile rules is <blank>
> (<blank> is any of <space> and <tab>). So I suppose <tab> can be used as
> a separator.

OK, I've never had trouble using a tab as a separator, just in
indenting an assignment.

>> The extra spaces to justify the backslash could cause problems on
>> systems with limited command line length.  I think cygwin has a
>> very small limit (256 chars?), so I'll remove those.
> 
> It looks like cygwin can handle long command lines (at least, 4000+
> characters). I think we have no need to worry about that.

OK, its been a long time since I used cygwin seriously, but I
remember trouble with command line length and having to use xargs.
I guess it is now improved.

-Geoff






More information about the cbe-oss-dev mailing list