summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-06-05 16:37:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:40 -0500
commit38e3381b1b99d69529543d2e9b38761143f1a22f (patch)
tree48f3909df27d3ef91d29fea33fe6c5310b6a5fd8 /source4/build
parent524f3c47cd38d4957a1fdb6ae66a7847f0deb80d (diff)
downloadsamba-38e3381b1b99d69529543d2e9b38761143f1a22f.tar.gz
samba-38e3381b1b99d69529543d2e9b38761143f1a22f.tar.bz2
samba-38e3381b1b99d69529543d2e9b38761143f1a22f.zip
r7308: Make dependency lists in the Makefile shorter (see discussion on samba-technical)
(This used to be commit 71d62d4dc7c475d17042ca466e56c51da1a2f32e)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/smb_build/makefile.pm82
-rw-r--r--source4/build/smb_build/output.pm15
2 files changed, 27 insertions, 70 deletions
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 71067709d3..68d4f23b1e 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -12,15 +12,12 @@ use strict;
sub _prepare_command_interpreters($)
{
my $ctx = shift;
- my $output;
- $output = << '__EOD__';
+ return << '__EOD__';
SHELL=/bin/sh
PERL=@PERL@
__EOD__
-
- return $output;
}
sub _prepare_path_vars($)
@@ -83,9 +80,8 @@ __EOD__
sub _prepare_compiler_linker($)
{
my $ctx = shift;
- my $output;
- $output = << '__EOD__';
+ return << '__EOD__';
CC=@CC@
CFLAGS=-Iinclude -I. -I$(srcdir)/include -I$(srcdir) -D_SAMBA_BUILD_ -DHAVE_CONFIG_H -Ilib @CFLAGS@ @CPPFLAGS@
@@ -99,8 +95,6 @@ SHLD=@CC@
SHLD_FLAGS=@LDSHFLAGS@ @LDFLAGS@ -Lbin
__EOD__
-
- return $output;
}
@@ -111,13 +105,9 @@ sub add_target_flags($$)
{
my $ctx = shift;
my $name = shift;
- my $output = "";
- if ($ctx->{TARGET_CFLAGS}) {
-$output .= << "__EOD__";
-$name: TARGET_CFLAGS = $ctx->{TARGET_CFLAGS}
-__EOD__
-}
- return $output;
+
+ return "" unless ($ctx->{TARGET_CFLAGS});
+ return "$name: TARGET_CFLAGS = $ctx->{TARGET_CFLAGS}\n";
}
@@ -151,9 +141,8 @@ __EOD__
sub _prepare_IDL($)
{
my $ctx = shift;
- my $output;
- $output = << '__EOD__';
+ return << '__EOD__';
idl_full: build/pidl/idl.pm
CPP="@CPP@" PERL="$(PERL)" script/build_idl.sh FULL
@@ -179,16 +168,13 @@ test-noswrap: all
./script/tests/selftest.sh `pwd`/prefix-test
__EOD__
-
- return $output;
}
sub _prepare_dummy_MAKEDIR()
{
my $ctx = shift;
- my $output;
- $output = << '__EOD__';
+ return << '__EOD__';
bin/.dummy:
@: >> $@ || : > $@
@@ -198,8 +184,6 @@ dynconfig.o: dynconfig.c Makefile
@BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@
__EOD__
-
- return $output;
}
###########################################################
@@ -229,14 +213,11 @@ sub _prepare_std_CC_rule($$$$$)
my $output;
$output = << "__EOD__";
-###################################
-# Start $comment
+# $comment
.$src.$dst:
\@echo $message \$\*.$src
\@\$(CC) \$(TARGET_CFLAGS) \$(CFLAGS) $flags -c \$< -o \$\@
\@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
-#End $comment
-###################################
__EOD__
@@ -298,11 +279,8 @@ sub _prepare_obj_list($$)
my $tmplist = array2oneperline($ctx->{OBJ_LIST});
return << "__EOD__";
-###################################
-# Start $var $ctx->{NAME} OBJ LIST
+# $var $ctx->{NAME} OBJ LIST
$var\_$ctx->{NAME}_OBJS =$tmplist
-# End $var $ctx->{NAME} OBJ LIST
-###################################
__EOD__
}
@@ -315,11 +293,7 @@ sub _prepare_cflags($$)
my $tmplist = array2oneperline($ctx->{CFLAGS});
return << "__EOD__";
-###################################
-# Start $var $ctx->{NAME} CFLAGS
$var\_$ctx->{NAME}_CFLAGS =$tmplist
-# End $var $ctx->{NAME} CFLAGS
-###################################
__EOD__
}
@@ -360,17 +334,13 @@ sub _prepare_shared_library_rule($)
$tmpshflag = array2oneperline($ctx->{LINK_FLAGS});
$output = << "__EOD__";
-###################################
-# Start Library $ctx->{NAME}
-#
LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
#
LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
#
-# Shared $ctx->{LIBRARY_NAME}
-$ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
+$ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
\@echo Linking \$\@
\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
\$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
@@ -395,9 +365,6 @@ __EOD__
$output .= << "__EOD__";
library_$ctx->{NAME}: basics bin/lib$ctx->{LIBRARY_NAME}
-# End Library $ctx->{NAME}
-###################################
-
__EOD__
$output .= add_target_flags($ctx, "library_" . $ctx->{NAME});
@@ -407,8 +374,11 @@ $output .= add_target_flags($ctx, "library_" . $ctx->{NAME});
sub _prepare_objlist_rule($)
{
- my $t = shift;
- return "$t->{TYPE}_$t->{NAME}: \$($t->{TYPE}_$t->{NAME}_OBJS)\n";
+ my $ctx = shift;
+ my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
+ return "
+$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n
+$ctx->{TYPE}_$ctx->{NAME}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJS) \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST)\n";
}
###########################################################
@@ -445,22 +415,16 @@ sub _prepare_static_library_rule($)
$tmpstflag = array2oneperline($ctx->{LINK_FLAGS});
$output = << "__EOD__";
-###################################
-# Start Library $ctx->{NAME}
-#
LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
#
LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST =$tmpstlink
#
-# Static $ctx->{LIBRARY_NAME}
-$ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
+$ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
\@echo Linking \$@
\@\$(STLD) \$(STLD_FLAGS) \$@ \\
\$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
library_$ctx->{NAME}: basics $ctx->{TARGET}
-# End Library $ctx->{NAME}
-###################################
__EOD__
@@ -498,22 +462,18 @@ sub _prepare_binary_rule($)
$tmpflag = array2oneperline($ctx->{LINK_FLAGS});
$output = << "__EOD__";
-###################################
-# Start Binary $ctx->{BINARY}
#
BINARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
BINARY_$ctx->{NAME}_LINK_LIST =$tmplink
BINARY_$ctx->{NAME}_LINK_FLAGS =$tmpflag
#
-bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST)
+bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) \$(BINARY_$ctx->{NAME}_OBJS)
\@echo Linking \$\@
\@\$(LD) \$(LD_FLAGS) -o \$\@ \\
\$\(BINARY_$ctx->{NAME}_LINK_FLAGS) \\
\$\(BINARY_$ctx->{NAME}_LINK_LIST) \\
\$\(BINARY_$ctx->{NAME}_LINK_FLAGS)
binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY}
-# End Binary $ctx->{BINARY}
-###################################
__EOD__
@@ -587,16 +547,10 @@ sub _prepare_make_target($)
$tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
- $output = << "__EOD__";
-###################################
-# Start Target $ctx->{TARGET}
+ return << "__EOD__";
$ctx->{TARGET}: basics $tmpdepend
-# End Target $ctx->{TARGET}
-###################################
__EOD__
-
- return $output;
}
sub _prepare_target_settings($)
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 398cb31ee9..2a19adb94c 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -22,7 +22,7 @@ sub generate_shared_library($)
{
my $lib = shift;
- @{$lib->{DEPEND_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
+ @{$lib->{DEPEND_LIST}} = ();
@{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
$lib->{LIBRARY_NAME} = lc($lib->{NAME}).".so";
$lib->{TARGET} = "bin/lib$lib->{LIBRARY_NAME}";
@@ -39,7 +39,7 @@ sub generate_static_library($)
{
my $lib = shift;
- @{$lib->{DEPEND_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
+ @{$lib->{DEPEND_LIST}} = ();
$lib->{LIBRARY_NAME} = lc($lib->{NAME}).".a";
@{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)");
@@ -53,7 +53,7 @@ sub generate_binary($)
{
my $bin = shift;
- @{$bin->{DEPEND_LIST}} = ("\$($bin->{TYPE}_$bin->{NAME}\_OBJS)");
+ @{$bin->{DEPEND_LIST}} = ();
@{$bin->{LINK_LIST}} = ("\$($bin->{TYPE}_$bin->{NAME}\_OBJS)");
@{$bin->{LINK_FLAGS}} = ();
@@ -64,13 +64,12 @@ sub generate_binary($)
sub create_output($)
{
my $depend = shift;
- my %output = ();
my $part;
$depend->{PROTO}{OUTPUT_TYPE} = "OBJLIST";
$depend->{PROTO}{TYPE} = "PROTO";
$depend->{PROTO}{NAME} = "PROTO";
-
+
foreach $part (values %{$depend}) {
next if not defined($part->{OUTPUT_TYPE});
@@ -90,13 +89,17 @@ sub create_output($)
foreach $part (values %{$depend}) {
next if not defined($part->{OUTPUT_TYPE});
+ foreach (@{$part->{DEPENDENCIES}}) {
+ my $elem = $$_;
+ push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET});
+ }
+
# Always import the CFLAGS and CPPFLAGS of the unique dependencies
foreach my $elem (values %{$part->{UNIQUE_DEPENDENCIES}}) {
next if $elem == $part;
push(@{$part->{CPPFLAGS}}, @{$elem->{CPPFLAGS}}) if defined(@{$elem->{CPPFLAGS}});
push(@{$part->{CFLAGS}}, @{$elem->{CFLAGS}}) if defined(@{$elem->{CFLAGS}});
- push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET});
push(@{$part->{LINK_LIST}}, $elem->{OUTPUT}) if defined($elem->{OUTPUT});
push(@{$part->{LINK_FLAGS}}, @{$elem->{LIBS}}) if defined($elem->{LIBS});
push(@{$part->{LINK_FLAGS}},@{$elem->{LDFLAGS}}) if defined($elem->{LDFLAGS});