svn commit: samba r13867 - in branches/SAMBA_4_0/source: . build/smb_build heimdal_build script

jelmer at samba.org jelmer at samba.org
Mon Mar 6 15:34:30 GMT 2006


Author: jelmer
Date: 2006-03-06 15:34:29 +0000 (Mon, 06 Mar 2006)
New Revision: 13867

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

Log:
Wrap the cflags.sh hack in the build system. You can now simply 
set subsystem-specific compiler flags in the .mk files.

Added:
   branches/SAMBA_4_0/source/build/smb_build/cflags.pm
   branches/SAMBA_4_0/source/script/cflags.pl
Removed:
   branches/SAMBA_4_0/source/extra_cflags.txt
   branches/SAMBA_4_0/source/script/cflags.sh
Modified:
   branches/SAMBA_4_0/source/
   branches/SAMBA_4_0/source/build/smb_build/README.txt
   branches/SAMBA_4_0/source/build/smb_build/config_mk.pm
   branches/SAMBA_4_0/source/build/smb_build/main.pl
   branches/SAMBA_4_0/source/build/smb_build/makefile.pm
   branches/SAMBA_4_0/source/heimdal_build/config.mk


Changeset:

Property changes on: branches/SAMBA_4_0/source
___________________________________________________________________
Name: svn:ignore
   - .sconsign
st
ID
*.d
Makefile
dox
typescript*
configure
TAGS
tags
*.*

   + .sconsign
st
ID
*.d
Makefile
dox
typescript*
configure
TAGS
tags
*.*
extra_cflags.txt


Modified: branches/SAMBA_4_0/source/build/smb_build/README.txt
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/README.txt	2006-03-06 15:33:25 UTC (rev 13866)
+++ branches/SAMBA_4_0/source/build/smb_build/README.txt	2006-03-06 15:34:29 UTC (rev 13867)
@@ -50,7 +50,8 @@
 main.pm - Main
 makefile.pm - Makefile generation
 output.pm - Dependency calculation
-smb_build_h.pm - smb_build.h generation
+header.pm - build.h generation
+cflags.pm - Generates cflags.txt for file-specific cflags
 
 Layout
 -------

Added: branches/SAMBA_4_0/source/build/smb_build/cflags.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/cflags.pm	2006-03-06 15:33:25 UTC (rev 13866)
+++ branches/SAMBA_4_0/source/build/smb_build/cflags.pm	2006-03-06 15:34:29 UTC (rev 13867)
@@ -0,0 +1,27 @@
+# SMB Build System
+#
+#  Copyright (C) Jelmer Vernooij 2006
+#  Released under the GNU GPL
+
+package cflags;
+use strict;
+
+sub create_cflags($$)
+{
+	my ($CTX, $file) = @_;
+
+	open(CFLAGS_TXT,">$file") || die ("Can't open `$file'\n");
+
+	foreach my $key (values %{$CTX}) {
+		next unless defined ($key->{OBJ_LIST});
+		next unless defined ($key->{EXTRA_CFLAGS});
+
+		foreach (@{$key->{OBJ_LIST}}) {
+			print CFLAGS_TXT "$_: $key->{EXTRA_CFLAGS}\n";
+		}
+	}
+	close(CFLAGS_TXT);
+
+	print __FILE__.": creating $file\n";
+}
+1;


Property changes on: branches/SAMBA_4_0/source/build/smb_build/cflags.pm
___________________________________________________________________
Name: svn:executable
   + *

Modified: branches/SAMBA_4_0/source/build/smb_build/config_mk.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/config_mk.pm	2006-03-06 15:33:25 UTC (rev 13866)
+++ branches/SAMBA_4_0/source/build/smb_build/config_mk.pm	2006-03-06 15:34:29 UTC (rev 13867)
@@ -33,6 +33,8 @@
 		"PRIVATE_PROTO_HEADER"	=> "string",
 
 		"PUBLIC_HEADERS"	=> "list",
+
+		"EXTRA_CFLAGS"		=> "string",
 		},
 	"MODULE" => {
 		"SUBSYSTEM"		=> "string",
@@ -48,7 +50,9 @@
 		"OUTPUT_TYPE" => "string",
 
 		"MANPAGE"		=> "string",
-		"PRIVATE_PROTO_HEADER"	=> "string"
+		"PRIVATE_PROTO_HEADER"	=> "string",
+
+		"EXTRA_CFLAGS"		=> "string"
 		},
 	"BINARY" => {
 		"OBJ_FILES"		=> "list",
@@ -61,7 +65,9 @@
 		"MANPAGE"		=> "string",
 		"INSTALLDIR"		=> "string",
 		"PRIVATE_PROTO_HEADER"	=> "string",
-		"PUBLIC_HEADERS" => "string"
+		"PUBLIC_HEADERS" => "string", 
+
+		"EXTRA_CFLAGS"		=> "string"
 		},
 	"LIBRARY" => {
 		"MAJOR_VERSION"		=> "string",
@@ -84,7 +90,9 @@
 		"PUBLIC_HEADERS"	=> "list",
 
 		"PUBLIC_PROTO_HEADER"	=> "string",
-		"PRIVATE_PROTO_HEADER"	=> "string"
+		"PRIVATE_PROTO_HEADER"	=> "string",
+
+		"EXTRA_CFLAGS"		=> "string"
 		}
 };
 

