diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-02-25 22:10:59 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-02-25 22:10:59 +0100 |
commit | d15fd2c94f87c9d82eecefa64404f317a192ded0 (patch) | |
tree | 6975ba7ba086e14c3b3498e9ab9b9407759f9e05 | |
parent | 16502898b6dbc8e34b1eb6aaba4dfbaa5c25d56e (diff) | |
download | samba-d15fd2c94f87c9d82eecefa64404f317a192ded0.tar.gz samba-d15fd2c94f87c9d82eecefa64404f317a192ded0.tar.bz2 samba-d15fd2c94f87c9d82eecefa64404f317a192ded0.zip |
Use more make constructions for shared library bits.
(This used to be commit b2cd934d4d37516fe65a3b9c44d7c92622fecf99)
-rw-r--r-- | source4/build/smb_build/makefile.pm | 36 | ||||
-rw-r--r-- | source4/rules.mk | 24 |
2 files changed, 33 insertions, 27 deletions
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index e4ce48ee68..bc1c9970da 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -204,7 +204,6 @@ sub SharedLibrary($$) $self->_prepare_list($ctx, "LINK_FLAGS"); $self->output(<< "__EOD__" - $ctx->{RESULT_SHARED_LIBRARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST) \@echo Linking \$\@ \@mkdir -p \$(\@D) @@ -212,14 +211,14 @@ $ctx->{RESULT_SHARED_LIBRARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL \$($ctx->{NAME}\_FULL_OBJ_LIST) \\ \$($ctx->{NAME}_LINK_FLAGS) \\ \$(if \$(SONAMEFLAG), \$(SONAMEFLAG)$ctx->{LIBRARY_SONAME}) +ifneq ($ctx->{LIBRARY_REALNAME}, $ctx->{LIBRARY_SONAME}) + \@test \$($ctx->{NAME}_VERSION) = \$($ctx->{NAME}_SOVERSION) || ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME} +endif +ifdef $ctx->{NAME}_SOVERSION + \@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME} +endif __EOD__ ); - if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) { - $self->output("\t\@test \$($ctx->{NAME}_VERSION) = \$($ctx->{NAME}_SOVERSION) || ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}\n"); - } - $self->output("ifdef $ctx->{NAME}_SOVERSION\n"); - $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}\n"); - $self->output("endif\n"); } sub MergedObj($$) @@ -285,25 +284,10 @@ sub Binary($$) $self->_prepare_list($ctx, "DEPEND_LIST"); $self->_prepare_list($ctx, "LINK_FLAGS"); -$self->output(<< "__EOD__" -$ctx->{RESULT_BINARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST) - \@echo Linking \$\@ -__EOD__ - ); - if (defined($ctx->{USE_HOSTCC}) && $ctx->{USE_HOSTCC} eq "YES") { - $self->output(<< "__EOD__" - \@\$(HOSTLD) \$(HOSTLD_FLAGS) -L\${builddir}/bin/static -o \$\@ \$(INSTALL_LINK_FLAGS) \\ - \$\($ctx->{NAME}_LINK_FLAGS) -__EOD__ - ); +$self->output("\$(call host_binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n"); } else { - $self->output(<< "__EOD__" - \@\$(BNLD) \$(BNLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\ - \$\($ctx->{NAME}_LINK_FLAGS) - -__EOD__ - ); +$self->output("\$(call binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n"); } } @@ -355,9 +339,7 @@ sub ProtoHeader($$) $pub = "\$(addprefix $ctx->{BASEDIR}/, $ctx->{PUBLIC_PROTO_HEADER})"; } - $self->output("$pub: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_LIST:.o=.c) \$(srcdir)/script/mkproto.pl\n"); - $self->output("\t\@echo \"Creating \$@\"\n"); - $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --private=$priv --public=$pub \$($ctx->{NAME}_OBJ_LIST)\n\n"); + $self->output("\$(call proto_header_template, $pub, $priv, \$($ctx->{NAME}_OBJ_LIST:.o=.c))\n"); } sub write($$) diff --git a/source4/rules.mk b/source4/rules.mk index 06f425df44..d39910dafc 100644 --- a/source4/rules.mk +++ b/source4/rules.mk @@ -99,6 +99,30 @@ $(1): $(2) $(PARTLINK) -o $@ $^ endef +# Link a binary +# Arguments: target file, depends, flags +define binary_link_template +$(1): $(2) + @echo Linking $@ + @$(BNLD) $(BNLD_FLAGS) $(INTERN_LDFLAGS) -o $@ $(INSTALL_LINK_FLAGS) $(3) +endef + +# Link a host-machine binary +# Arguments: target file, depends, flags +define host_binary_link_template +$(1): $(2) + @echo Linking $@ + @$(HOSTLD) $(HOSTLD_FLAGS) -L${builddir}/bin/static -o $@ $(INSTALL_LINK_FLAGS) $(3) +endef + +# Create a prototype header +# Arguments: proto header, private header, c files +define proto_header_template +$(1) $(2): $(3) + @echo "Creating $@" + @$(PERL) $(srcdir)/script/mkproto.pl --srcdir=$(srcdir) --builddir=$(builddir) --private=$(2) --public=$(1) $(3) +endef + ############################################################################### # File types ############################################################################### |