summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-03-06 15:34:29 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:52:18 -0500
commitf6457b3d5408d5afe9a4de96d7623f1aa9ec39c4 (patch)
treedaa5b29b3c2eececc2cfd83e79fce2640b81d3b4 /source4/build
parent354a61fc915da99a16732337b62920909a591b58 (diff)
downloadsamba-f6457b3d5408d5afe9a4de96d7623f1aa9ec39c4.tar.gz
samba-f6457b3d5408d5afe9a4de96d7623f1aa9ec39c4.tar.bz2
samba-f6457b3d5408d5afe9a4de96d7623f1aa9ec39c4.zip
r13867: Wrap the cflags.sh hack in the build system. You can now simply
set subsystem-specific compiler flags in the .mk files. (This used to be commit d512b147e8dda39016faf74a50a9d85bfc23a2eb)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/smb_build/README.txt3
-rwxr-xr-xsource4/build/smb_build/cflags.pm27
-rw-r--r--source4/build/smb_build/config_mk.pm14
-rw-r--r--source4/build/smb_build/main.pl3
-rw-r--r--source4/build/smb_build/makefile.pm4
5 files changed, 45 insertions, 6 deletions
diff --git a/source4/build/smb_build/README.txt b/source4/build/smb_build/README.txt
index 44aeffdad2..a5e4db99e0 100644
--- a/source4/build/smb_build/README.txt
+++ b/source4/build/smb_build/README.txt
@@ -50,7 +50,8 @@ input.pm - Input validation
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
-------
diff --git a/source4/build/smb_build/cflags.pm b/source4/build/smb_build/cflags.pm
new file mode 100755
index 0000000000..a19c0efa7b
--- /dev/null
+++ b/source4/build/smb_build/cflags.pm
@@ -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;
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index c7ff8648eb..56960f044c 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -33,6 +33,8 @@ my $section_types = {
"PRIVATE_PROTO_HEADER" => "string",
"PUBLIC_HEADERS" => "list",
+
+ "EXTRA_CFLAGS" => "string",
},
"MODULE" => {
"SUBSYSTEM" => "string",
@@ -48,7 +50,9 @@ my $section_types = {
"OUTPUT_TYPE" => "string",
"MANPAGE" => "string",
- "PRIVATE_PROTO_HEADER" => "string"
+ "PRIVATE_PROTO_HEADER" => "string",
+
+ "EXTRA_CFLAGS" => "string"
},
"BINARY" => {
"OBJ_FILES" => "list",
@@ -61,7 +65,9 @@ my $section_types = {
"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 @@ my $section_types = {
"PUBLIC_HEADERS" => "list",
"PUBLIC_PROTO_HEADER" => "string",
- "PRIVATE_PROTO_HEADER" => "string"
+ "PRIVATE_PROTO_HEADER" => "string",
+
+ "EXTRA_CFLAGS" => "string"
}
};
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index bec1be791c..a47899a3a5 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -11,6 +11,7 @@ use smb_build::input;
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 @@ foreach my $key (values %$OUTPUT) {
$mkenv->write("Makefile");
header::create_smb_build_h($OUTPUT, "include/build.h");
+cflags::create_cflags($OUTPUT, "extra_cflags.txt");
+
1;
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 4280efa949..b7c3a27383 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -186,7 +186,7 @@ sub _prepare_std_CC_rule($$$$$$)
# $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 @@ sub _prepare_hostcc_rule($)
$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") {