summaryrefslogtreecommitdiff
path: root/source4/build/smb_build
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-03 04:15:16 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:02 -0500
commit36f64c0f057fc80186e3493f9e723677131c3c34 (patch)
treedd82b9252f346d5f1ed4bcf57fd31234f4946c38 /source4/build/smb_build
parent26daec8d09b88b7758505d6fe732ea8f57fbf05c (diff)
downloadsamba-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/build/smb_build')
-rw-r--r--source4/build/smb_build/config_mk.pm95
-rw-r--r--source4/build/smb_build/main.pl2
-rw-r--r--source4/build/smb_build/makefile.pm69
3 files changed, 45 insertions, 121 deletions
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: