From c84cfc0ecc46ef05dc7997a128ba9486516cb112 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 19 Mar 2006 02:23:52 +0000 Subject: [PATCH] r14554: Write out header dependencies. This means all C files affected will be rebuilt when a header file is changed. It also means parallel builds work now. It will take a minute or so to generate all the dependency information, but there should be no need to rebuild that information later on, unless a file changes. This behaviour is only enabled when building in developer mode (--enable-developer) and requires a GNU make (or compatible). In all other cases, the file 'static_deps.mk' is included, which contains some basic hardcoded dependency information. (This used to be commit eb435386f015ce1d89eb6f7e7837622ebd9e1951) --- source4/build/smb_build/cflags.pm | 1 + source4/build/smb_build/makefile.pm | 9 ++---- source4/heimdal_build/config.mk | 19 ++--------- source4/lib/db_wrap.h | 2 +- source4/lib/messaging/messaging.c | 2 +- source4/lib/netif/netif.h | 2 +- source4/lib/registry/reg_backend_nt4.c | 2 +- source4/lib/registry/registry.h | 2 +- source4/lib/samba3/samba3.h | 2 +- source4/lib/tdr/tdr.h | 2 +- source4/main.mk | 44 +++++++++++--------------- source4/ntvfs/posix/pvfs_xattr.c | 2 +- source4/smbd/server.c | 2 +- source4/static_deps.mk | 35 ++++++++++++++++++++ 14 files changed, 69 insertions(+), 57 deletions(-) create mode 100644 source4/static_deps.mk diff --git a/source4/build/smb_build/cflags.pm b/source4/build/smb_build/cflags.pm index b5525173a07..299cbab0250 100755 --- a/source4/build/smb_build/cflags.pm +++ b/source4/build/smb_build/cflags.pm @@ -21,6 +21,7 @@ sub create_cflags($$) my $ofile = $_; my $dfile = $_; $dfile =~ s/\.o$/.d/; + $dfile =~ s/\.ho$/.d/; print CFLAGS_TXT "$ofile $dfile: CFLAGS+=$key->{EXTRA_CFLAGS}\n"; } } diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index aeffc79e4d4..3ac4ad53bc6 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -509,12 +509,9 @@ sub write($$) $self->output($self->{mkfile}); if ($self->{developer}) { - $self->output(<<__EOD__ - --include \$(DEP_FILES) - -__EOD__ -); + $self->output("-include \$(DEP_FILES)\n"); + } else { + $self->output("include static_deps.mk\n"); } open(MAKEFILE,">$file") || die ("Can't open $file\n"); diff --git a/source4/heimdal_build/config.mk b/source4/heimdal_build/config.mk index b18223192ba..6b10ac7096f 100644 --- a/source4/heimdal_build/config.mk +++ b/source4/heimdal_build/config.mk @@ -418,12 +418,6 @@ OBJ_FILES = ../heimdal/lib/vers/print_version.ho \ # End BINARY compile_et ####################### -heimdal/lib/roken/vis.h: heimdal/lib/roken/vis.hin - @cp heimdal/lib/roken/vis.hin heimdal/lib/roken/vis.h - -heimdal/lib/roken/err.h: heimdal/lib/roken/err.hin - @cp heimdal/lib/roken/err.hin heimdal/lib/roken/err.h - include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/hdb/hdb.asn1 hdb_asn1| include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/gssapi/spnego.asn1 spnego_asn1| include perl_path_wrapper.sh asn1_deps.pl heimdal/lib/asn1/k5.asn1 krb5_asn1 --encode-rfc1510-bit-string| @@ -434,17 +428,8 @@ include perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/heim_err.et| include perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/k524_err.et| include perl_path_wrapper.sh et_deps.pl heimdal/lib/krb5/krb5_err.et| -heimdal_basics: \ - heimdal/lib/roken/vis.h \ - heimdal/lib/roken/err.h \ - heimdal/lib/hdb/hdb_asn1.h \ - heimdal/lib/gssapi/spnego_asn1.h \ - heimdal/lib/asn1/krb5_asn1.h \ - heimdal/lib/asn1/asn1_err.h \ - heimdal/lib/hdb/hdb_err.h \ - heimdal/lib/krb5/heim_err.h \ - heimdal/lib/krb5/k524_err.h \ - heimdal/lib/krb5/krb5_err.h +./heimdal/lib/krb5/replay.c: ./heimdal/lib/roken/vis.h +./heimdal/lib/roken/vis.c: ./heimdal/lib/roken/vis.h clean:: @-rm -f heimdal/lib/roken/vis.h heimdal/lib/roken/err.h diff --git a/source4/lib/db_wrap.h b/source4/lib/db_wrap.h index cf60494b927..f54bed86130 100644 --- a/source4/lib/db_wrap.h +++ b/source4/lib/db_wrap.h @@ -33,4 +33,4 @@ struct ldb_message; struct ldb_dn; struct cli_credentials; -#include "db_wrap_proto.h" +#include "lib/db_wrap_proto.h" diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 5680060ee48..ff5127e79ad 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -30,7 +30,7 @@ #include "lib/messaging/irpc.h" #include "db_wrap.h" #include "lib/tdb/include/tdbutil.h" -#include "util/unix_privs.h" +#include "lib/util/unix_privs.h" #include "librpc/rpc/dcerpc.h" /* change the message version with any incompatible changes in the protocol */ diff --git a/source4/lib/netif/netif.h b/source4/lib/netif/netif.h index 36bc8c9b831..558fda47922 100644 --- a/source4/lib/netif/netif.h +++ b/source4/lib/netif/netif.h @@ -29,5 +29,5 @@ struct iface_struct { #define MAX_INTERFACES 128 #ifndef AUTOCONF_TEST -#include "netif/proto.h" +#include "lib/netif/proto.h" #endif diff --git a/source4/lib/registry/reg_backend_nt4.c b/source4/lib/registry/reg_backend_nt4.c index 87ae2be0705..569b1e19427 100644 --- a/source4/lib/registry/reg_backend_nt4.c +++ b/source4/lib/registry/reg_backend_nt4.c @@ -18,7 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "includes.h" -#include "registry.h" +#include "lib/registry/registry.h" #include "system/filesys.h" #include "system/time.h" #include "lib/registry/tdr_regf.h" diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h index efe22573c27..87a23db93d5 100644 --- a/source4/lib/registry/registry.h +++ b/source4/lib/registry/registry.h @@ -164,6 +164,6 @@ struct reg_diff struct reg_diff_key *keys; }; -#include "registry_proto.h" +#include "lib/registry/registry_proto.h" #endif /* _REGISTRY_H */ diff --git a/source4/lib/samba3/samba3.h b/source4/lib/samba3/samba3.h index cfe0f7904ae..c860c4eddd6 100644 --- a/source4/lib/samba3/samba3.h +++ b/source4/lib/samba3/samba3.h @@ -210,6 +210,6 @@ struct samba3 struct samba3_regdb registry; }; -#include "samba3/samba3_proto.h" +#include "lib/samba3/samba3_proto.h" #endif /* _SAMBA3_H */ diff --git a/source4/lib/tdr/tdr.h b/source4/lib/tdr/tdr.h index 4c0280d9d64..dfb52c85251 100644 --- a/source4/lib/tdr/tdr.h +++ b/source4/lib/tdr/tdr.h @@ -62,6 +62,6 @@ struct tdr_print { typedef NTSTATUS (*tdr_push_fn_t) (struct tdr_push *, const void *); typedef NTSTATUS (*tdr_pull_fn_t) (struct tdr_pull *, TALLOC_CTX *, void *); -#include "tdr/tdr_proto.h" +#include "lib/tdr/tdr_proto.h" #endif /* __TDR_H__ */ diff --git a/source4/main.mk b/source4/main.mk index 2d619cc6f1f..592d6c50e1f 100644 --- a/source4/main.mk +++ b/source4/main.mk @@ -1,4 +1,4 @@ -all: basics bin/asn1_compile bin/compile_et binaries libraries modules +all: bin/asn1_compile bin/compile_et binaries libraries modules include dynconfig.mk include heimdal_build/config.mk @@ -192,6 +192,7 @@ IDL_HEADER_FILES = $(patsubst librpc/idl/%.idl,librpc/gen_ndr/%.h,$(IDL_FILES)) IDL_NDR_HEADER_FILES = $(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.h,$(IDL_FILES)) IDL_NDR_PARSE_C_FILES = $(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.c,$(IDL_FILES)) IDL_NDR_CLIENT_C_FILES = $(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%_c.c,$(IDL_FILES)) +IDL_NDR_CLIENT_HEADER_FILES = $(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%_c.h,$(IDL_FILES)) IDL_NDR_SERVER_C_FILES = $(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%_s.c,$(IDL_FILES)) IDL_NDR_EJS_C_FILES = $(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%_ejs.c,$(IDL_FILES)) IDL_NDR_EJS_H_FILES = $(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%_ejs.h,$(IDL_FILES)) @@ -200,6 +201,7 @@ $(IDL_HEADER_FILES): idl $(IDL_NDR_HEADER_FILES): idl $(IDL_NDR_PARSE_C_FILES): idl $(IDL_NDR_CLIENT_C_FILES): idl +$(IDL_NDR_CLIENT_H_FILES): idl $(IDL_NDR_SERVER_C_FILES): idl $(IDL_NDR_EJS_C_FILES): idl $(IDL_NDR_EJS_H_FILES): idl @@ -225,32 +227,11 @@ include/config.h: @echo "You need to rerun ./autogen.sh and ./configure" @/bin/false -librpc/gen_ndr/misc.h: idl -librpc/ndr/libndr.h: librpc/ndr/libndr_proto.h librpc/gen_ndr/misc.h -librpc/rpc/dcerpc.h: librpc/rpc/dcerpc_proto.h -auth/credentials/credentials.h: auth/credentials/credentials_proto.h -libcli/nbt/libnbt.h: libcli/nbt/nbt_proto.h -lib/charset/charset.h: lib/charset/charset_proto.h - -include/includes.h: \ - include/config.h \ - lib/util/util_proto.h \ - lib/charset/charset.h \ - param/proto.h \ - libcli/util/proto.h \ - librpc/gen_ndr/misc.h - clean_pch: -rm -f include/includes.h.gch pch: clean_pch include/includes.h.gch -proto: $(PROTO_HEADERS) -basics: include/includes.h \ - proto \ - idl \ - heimdal_basics - clean:: clean_pch @echo Removing objects @-find . -name '*.o' -exec rm -f '{}' \; @@ -331,15 +312,22 @@ unused_macros: # File types ############################################################################### -.SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho +.SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho .hin .idl + +.hin.h: + @cp $< $@ .c.ho: - @echo "Compiling $*.c with host compiler" + @echo "Compiling $< with host compiler" @$(HOSTCC) `script/cflags.pl $@` $(CFLAGS) -c $*.c -o $@ .c.d: @echo "Generating dependencies for $<" - @$(CC) -MM -MG -MT $(<:.c=.o) -MF $@ $(CFLAGS) $< + @$(CC) -M -MG -MT $(<:.c=.o) `script/cflags.pl $@` $(CFLAGS) $< -o $@ + +include/includes.d: include/includes.h + @echo "Generating dependencies for $<" + @$(CC) -M -MG -MT include/includes.h.gch $(CFLAGS) $< -o $@ .c.o: @if test -n "$(CC_CHECKER)"; then \ @@ -377,3 +365,9 @@ DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpage .8.xml.8: $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $< + +DEP_FILES = $(patsubst %.ho,%.d,$(patsubst %.o,%.d,$(ALL_OBJS))) \ + include/includes.d + +clean-deps: + rm -f $(DEPFILES) diff --git a/source4/ntvfs/posix/pvfs_xattr.c b/source4/ntvfs/posix/pvfs_xattr.c index cf38d3c1cb8..09f1c9fdc8d 100644 --- a/source4/ntvfs/posix/pvfs_xattr.c +++ b/source4/ntvfs/posix/pvfs_xattr.c @@ -22,7 +22,7 @@ #include "includes.h" #include "vfs_posix.h" -#include "util/unix_privs.h" +#include "lib/util/unix_privs.h" #include "librpc/gen_ndr/ndr_xattr.h" /* diff --git a/source4/smbd/server.c b/source4/smbd/server.c index c472581a06c..fcaf0b8e39c 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -40,7 +40,7 @@ #include "smbd/process_model.h" #include "smbd/service.h" #include "passdb/secrets.h" -#include "util/pidfile.h" +#include "lib/util/pidfile.h" /* recursively delete a directory tree diff --git a/source4/static_deps.mk b/source4/static_deps.mk new file mode 100644 index 00000000000..09db053a343 --- /dev/null +++ b/source4/static_deps.mk @@ -0,0 +1,35 @@ +# These should also be autogenerated at some point +# perhaps by some perl scripts run from config.status ? +# +librpc/gen_ndr/misc.h: idl +librpc/ndr/libndr.h: librpc/ndr/libndr_proto.h librpc/gen_ndr/misc.h +librpc/rpc/dcerpc.h: librpc/rpc/dcerpc_proto.h +auth/credentials/credentials.h: auth/credentials/credentials_proto.h +libcli/nbt/libnbt.h: libcli/nbt/nbt_proto.h +lib/charset/charset.h: lib/charset/charset_proto.h + +include/includes.h: \ + include/config.h \ + lib/util/util_proto.h \ + lib/charset/charset.h \ + param/proto.h \ + libcli/util/proto.h \ + librpc/gen_ndr/misc.h + +heimdal_basics: \ + heimdal/lib/roken/vis.h \ + heimdal/lib/roken/err.h \ + heimdal/lib/hdb/hdb_asn1.h \ + heimdal/lib/gssapi/spnego_asn1.h \ + heimdal/lib/asn1/krb5_asn1.h \ + heimdal/lib/asn1/asn1_err.h \ + heimdal/lib/hdb/hdb_err.h \ + heimdal/lib/krb5/heim_err.h \ + heimdal/lib/krb5/k524_err.h \ + heimdal/lib/krb5/krb5_err.h + +proto: basics +basics: include/includes.h \ + proto \ + idl \ + heimdal_basics -- 2.34.1