summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-13 09:44:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:23:00 -0500
commitdd0816dcc8482829009928e5d0dc95ec0621e833 (patch)
tree4b407628214d96d9c6f29e518519a261ac54ffd3
parentbca5b59fdf1512f3acc73cacf11d1d0ba1e34f53 (diff)
downloadsamba-dd0816dcc8482829009928e5d0dc95ec0621e833.tar.gz
samba-dd0816dcc8482829009928e5d0dc95ec0621e833.tar.bz2
samba-dd0816dcc8482829009928e5d0dc95ec0621e833.zip
r8416: added the extra_cflags.txt system from smb-build
this removes the need for recursive make for heimdal, which is a big win. It should also make it easier/cleaner to build ldb/tdb/appweb etc in both in-tree and out-of-tree forms by allowing us to specify different CFLAGS (and thus different include paths) per directory or file (This used to be commit b2f9b8aa32426198aa21a703ab4f1d59fb77e512)
-rw-r--r--source4/build/smb_build/config_mk.pm1
-rw-r--r--source4/build/smb_build/makefile.pm6
-rw-r--r--source4/extra_cflags.txt1
-rw-r--r--source4/heimdal_build/config.mk5
-rwxr-xr-xsource4/script/cflags.sh28
5 files changed, 30 insertions, 11 deletions
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index 2194e3d596..0ac45cfefa 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -24,7 +24,6 @@ my %attribute_types = (
"MINOR_VERSION" => "string",
"RELEASE_VERSION" => "string",
"ENABLE" => "bool",
- "TARGET_CFLAGS" => "list",
"CMD" => "string",
"MANPAGE" => "string"
);
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 2f15274a14..337b3ae907 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -234,7 +234,7 @@ sub _prepare_std_CC_rule($$$$$)
# $comment
.$src.$dst:
\@echo $message \$\*.$src
- \@\$(CC) \$(TARGET_CFLAGS) \$(CFLAGS) $flags -c \$< -o \$\@
+ \@\$(CC) `script/cflags.sh \$\@` \$(CFLAGS) $flags -c \$< -o \$\@
\@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
__EOD__
@@ -402,10 +402,6 @@ sub _prepare_objlist_rule($)
$output .= "$ctx->{TARGET}: ";
- if (defined ($ctx->{TARGET_CFLAGS})) {
- $output .= "\n\t@\$(MAKE) TARGET_CFLAGS=\"" . join(' ', @{$ctx->{TARGET_CFLAGS}}) . "\" ";
- }
-
$output .= "\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
$output .= "\t\@touch $ctx->{TARGET}\n";
diff --git a/source4/extra_cflags.txt b/source4/extra_cflags.txt
new file mode 100644
index 0000000000..a2dbd55403
--- /dev/null
+++ b/source4/extra_cflags.txt
@@ -0,0 +1 @@
+heimdal -Iheimdal_build -Iheimdal/kdc -Iheimdal/lib/des -Iheimdal/lib/roken -Iheimdal/include
diff --git a/source4/heimdal_build/config.mk b/source4/heimdal_build/config.mk
index c0fe33bf9e..1017a5df44 100644
--- a/source4/heimdal_build/config.mk
+++ b/source4/heimdal_build/config.mk
@@ -1,7 +1,6 @@
#######################
# Start SUBSYSTEM HEIMDAL_KDC
[SUBSYSTEM::HEIMDAL_KDC]
-TARGET_CFLAGS = -Iheimdal_build -Iheimdal/kdc -Iheimdal/lib/des -Iheimdal/lib/roken -Iheimdal/include
ADD_OBJ_FILES = \
heimdal/kdc/default_config.o \
heimdal/kdc/kerberos5.o \
@@ -19,7 +18,6 @@ NOPROTO = YES
#######################
# Start SUBSYSTEM HEIMDAL_HDB
[SUBSYSTEM::HEIMDAL_HDB]
-TARGET_CFLAGS = -Iheimdal_build -Iheimdal/kdc -Iheimdal/lib/des -Iheimdal/lib/roken -Iheimdal/include
ADD_OBJ_FILES = \
heimdal/lib/hdb/db.o \
heimdal/lib/hdb/hdb.o \
@@ -327,7 +325,6 @@ ADD_OBJ_FILES = \
heimdal/lib/roken/setprogname.o \
heimdal/lib/asn1/symbol.o
REQUIRED_SUBSYSTEMS = HEIMDAL_ROKEN
-TARGET_CFLAGS = -Iheimdal_build -Iheimdal/lib/roken
NOPROTO = YES
# End SUBSYSTEM ASN1_COMPILER
#######################
@@ -353,7 +350,6 @@ ADD_OBJ_FILES = \
heimdal/lib/roken/strupr.o \
heimdal/lib/roken/print_version.o \
heimdal/lib/roken/setprogname.o
-TARGET_CFLAGS = -Iheimdal_build -Iheimdal/lib/roken
NOPROTO = YES
# End SUBSYSTEM COMPILE_ET
#######################
@@ -379,7 +375,6 @@ REQUIRED_SUBSYSTEMS = ASN1_COMPILER
# Start SUBSYSTEM HEIMDAL
[SUBSYSTEM::HEIMDAL]
NOPROTO = YES
-TARGET_CFLAGS = -Iheimdal_build -Iheimdal/kdc -Iheimdal/lib/des -Iheimdal/lib/roken -Iheimdal/include
REQUIRED_SUBSYSTEMS = \
HEIMDAL_GSSAPI HEIMDAL_KRB5 \
HEIMDAL_ASN1 HEIMDAL_DES HEIMDAL_ROKEN HEIMDAL_COM_ERR HEIMDAL_GLUE
diff --git a/source4/script/cflags.sh b/source4/script/cflags.sh
new file mode 100755
index 0000000000..b2ee8b3761
--- /dev/null
+++ b/source4/script/cflags.sh
@@ -0,0 +1,28 @@
+#!/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@samba.org, July 2005
+
+TARGET=$1
+
+check_flags()
+{
+ NAME=$1
+ (
+ while read tag flags; do
+ if [ "$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;