summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2008-02-25 21:34:13 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-02-25 21:34:13 +0100
commit16502898b6dbc8e34b1eb6aaba4dfbaa5c25d56e (patch)
tree3175369e512a6831adaec8c4cae1c41c5e05afa6
parentb5bd6636907c76f6bb562b62abca78a7aeed83d8 (diff)
downloadsamba-16502898b6dbc8e34b1eb6aaba4dfbaa5c25d56e.tar.gz
samba-16502898b6dbc8e34b1eb6aaba4dfbaa5c25d56e.tar.bz2
samba-16502898b6dbc8e34b1eb6aaba4dfbaa5c25d56e.zip
Use make's $(call) feature.
(This used to be commit 4046ec8be08bb940ec60390c4f2e1719e14b858d)
-rw-r--r--source4/build/smb_build/makefile.pm10
-rw-r--r--source4/build/smb_build/output.pm6
-rw-r--r--source4/rules.mk25
3 files changed, 25 insertions, 16 deletions
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 8a3e99c629..e4ce48ee68 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -229,15 +229,7 @@ sub MergedObj($$)
return unless defined($ctx->{OUTPUT});
$self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
- $self->output(<< "__EOD__"
-#
-$ctx->{RESULT_MERGED_OBJ}: \$($ctx->{NAME}_OBJ_LIST)
- \@echo Partially linking \$@
- \@mkdir -p \$(\@D)
- \$(PARTLINK) -o \$@ \$^
-
-__EOD__
-);
+ $self->output("\$(call partial_link_template, $ctx->{RESULT_MERGED_OBJ}, \$($ctx->{NAME}_OBJ_LIST))\n");
}
sub StaticLibraryPrimitives($$)
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 6e8803fa23..8b356f9df5 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -137,7 +137,11 @@ sub create_output($$)
# Combine object lists
if (defined($part->{OBJ_FILES})) {
- my $list = "\$(abspath \$(addprefix $part->{BASEDIR}/, " . join(" ", @{$part->{OBJ_FILES}}) . "))";
+ my $list = "\$(addprefix $part->{BASEDIR}/, " . join(" ", @{$part->{OBJ_FILES}}) . ")";
+
+ if ($list =~ /\.\.\//) {
+ $list = "\$(abspath $list)";
+ }
push(@{$part->{OBJ_LIST}}, $list);
}
diff --git a/source4/rules.mk b/source4/rules.mk
index 5f91f8132e..06f425df44 100644
--- a/source4/rules.mk
+++ b/source4/rules.mk
@@ -86,12 +86,18 @@ check:: test
unused_macros:
$(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
-# Create a static library
-%.a:
- @echo Linking $@
- @rm -f $@
- @mkdir -p $(@D)
- @$(STLD) $(STLD_FLAGS) $@ $^
+###############################################################################
+# Templates
+###############################################################################
+
+# Partially link
+# Arguments: target object file, source object files
+define partial_link_template
+$(1): $(2)
+ @echo Partially linking $@
+ @mkdir -p \$(@D)
+ $(PARTLINK) -o $@ $^
+endef
###############################################################################
# File types
@@ -145,6 +151,13 @@ include/includes.d: include/includes.h
@echo "Building $< with $(LEX)"
@-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
+%.a:
+ @echo Linking $@
+ @rm -f $@
+ @mkdir -p $(@D)
+ @$(STLD) $(STLD_FLAGS) $@ $^
+
+
DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
.1.xml.1: