summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-08-03 03:09:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:01 -0500
commit916505f66197b8ed9d767ea45e13cb3fd8319ae7 (patch)
tree0d86ae8e644b395cc7d777e7f3b318ec8b6ae8f7 /source4
parentf10b2af0f8234d99c76cf7dd2e8c95ad6c3c4678 (diff)
downloadsamba-916505f66197b8ed9d767ea45e13cb3fd8319ae7.tar.gz
samba-916505f66197b8ed9d767ea45e13cb3fd8319ae7.tar.bz2
samba-916505f66197b8ed9d767ea45e13cb3fd8319ae7.zip
r8974: Support makefile fragments in .mk files
(This used to be commit 8d9c18a1b4cf31ebae1d0c84b00b4d781f55de66)
Diffstat (limited to 'source4')
-rw-r--r--source4/build/smb_build/config_mk.pm121
-rw-r--r--source4/build/smb_build/main.pl4
-rw-r--r--source4/build/smb_build/makefile.pm35
-rw-r--r--source4/build/smb_build/smb_build_h.pm2
-rw-r--r--source4/libnet/config.mk1
-rw-r--r--source4/rpc_server/config.mk2
6 files changed, 52 insertions, 113 deletions
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index 517bca08ec..274a2aab8b 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -55,118 +55,71 @@ sub _parse_config_mk($)
my $linenum = -1;
my $waiting = 0;
my $section = "GLOBAL";
- my $key;
+ my $makefile = "";
- $result->{ERROR_CODE} = -1;
-
- open(CONFIG_MK, "< $filename") || die ("Can't open $filename\n");
+ open(CONFIG_MK, "<$filename") or die("Can't open `$filename'\n");
while (<CONFIG_MK>) {
my $line = $_;
- my $val;
$linenum++;
- #
- # lines beginnig with '#' are ignored
- #
- if ($line =~ /^\#.*$/) {
- next;
- }
+ # lines beginning with '#' are ignored
+ next if ($line =~ /^\#.*$/);
- #
- #
- #
- if (($waiting == 0) && ($line =~ /^\[([a-zA-Z0-9_:]+)\][\t ]*$/)) {
+ if (not $waiting and ($line =~ /^\[([a-zA-Z0-9_:]+)\][\t ]*$/))
+ {
$section = $1;
next;
}
-
- #
- # 1.) lines with an alphanumeric character indicate
- # a new variable,
- # 2.) followed by zero or more whitespaces or tabs
- # 3.) then one '=' character
- # 4.) followed by the value of the variable
- # 5.) a newline ('\n') can be escaped by a '\' before the newline
- # and the next line needs to start with a tab ('\t')
- #
- if (($waiting == 0) && ($line =~ /^([a-zA-Z0-9_]+)[\t ]*=(.*)$/)) {
- $key = $1;
- $val = $2;
-
- #
- # when we have a '\' before the newline
- # then skip it and wait for the next line.
- #
- if ($val =~ /(.*)(\\)$/) {
- $val = $1;
- $waiting = 1;
- } else {
- $waiting = 0;
- }
- $result->{$section}{$key}{KEY} = $key;
- $result->{$section}{$key}{VAL} = $val;
+ # empty line
+ if ($line =~ /^[ \t]*$/) {
+ $waiting = 0;
+ $section = "GLOBAL";
next;
}
- #
- # when we are waiting for a value to continue then
- # check if it has a leading tab.
- #
- if (($waiting == 1) && ($line =~ /^\t(.*)$/)) {
- $val = $1;
-
- #
- # when we have a '\' before the newline
- # then skip it and wait for the next line.
- #
- if ($val =~ /(.*)( \\)$/) {
- $val = $1;
- $waiting = 1;
- } else {
- $waiting = 0;
- }
-
- $result->{$section}{$key}{VAL} .= " ";
- $result->{$section}{$key}{VAL} .= $val;
+ # global stuff is considered part of the makefile
+ if ($section eq "GLOBAL") {
+ $makefile .= $line;
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;
+ }
- #
- # catch empty lines they're ignored
- # and we're no longer waiting for the value to continue
- #
- if ($line =~ /^$/) {
- $waiting = 0;
+ $result->{$section}{$key}{KEY} = $key;
+ $result->{$section}{$key}{VAL} = $val;
+
next;
}
- close(CONFIG_MK);
-
- $result->{ERROR_STR} = "Bad line while parsing $filename\n$filename:$linenum: $line";
-
- return $result;
+ die("$filename:$linenum: Bad line while parsing $filename");
}
close(CONFIG_MK);
- $result->{ERROR_CODE} = 0;
-
- return $result;
+ return ($result,$makefile);
}
sub import_file($$)
{
my ($input, $filename) = @_;
- my $result = _parse_config_mk($filename);
-
- die ($result->{ERROR_STR}) unless $result->{ERROR_CODE} == 0;
+ my ($result, $makefile) = _parse_config_mk($filename);
foreach my $section (keys %{$result}) {
- next if ($section eq "ERROR_CODE");
my ($type, $name) = split(/::/, $section, 2);
$input->{$name}{NAME} = $name;
@@ -176,7 +129,7 @@ sub import_file($$)
$key->{VAL} = smb_build::input::strtrim($key->{VAL});
my $vartype = $attribute_types{$key->{KEY}};
if (not defined($vartype)) {
- die("Unknown attribute $key->{KEY}");
+ die("$filename:Unknown attribute $key->{KEY} with value $key->{VAL} in section $section");
}
if ($vartype eq "string") {
$input->{$name}{$key->{KEY}} = $key->{VAL};
@@ -184,12 +137,14 @@ sub import_file($$)
$input->{$name}{$key->{KEY}} = [smb_build::input::str2array($key->{VAL})];
} elsif ($vartype eq "bool") {
if (($key->{VAL} ne "YES") and ($key->{VAL} ne "NO")) {
- die("Invalid value for bool attribute $key->{KEY}: $key->{VAL}");
+ die("Invalid value for bool attribute $key->{KEY}: $key->{VAL} in section $section");
}
$input->{$name}{$key->{KEY}} = $key->{VAL};
}
}
}
+
+ return $makefile;
}
sub import_files($$)
@@ -201,10 +156,12 @@ sub import_files($$)
close(IN);
$| = 1;
+ my $makefragment = "";
foreach (@mkfiles) {
s/\n//g;
- import_file($input, $_);
+ $makefragment.= import_file($input, $_);
}
+ return $makefragment;
}
1;
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index abe63ffaba..de7f4cd9ec 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -18,10 +18,10 @@ use strict;
my $INPUT = {};
-config_mk::import_files($INPUT, "config.list");
+my $mkfile = config_mk::import_files($INPUT, "config.list");
my $DEPEND = smb_build::input::check($INPUT, \%config::enabled);
my $OUTPUT = output::create_output($DEPEND);
-makefile::create_makefile_in($OUTPUT, "Makefile.in");
+makefile::create_makefile_in($OUTPUT, $mkfile, "Makefile.in");
smb_build_h::create_smb_build_h($OUTPUT, "include/smb_build.h");
open DOTTY, ">samba4-deps.dot";
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 9ac68499ae..942ecd24c3 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -196,9 +196,7 @@ sub _prepare_manpages($)
my @mp_list = ();
foreach (values %$ctx) {
- if (defined($_->{MANPAGE}) and $_->{MANPAGE} ne "") {
- push (@mp_list, $_->{MANPAGE});
- }
+ push (@mp_list, $_->{MANPAGE}) if (defined($_->{MANPAGE}) and $_->{MANPAGE} ne "");
}
my $mp = array2oneperline(\@mp_list);
@@ -286,10 +284,8 @@ __EOD__
sub _prepare_std_CC_rule($$$$$)
{
my ($src,$dst,$flags,$message,$comment) = @_;
- my $flagsstr = "";
- my $output;
- $output = << "__EOD__";
+ return << "__EOD__";
# $comment
.$src.$dst:
\@echo $message \$\*.$src
@@ -297,8 +293,6 @@ sub _prepare_std_CC_rule($$$$$)
\@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
__EOD__
-
- return $output;
}
sub array2oneperline($)
@@ -552,9 +546,7 @@ bin/.TARGET_$ctx->{NAME}:
sub _prepare_proto_rules()
{
- my $output = "";
-
- $output .= << '__EOD__';
+ my $output = << '__EOD__';
# Making this target will just make sure that the prototype files
# exist, not necessarily that they are up to date. Since they're
# removed by 'make clean' this will always be run when you do anything
@@ -627,7 +619,6 @@ sub _prepare_make_target($)
{
my $ctx = shift;
my $tmpdepend;
- my $output;
$tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
@@ -645,9 +636,6 @@ sub _prepare_target_settings($)
foreach my $key (values %$CTX) {
if (defined($key->{OBJ_LIST})) {
$output .= _prepare_obj_list($key->{TYPE}, $key);
- }
-
- if (defined($key->{OBJ_LIST})) {
$output .= _prepare_cflags($key->{TYPE}, $key);
}
}
@@ -655,12 +643,9 @@ sub _prepare_target_settings($)
return $output;
}
-sub _prepare_install_rules($)
+sub _prepare_install_rules()
{
- my $CTX = shift;
- my $output = "";
-
- $output .= << '__EOD__';
+ return << '__EOD__';
showlayout:
@echo "Samba will be installed into:"
@@ -749,8 +734,6 @@ ctags:
ctags `find $(srcdir) -name "*.[ch]"`
__EOD__
-
- return $output;
}
sub _prepare_rule_lists($)
@@ -771,7 +754,7 @@ sub _prepare_rule_lists($)
$output .= _prepare_IDL();
$output .= _prepare_proto_rules();
- $output .= _prepare_install_rules($depend);
+ $output .= _prepare_install_rules();
return $output;
}
@@ -846,12 +829,12 @@ __EOD__
# $OUTPUT - the global OUTPUT context
#
# $output - the resulting output buffer
-sub create_makefile_in($$)
+sub create_makefile_in($$$)
{
- my ($CTX, $file) = @_;
+ my ($CTX, $mk, $file) = @_;
open(MAKEFILE_IN,">$file") || die ("Can't open $file\n");
- print MAKEFILE_IN _prepare_makefile_in($CTX);
+ print MAKEFILE_IN _prepare_makefile_in($CTX) . $mk;
close(MAKEFILE_IN);
print "config.smb_build.pl: creating $file\n";
diff --git a/source4/build/smb_build/smb_build_h.pm b/source4/build/smb_build/smb_build_h.pm
index b6af38035b..b6ced52034 100644
--- a/source4/build/smb_build/smb_build_h.pm
+++ b/source4/build/smb_build/smb_build_h.pm
@@ -104,7 +104,7 @@ sub create_smb_build_h($$)
$output .= _prepare_smb_build_h($CTX);
- open(SMB_BUILD_H,"> $file") || die ("Can't open $file\n");
+ open(SMB_BUILD_H,">$file") || die ("Can't open `$file'\n");
print SMB_BUILD_H $output;
close(SMB_BUILD_H);
diff --git a/source4/libnet/config.mk b/source4/libnet/config.mk
index 54a0b46e45..77e48b82e7 100644
--- a/source4/libnet/config.mk
+++ b/source4/libnet/config.mk
@@ -17,7 +17,6 @@ ADD_OBJ_FILES = \
libnet/userinfo.o \
libnet/userman.o \
libnet/domain.o
-
REQUIRED_SUBSYSTEMS = RPC_NDR_SAMR RPC_NDR_LSA RPC_NDR_SRVSVC RPC_NDR_DRSUAPI LIBCLI_COMPOSITE LIBCLI_RESOLVE LIBSAMBA3
# End SUBSYSTEM LIBNET
#################################
diff --git a/source4/rpc_server/config.mk b/source4/rpc_server/config.mk
index af3c61cb2e..4ff5126322 100644
--- a/source4/rpc_server/config.mk
+++ b/source4/rpc_server/config.mk
@@ -24,7 +24,7 @@ INIT_OBJ_FILES = \
librpc/gen_ndr/ndr_dcom_d.o
REQUIRED_SUBSYSTEMS = \
DCERPC_COMMON \
- DCOM \
+ DCOM
# End MODULE dcerpc_dcom
################################################