Modified: branches/SAMBA_4_0/source/build/smb_build/main.pl
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/main.pl	2006-03-06 15:33:25 UTC (rev 13866)
+++ branches/SAMBA_4_0/source/build/smb_build/main.pl	2006-03-06 15:34:29 UTC (rev 13867)
@@ -11,6 +11,7 @@
 use smb_build::config_mk;
 use smb_build::output;
 use smb_build::env;
+use smb_build::cflags;
 use config;
 use strict;
 
@@ -81,4 +82,6 @@
 $mkenv->write("Makefile");
 header::create_smb_build_h($OUTPUT, "include/build.h");
 
+cflags::create_cflags($OUTPUT, "extra_cflags.txt");
+
 1;

Modified: branches/SAMBA_4_0/source/build/smb_build/makefile.pm
===================================================================
--- branches/SAMBA_4_0/source/build/smb_build/makefile.pm	2006-03-06 15:33:25 UTC (rev 13866)
+++ branches/SAMBA_4_0/source/build/smb_build/makefile.pm	2006-03-06 15:34:29 UTC (rev 13867)
@@ -186,7 +186,7 @@
 # $comment
 .$src.$dst:
 	\@echo $message \$\*.$src
-	\@\$(CC) `script/cflags.sh \$\@` \$(CFLAGS) $flags -c \$\*.$src -o \$\@
+	\@\$(CC) `script/cflags.pl \$\@` \$(CFLAGS) $flags -c \$\*.$src -o \$\@
 __EOD__
 );
 	if ($self->{config}->{BROKEN_CC} eq "yes") {
@@ -204,7 +204,7 @@
 	$self->output(<< "__EOD__"
 .c.ho:
 	\@echo Compiling \$\*.c with host compiler
-	\@\$(HOSTCC) `script/cflags.sh \$\@` \$(CFLAGS) -c \$\*.c -o \$\@
+	\@\$(HOSTCC) `script/cflags.pl \$\@` \$(CFLAGS) -c \$\*.c -o \$\@
 __EOD__
 );
 	if ($self->{config}->{BROKEN_CC} eq "yes") {

Deleted: branches/SAMBA_4_0/source/extra_cflags.txt
===================================================================
--- branches/SAMBA_4_0/source/extra_cflags.txt	2006-03-06 15:33:25 UTC (rev 13866)
+++ branches/SAMBA_4_0/source/extra_cflags.txt	2006-03-06 15:34:29 UTC (rev 13867)
@@ -1,4 +0,0 @@
-heimdal -Iheimdal_build -Iheimdal/kdc -Iheimdal/lib/des -Iheimdal/lib/roken  -DNO_PRINTF_ATTRIBUTE
-heimdal/lib/com_err -Iheimdal_build -Iheimdal/lib/com_err -Iheimdal/kdc -Iheimdal/lib/des -Iheimdal/lib/roken -DNO_PRINTF_ATTRIBUTE
-heimdal/lib/asn1 -Iheimdal_build -Iheimdal/lib/asn1 -Iheimdal/kdc -Iheimdal/lib/des -Iheimdal/lib/roken -DNO_PRINTF_ATTRIBUTE
-heimdal_build/replace.o -Iheimdal_build -Iheimdal/lib/roken

Modified: branches/SAMBA_4_0/source/heimdal_build/config.mk
===================================================================
--- branches/SAMBA_4_0/source/heimdal_build/config.mk	2006-03-06 15:33:25 UTC (rev 13866)
+++ branches/SAMBA_4_0/source/heimdal_build/config.mk	2006-03-06 15:34:29 UTC (rev 13867)
@@ -186,6 +186,9 @@
 #######################
 # Start SUBSYSTEM HEIMDAL_ASN1
 [SUBSYSTEM::HEIMDAL_ASN1]
+EXTRA_CFLAGS = -Iheimdal_build -Iheimdal/lib/asn1 \
+			   -Iheimdal/kdc -Iheimdal/lib/des \
+			   -Iheimdal/lib/roken -DNO_PRINTF_ATTRIBUTE
 OBJ_FILES = \
 	../heimdal/lib/asn1/der_get.o \
 	../heimdal/lib/asn1/der_put.o \
@@ -261,6 +264,9 @@
 #######################
 # Start SUBSYSTEM HEIMDAL_DES
 [SUBSYSTEM::HEIMDAL_DES]
+EXTRA_CFLAGS = -Iheimdal_build -Iheimdal/kdc \
+			   -Iheimdal/lib/des -Iheimdal/lib/roken \
+			   -DNO_PRINTF_ATTRIBUTE
 OBJ_FILES = \
 	../heimdal/lib/des/aes.o \
 	../heimdal/lib/des/des.o \
@@ -304,6 +310,8 @@
 #######################
 # Start SUBSYSTEM HEIMDAL_ROKEN
 [SUBSYSTEM::HEIMDAL_ROKEN]
+EXTRA_CFLAGS = -Iheimdal_build -Iheimdal/kdc \
+			   -Iheimdal/lib/des -Iheimdal/lib/roken -DNO_PRINTF_ATTRIBUTE
 OBJ_FILES = \
 	../heimdal/lib/roken/base64.o \
 	../heimdal/lib/roken/bswap.o \
@@ -336,6 +344,9 @@
 #######################
 # Start SUBSYSTEM HEIMDAL_VERS
 [SUBSYSTEM::HEIMDAL_VERS]
+EXTRA_CFLAGS = -Iheimdal_build -Iheimdal/kdc \
+			   -Iheimdal/lib/des -Iheimdal/lib/roken \
+			   -DNO_PRINTF_ATTRIBUTE
 OBJ_FILES = ../heimdal/lib/vers/print_version.o
 NOPROTO = YES
 # End SUBSYSTEM HEIMDAL_VERS
@@ -352,6 +363,9 @@
 #######################
 # Start SUBSYSTEM HEIMDAL_COM_ERR
 [SUBSYSTEM::HEIMDAL_COM_ERR]
+EXTRA_CFLAGS = -Iheimdal_build -Iheimdal/lib/com_err \
+			   -Iheimdal/kdc -Iheimdal/lib/des \
+			   -Iheimdal/lib/roken -DNO_PRINTF_ATTRIBUTE
 OBJ_FILES = \
 	../heimdal/lib/com_err/com_err.o \
 	../heimdal/lib/com_err/error.o
@@ -362,6 +376,9 @@
 #######################
 # Start BINARY asn1_compile
 [BINARY::asn1_compile]
+EXTRA_CFLAGS = -Iheimdal_build -Iheimdal/lib/asn1 \
+			   -Iheimdal/kdc -Iheimdal/lib/des \
+			   -Iheimdal/lib/roken -DNO_PRINTF_ATTRIBUTE
 NOPROTO = YES
 OBJ_FILES = \
 	../heimdal/lib/asn1/main.ho \

Added: branches/SAMBA_4_0/source/script/cflags.pl
===================================================================
--- branches/SAMBA_4_0/source/script/cflags.pl	2006-03-06 15:33:25 UTC (rev 13866)
+++ branches/SAMBA_4_0/source/script/cflags.pl	2006-03-06 15:34:29 UTC (rev 13867)
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+# This is a hack to allow per target cflags. It isn't very elegant, but it
+# is the most portable idea we have come up with yet
+# tridge at samba.org, July 2005
+# jelmer at samba.org, March 2006
+use strict;
+use warnings;
+
+my $target = shift;
+
+sub check_flags($)
+{
+    my ($name)=@_;
+	open (IN, "extra_cflags.txt");
+    while (<IN> =~ /^([^:]+): (.*)$/) {
+		next unless ($1 eq $target);
+		print "$2 ";
+	}
+	close(IN);
+	print "\n";
+}
+
+check_flags($target);
+
+exit 0;


Property changes on: branches/SAMBA_4_0/source/script/cflags.pl
___________________________________________________________________
Name: svn:executable
   + *

Deleted: branches/SAMBA_4_0/source/script/cflags.sh
===================================================================
--- branches/SAMBA_4_0/source/script/cflags.sh	2006-03-06 15:33:25 UTC (rev 13866)
+++ branches/SAMBA_4_0/source/script/cflags.sh	2006-03-06 15:34:29 UTC (rev 13867)
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-# This is a hack to allow per target cflags. It isn't very elegant, but it
-# is the most portable idea we have come up with yet
-# tridge at samba.org, July 2005
-
-TARGET=$1
-
-check_flags()
-{
-    NAME=$1
-    (
-     while read tag flags; do
-	 if [ "$tag" = "$NAME" ] || [ "./$tag" = "$NAME" ]; then
-	     echo "$flags"
-	     exit 0;
-	 fi
-     done
-    ) < extra_cflags.txt
-}
-
-
-NAME=$TARGET
-while [ "$NAME" != "." ]; do
-    check_flags "$NAME"
-    NAME=`dirname $NAME`
-done
-exit 0;



More information about the samba-cvs mailing list