From dd0816dcc8482829009928e5d0dc95ec0621e833 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Jul 2005 09:44:55 +0000 Subject: 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) --- source4/build/smb_build/config_mk.pm | 1 - source4/build/smb_build/makefile.pm | 6 +----- source4/extra_cflags.txt | 1 + source4/heimdal_build/config.mk | 5 ----- source4/script/cflags.sh | 28 ++++++++++++++++++++++++++++ 5 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 source4/extra_cflags.txt create mode 100755 source4/script/cflags.sh 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; -- cgit