Author: tridge
Date: 2005-07-13 06:59:52 +0000 (Wed, 13 Jul 2005)
New Revision: 10

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=smb-build&rev=10

Log:
another attempt at a portable target dependent CFLAGS

this one looks for the most specific .cflags file in the target directory

so for lib/replace/replace.o it look for:

  lib/replace/.cflags
  lib/.cflags

and if it finds it, then it gets added to the compile command

Added:
   trunk/lib/.cflags
   trunk/script/cflags.sh
Modified:
   trunk/build/smb_build/makefile.pm


Changeset:
Modified: trunk/build/smb_build/makefile.pm
===================================================================
--- trunk/build/smb_build/makefile.pm   2005-07-13 06:42:06 UTC (rev 9)
+++ trunk/build/smb_build/makefile.pm   2005-07-13 06:59:52 UTC (rev 10)
@@ -202,7 +202,7 @@
 # $comment
 .$src.$dst:
        [EMAIL PROTECTED] $message \$\*.$src
-       [EMAIL PROTECTED](CC) \$(TARGET_CFLAGS) \$([EMAIL PROTECTED]) 
\$(CFLAGS) $flags -c \$< -o \$\@
+       \$(CC) \$(TARGET_CFLAGS) \$(shell script/cflags.sh \$\@) \$(CFLAGS) 
$flags -c \$< -o \$\@
 [EMAIL PROTECTED]@     -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
 
 __EOD__

Added: trunk/lib/.cflags
===================================================================
--- trunk/lib/.cflags   2005-07-13 06:42:06 UTC (rev 9)
+++ trunk/lib/.cflags   2005-07-13 06:59:52 UTC (rev 10)
@@ -0,0 +1 @@
+-Ifoo

Added: trunk/script/cflags.sh
===================================================================
--- trunk/script/cflags.sh      2005-07-13 06:42:06 UTC (rev 9)
+++ trunk/script/cflags.sh      2005-07-13 06:59:52 UTC (rev 10)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+TARGET=$1
+
+DIR=`dirname $TARGET`
+while [ "$DIR" != "." ]; do
+    if [ -r $DIR/.cflags ]; then
+       cat $DIR/.cflags
+       exit 0
+    fi
+    DIR=`dirname $DIR`
+done
+exit 0;


Property changes on: trunk/script/cflags.sh
___________________________________________________________________
Name: svn:executable
   + *

Reply via email to