diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-08-03 04:15:16 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:02 -0500 |
commit | 36f64c0f057fc80186e3493f9e723677131c3c34 (patch) | |
tree | dd82b9252f346d5f1ed4bcf57fd31234f4946c38 /source4 | |
parent | 26daec8d09b88b7758505d6fe732ea8f57fbf05c (diff) | |
download | samba-36f64c0f057fc80186e3493f9e723677131c3c34.tar.gz samba-36f64c0f057fc80186e3493f9e723677131c3c34.tar.bz2 samba-36f64c0f057fc80186e3493f9e723677131c3c34.zip |
r8979: Bunch of makefile fragment inclusion fixes:
- support whitespace
- support "include " keyword
- move swig stuff to .mk file
- support autogenerated makefile portions (use "include echo foo|")
(This used to be commit 43779c09b6a75e03f4cf6e8953a837cddd318aa5)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/Makefile.core | 78 | ||||
-rw-r--r-- | source4/build/smb_build/config_mk.pm | 95 | ||||
-rw-r--r-- | source4/build/smb_build/main.pl | 2 | ||||
-rw-r--r-- | source4/build/smb_build/makefile.pm | 69 | ||||
-rw-r--r-- | source4/config.list | 53 | ||||
-rw-r--r-- | source4/scripting/config.mk | 23 |
6 files changed, 146 insertions, 174 deletions
diff --git a/source4/Makefile.core b/source4/Makefile.core new file mode 100644 index 0000000000..8e593224eb --- /dev/null +++ b/source4/Makefile.core @@ -0,0 +1,78 @@ +# master list of build config files for Samba4 +include heimdal_build/config.mk +include config.mk +include dsdb/config.mk +include gtk/config.mk +include smbd/config.mk +include smbd/process_model.mk +include libnet/config.mk +include auth/config.mk +include nsswitch/config.mk +include lib/basic.mk +include lib/socket/config.mk +include lib/ldb/config.mk +include lib/talloc/config.mk +include lib/tdb/config.mk +include lib/tls/config.mk +include lib/registry/config.mk +include lib/messaging/config.mk +include lib/events/config.mk +include lib/popt/config.mk +include lib/cmdline/config.mk +include lib/socket_wrapper/config.mk +include lib/appweb/config.mk +include param/config.mk +include smb_server/config.mk +include rpc_server/config.mk +include ldap_server/config.mk +include web_server/config.mk +include winbind/config.mk +include nbt_server/config.mk +include cldap_server/config.mk +include auth/gensec/config.mk +include auth/kerberos/config.mk +include auth/ntlmssp/config.mk +include libcli/auth/config.mk +include libcli/ldap/config.mk +include libcli/config.mk +include utils/net/config.mk +include utils/config.mk +include ntvfs/posix/config.mk +include ntvfs/config.mk +include ntvfs/unixuid/config.mk +include ntptr/config.mk +include torture/config.mk +include librpc/config.mk +include client/config.mk +include libcli/config.mk +include libcli/security/config.mk +include lib/com/config.mk +include scripting/config.mk +include kdc/config.mk +include lib/replace/config.mk +include scripting/ejs/config.mk + +binaries: $(BIN_PROGS) $(SBIN_PROGS) +manpages: $(MANPAGES) + +showlayout: + @echo "Samba will be installed into:" + @echo " basedir: $(BASEDIR)" + @echo " bindir: $(BINDIR)" + @echo " sbindir: $(SBINDIR)" + @echo " libdir: $(LIBDIR)" + @echo " vardir: $(VARDIR)" + @echo " privatedir: $(PRIVATEDIR)" + @echo " piddir: $(PIDDIR)" + @echo " lockdir: $(LOCKDIR)" + @echo " swatdir: $(SWATDIR)" + @echo " mandir: $(MANDIR)" + +showflags: + @echo "Samba will be compiled with flags:" + @echo " CFLAGS = $(CFLAGS)" + @echo " LD_FLAGS = $(LD_FLAGS)" + @echo " STLD_FLAGS = $(STLD_FLAGS)" + @echo " SHLD_FLAGS = $(SHLD_FLAGS)" + + diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 274a2aab8b..c5a035f375 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -40,67 +40,68 @@ my %attribute_types = ( # # $filename - the path of the config.mk file # which should be parsed -# -# $result - the resulting structure -# -# $result->{ERROR_CODE} - the error_code, '0' means success -# $result->{ERROR_STR} - the error string -# -# $result->{$key}{KEY} - the key == the variable which was parsed -# $result->{$key}{VAL} - the value of the variable -sub _parse_config_mk($) +sub run_config_mk($$) { - my $filename = shift; + my ($input, $filename) = @_; my $result; my $linenum = -1; - my $waiting = 0; + my $infragment = 0; my $section = "GLOBAL"; my $makefile = ""; + + open(CONFIG_MK, $filename) or die("Can't open `$filename'\n"); + my @lines = <CONFIG_MK>; + close(CONFIG_MK); - open(CONFIG_MK, "<$filename") or die("Can't open `$filename'\n"); - - while (<CONFIG_MK>) { - my $line = $_; + my $line = ""; + my $prev = ""; + foreach (@lines) { $linenum++; # lines beginning with '#' are ignored - next if ($line =~ /^\#.*$/); + next if (/^\#.*$/); + + if (/^(.*)\\$/) { + $prev .= $1; + next; + } else { + $line = "$prev$_"; + $prev = ""; + } - if (not $waiting and ($line =~ /^\[([a-zA-Z0-9_:]+)\][\t ]*$/)) + if ($line =~ /^\[([a-zA-Z0-9_:]+)\][\t ]*$/) { $section = $1; + $infragment = 0; + next; + } + + # include + if ($line =~ /^include (.*)$/) { + $makefile .= run_config_mk($input, $1); next; } # empty line if ($line =~ /^[ \t]*$/) { - $waiting = 0; $section = "GLOBAL"; + if ($infragment) { $makefile.="\n"; } next; } # global stuff is considered part of the makefile if ($section eq "GLOBAL") { $makefile .= $line; + $infragment = 1; next; } + # Assignment - if (not $waiting and - ($line =~ /^([a-zA-Z0-9_]+)([\t ]*)=(.*)$/)) { - my $key = $1; - my $val = $3; - - # Continuing lines - if ($val =~ /^(.*)\\$/) { - $val = $1; - ($val.= " $1") while(($line = <CONFIG_MK>) =~ /^[\t ]*(.*)\\$/); - $val .= $line; - } - - $result->{$section}{$key}{KEY} = $key; - $result->{$section}{$key}{VAL} = $val; + if ($line =~ /^([a-zA-Z0-9_]+)[\t ]*=(.*)$/) { + $result->{$section}{$1}{VAL} = $2; + $result->{$section}{$1}{KEY} = $1; next; } @@ -108,17 +109,6 @@ sub _parse_config_mk($) die("$filename:$linenum: Bad line while parsing $filename"); } - close(CONFIG_MK); - - return ($result,$makefile); -} - -sub import_file($$) -{ - my ($input, $filename) = @_; - - my ($result, $makefile) = _parse_config_mk($filename); - foreach my $section (keys %{$result}) { my ($type, $name) = split(/::/, $section, 2); @@ -143,25 +133,8 @@ sub import_file($$) } } } - + return $makefile; } -sub import_files($$) -{ - my ($input, $config_list) = @_; - - open(IN, $config_list) or die("Can't open $config_list: $!"); - my @mkfiles = grep{!/^#/} <IN>; - close(IN); - - $| = 1; - my $makefragment = ""; - - foreach (@mkfiles) { - s/\n//g; - $makefragment.= import_file($input, $_); - } - return $makefragment; -} 1; diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index de7f4cd9ec..0b79b7c4b4 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -18,7 +18,7 @@ use strict; my $INPUT = {}; -my $mkfile = config_mk::import_files($INPUT, "config.list"); +my $mkfile = config_mk::run_config_mk($INPUT, "Makefile.core"); my $DEPEND = smb_build::input::check($INPUT, \%config::enabled); my $OUTPUT = output::create_output($DEPEND); makefile::create_makefile_in($OUTPUT, $mkfile, "Makefile.in"); diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 942ecd24c3..42728a2a9c 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -18,6 +18,7 @@ sub _prepare_path_vars() $output = << '__EOD__'; prefix = @prefix@ exec_prefix = @exec_prefix@ +selftest_prefix = @selftest_prefix@ VPATH = @srcdir@ srcdir = @srcdir@ builddir = @builddir@ @@ -88,6 +89,8 @@ XSLTPROC=$config{XSLTPROC} LEX=$config{LEX} YACC=$config{YACC} +DEFAULT_TEST_TARGET=$config{DEFAULT_TEST_TARGET} + __EOD__ } @@ -102,7 +105,6 @@ __EOD__ sub _prepare_SUFFIXES() { return << '__EOD__'; -.SUFFIXES: .SUFFIXES: .c .et .y .l .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml __EOD__ @@ -134,20 +136,20 @@ pch_clean: basics: idl proto_exists HEIMDAL_EXTERNAL -test: @DEFAULT_TEST_TARGET@ +test: $(DEFAULT_TEST_TARGET) test-swrap: all - ./script/tests/selftest.sh @selftest_prefix@/st all SOCKET_WRAPPER + ./script/tests/selftest.sh ${selftest_prefix}/st all SOCKET_WRAPPER test-noswrap: all - ./script/tests/selftest.sh @selftest_prefix@/st all + ./script/tests/selftest.sh ${selftest_prefix}/st all quicktest: all - ./script/tests/selftest.sh @selftest_prefix@/st quick SOCKET_WRAPPER + ./script/tests/selftest.sh ${selftest_prefix}/st quick SOCKET_WRAPPER valgrindtest: all SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \ - ./script/tests/selftest.sh @selftest_prefix@/st quick SOCKET_WRAPPER + ./script/tests/selftest.sh ${selftest_prefix}/st quick SOCKET_WRAPPER __EOD__ } @@ -174,7 +176,7 @@ sub _prepare_binaries($) next unless defined $_->{OUTPUT_TYPE}; next unless ($_->{OUTPUT_TYPE} eq "BINARY"); - push (@sbn_list, $_->{OUTPUT}) if ($_->{INSTALLDIR} eq "SBINDIR"); + push(@sbn_list, $_->{OUTPUT}) if ($_->{INSTALLDIR} eq "SBINDIR"); push(@bbn_list, $_->{OUTPUT}) if ($_->{INSTALLDIR} eq "BINDIR"); } @@ -183,9 +185,6 @@ sub _prepare_binaries($) return << "__EOD__"; BIN_PROGS = $bbn SBIN_PROGS = $sbn - -binaries: \$(BIN_PROGS) \$(SBIN_PROGS) - __EOD__ } @@ -203,8 +202,6 @@ sub _prepare_manpages($) return << "__EOD__"; MANPAGES = $mp -manpages: \$(MANPAGES) - __EOD__ } @@ -416,11 +413,9 @@ sub _prepare_mergedobj_rule($) return "" unless $ctx->{TARGET}; - my $output = ""; - my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST}); - $output .= "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n"; + my $output = "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n"; $output .= "$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n"; @@ -646,27 +641,6 @@ sub _prepare_target_settings($) sub _prepare_install_rules() { return << '__EOD__'; - -showlayout: - @echo "Samba will be installed into:" - @echo " basedir: $(BASEDIR)" - @echo " bindir: $(BINDIR)" - @echo " sbindir: $(SBINDIR)" - @echo " libdir: $(LIBDIR)" - @echo " vardir: $(VARDIR)" - @echo " privatedir: $(PRIVATEDIR)" - @echo " piddir: $(PIDDIR)" - @echo " lockdir: $(LOCKDIR)" - @echo " swatdir: $(SWATDIR)" - @echo " mandir: $(MANDIR)" - -showflags: - @echo "Samba will be compiled with flags:" - @echo " CFLAGS = $(CFLAGS)" - @echo " LD_FLAGS = $(LD_FLAGS)" - @echo " STLD_FLAGS = $(STLD_FLAGS)" - @echo " SHLD_FLAGS = $(SHLD_FLAGS)" - install: showlayout installbin installdat installswat # DESTDIR is used here to prevent packagers wasting their time @@ -702,29 +676,6 @@ uninstallbin: uninstallman: @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES) -# Swig extensions -swig: scripting/swig/_tdb.so scripting/swig/_dcerpc.so - -scripting/swig/tdb_wrap.c: scripting/swig/tdb.i - swig -python scripting/swig/tdb.i - -scripting/swig/_tdb.so: scripting/swig/tdb_wrap.o $(LIBRARY_swig_tdb_DEPEND_LIST) - $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_tdb.so scripting/swig/tdb_wrap.o \ - $(LIBRARY_swig_tdb_SHARED_LINK_LIST) $(LIBRARY_swig_tdb_SHARED_LINK_FLAGS) - -SWIG_INCLUDES = librpc/gen_ndr/samr.i librpc/gen_ndr/lsa.i librpc/gen_ndr/spoolss.i - -scripting/swig/dcerpc_wrap.c: scripting/swig/dcerpc.i scripting/swig/samba.i scripting/swig/status_codes.i $(SWIG_INCLUDES) - swig -python scripting/swig/dcerpc.i - -scripting/swig/_dcerpc.so: scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_DEPEND_LIST) - $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_dcerpc.so scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_SHARED_LINK_LIST) $(LIBRARY_swig_dcerpc_SHARED_LINK_FLAGS) - -swig_clean: - -rm -f scripting/swig/_tdb.so scripting/swig/tdb.pyc \ - scripting/swig/tdb.py scripting/swig/tdb_wrap.c \ - scripting/swig/tdb_wrap.o - everything: all etags: diff --git a/source4/config.list b/source4/config.list deleted file mode 100644 index 2aeb0f20f7..0000000000 --- a/source4/config.list +++ /dev/null @@ -1,53 +0,0 @@ -# master list of build config files for Samba4 -config.mk -heimdal_build/config.mk -dsdb/config.mk -gtk/config.mk -smbd/config.mk -smbd/process_model.mk -libnet/config.mk -auth/config.mk -nsswitch/config.mk -lib/basic.mk -lib/socket/config.mk -lib/ldb/config.mk -lib/talloc/config.mk -lib/tdb/config.mk -lib/tls/config.mk -lib/registry/config.mk -lib/messaging/config.mk -lib/events/config.mk -lib/popt/config.mk -lib/cmdline/config.mk -lib/socket_wrapper/config.mk -lib/appweb/config.mk -param/config.mk -smb_server/config.mk -rpc_server/config.mk -ldap_server/config.mk -web_server/config.mk -winbind/config.mk -nbt_server/config.mk -cldap_server/config.mk -auth/gensec/config.mk -auth/kerberos/config.mk -auth/ntlmssp/config.mk -libcli/auth/config.mk -libcli/ldap/config.mk -libcli/config.mk -utils/net/config.mk -utils/config.mk -ntvfs/posix/config.mk -ntvfs/config.mk -ntvfs/unixuid/config.mk -ntptr/config.mk -torture/config.mk -librpc/config.mk -client/config.mk -libcli/config.mk -libcli/security/config.mk -lib/com/config.mk -scripting/config.mk -kdc/config.mk -lib/replace/config.mk -scripting/ejs/config.mk diff --git a/source4/scripting/config.mk b/source4/scripting/config.mk index 779aef0b45..d292e01f1f 100644 --- a/source4/scripting/config.mk +++ b/source4/scripting/config.mk @@ -11,3 +11,26 @@ REQUIRED_SUBSYSTEMS = LIBTDB REQUIRED_SUBSYSTEMS = LIBCLI NDR_MISC LIBBASIC CONFIG RPC_NDR_SAMR RPC_NDR_LSA # End LIBRARY swig_dcerpc ####################### + +# Swig extensions +swig: scripting/swig/_tdb.so scripting/swig/_dcerpc.so + +scripting/swig/tdb_wrap.c: scripting/swig/tdb.i + swig -python scripting/swig/tdb.i + +scripting/swig/_tdb.so: scripting/swig/tdb_wrap.o $(LIBRARY_swig_tdb_DEPEND_LIST) + $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_tdb.so scripting/swig/tdb_wrap.o \ + $(LIBRARY_swig_tdb_SHARED_LINK_LIST) $(LIBRARY_swig_tdb_SHARED_LINK_FLAGS) + +SWIG_INCLUDES = librpc/gen_ndr/samr.i librpc/gen_ndr/lsa.i librpc/gen_ndr/spoolss.i + +scripting/swig/dcerpc_wrap.c: scripting/swig/dcerpc.i scripting/swig/samba.i scripting/swig/status_codes.i $(SWIG_INCLUDES) + swig -python scripting/swig/dcerpc.i + +scripting/swig/_dcerpc.so: scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_DEPEND_LIST) + $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_dcerpc.so scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_SHARED_LINK_LIST) $(LIBRARY_swig_dcerpc_SHARED_LINK_FLAGS) + +swig_clean: + -rm -f scripting/swig/_tdb.so scripting/swig/tdb.pyc \ + scripting/swig/tdb.py scripting/swig/tdb_wrap.c \ + scripting/swig/tdb_wrap.o |