diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-07-28 14:37:54 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:30:10 -0500 |
commit | 726681d158704f941b71fe4787ac9f1a610328c5 (patch) | |
tree | dcabe2451fa3df56c3f9c34e321d7baaf33262d7 | |
parent | 7c948bb2a358620df1efe8ee55ff434fcb081280 (diff) | |
download | samba-726681d158704f941b71fe4787ac9f1a610328c5.tar.gz samba-726681d158704f941b71fe4787ac9f1a610328c5.tar.bz2 samba-726681d158704f941b71fe4787ac9f1a610328c5.zip |
r8832: Automatically rebuilding C files if headers change (in developer mode)
(This used to be commit bb02e1dccb058e31cf33aaac954708276090a9ec)
-rw-r--r-- | source4/build/m4/check_path.m4 | 1 | ||||
-rw-r--r-- | source4/build/smb_build/makefile.pm | 33 | ||||
-rw-r--r-- | source4/heimdal_build/config.m4 | 2 |
3 files changed, 34 insertions, 2 deletions
diff --git a/source4/build/m4/check_path.m4 b/source4/build/m4/check_path.m4 index 55f04dee9a..d96e2e8130 100644 --- a/source4/build/m4/check_path.m4 +++ b/source4/build/m4/check_path.m4 @@ -146,6 +146,7 @@ AC_ARG_WITH(selftest-prefix, esac]) developer=no +AC_SUBST(developer) AC_ARG_ENABLE(developer, [ --enable-developer Turn on developer warnings and debugging (default=no)], [if test x$enable_developer = xyes; then debug=yes diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 0d0c851776..01d2de770a 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -7,6 +7,7 @@ ########################################################### package makefile; +use config qw(%config); use strict; sub _prepare_command_interpreters($) @@ -118,7 +119,7 @@ sub _prepare_SUFFIXES($) $output = << '__EOD__'; .SUFFIXES: -.SUFFIXES: .c .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml +.SUFFIXES: .c .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml __EOD__ @@ -212,6 +213,16 @@ dynconfig.o: dynconfig.c Makefile __EOD__ } +sub _prepare_depend_CC_rule() +{ + return << '__EOD__'; +.c.d: + @echo "Generating dependencies for $<" + @$(CC) -MM -MG -MT $(<:.c=.o) -MF $@ $(CFLAGS) $< + +__EOD__ +} + ########################################################### # This function creates a standard make rule which is using $(CC) # @@ -561,6 +572,13 @@ distclean: clean -rm -f config.log config.cache -rm -f samba4-deps.dot -rm -f lib/registry/winregistry.pc +__EOD__ + + if ($config{developer} eq "yes") { + $output .= "\t@-rm -f \$(_ALL_OBJS_OBJS:.o=.d)\n"; + } + + $output .= << '__EOD__'; removebackup: -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~ @@ -821,6 +839,8 @@ sub _prepare_makefile_in($) $output .= _prepare_std_CC_rule("c","o",'@PICFLAG@',"Compiling","Rule for std objectfiles"); $output .= _prepare_std_CC_rule("h","h.gch",'@PICFLAG@',"Precompiling","Rule for precompiled headerfiles"); + $output .= _prepare_depend_CC_rule(); + $output .= _prepare_man_rule("1"); $output .= _prepare_man_rule("3"); $output .= _prepare_man_rule("5"); @@ -837,6 +857,16 @@ sub _prepare_makefile_in($) $output .= _prepare_make_target({ TARGET => "all", DEPEND_LIST => \@all }); + if ($config{developer} eq "yes") { + $output .= <<__EOD__ +-include \$(_ALL_OBJS_OBJS:.o=.d) +IDL_FILES = \$(wildcard librpc/idl/*.idl) +\$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.c,\$(IDL_FILES)) \\ +\$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_\%_c.c,\$(IDL_FILES)) \\ +\$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.h,\$(IDL_FILES)): idl +__EOD__ + } + return $output; } @@ -862,3 +892,4 @@ sub create_makefile_in($$) } 1; + diff --git a/source4/heimdal_build/config.m4 b/source4/heimdal_build/config.m4 index 7f083e9314..fa79849750 100644 --- a/source4/heimdal_build/config.m4 +++ b/source4/heimdal_build/config.m4 @@ -192,7 +192,7 @@ AC_CHECK_TYPES(u_int8_t) # of the samba source tree if test -d heimdal; then AC_DEFINE(HAVE_KRB5,1,[Whether kerberos is available]) - CFLAGS="${CFLAGS} -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/gssapi -Iheimdal/lib/asn1 -Iheimdal/lib/com_err -Iheimdal/lib/hdb -Iheimdal/kdc" + CFLAGS="${CFLAGS} -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/gssapi -Iheimdal/lib/asn1 -Iheimdal/lib/com_err -Iheimdal/lib/hdb -Iheimdal/kdc -Iheimdal/lib/roken -Iheimdal/lib/des" HAVE_KRB5=YES SMB_SUBSYSTEM_ENABLE(KERBEROS_LIB, YES) SMB_BINARY_ENABLE(asn1_compile, YES) |