From 470ba9434a3f10f8a53bacaac89204700adb89c4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 13 Dec 2005 21:42:03 +0000 Subject: r12219: Use some more common functions (This used to be commit 57ea480c24ff914dfa6cbc5a309020b21fa4af39) --- source4/build/smb_build/makefile.pm | 54 +++++++++++++++---------------------- source4/build/smb_build/output.pm | 8 +++--- 2 files changed, 26 insertions(+), 36 deletions(-) (limited to 'source4/build') diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 5d7a31379d..d5ac6de6f9 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -99,14 +99,14 @@ SHELL=$self->{config}->{SHELL} PERL=$self->{config}->{PERL} +CPP=$self->{config}->{CPP} +CPPFLAGS=$self->{config}->{CPPFLAGS} + CC=$self->{config}->{CC} -CFLAGS=-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -D_SAMBA_BUILD_ -DHAVE_CONFIG_H $self->{config}->{CFLAGS} $self->{config}->{CPPFLAGS} +CFLAGS=-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -D_SAMBA_BUILD_ -DHAVE_CONFIG_H $self->{config}->{CFLAGS} \$(CPPFLAGS) PICFLAG=$self->{config}->{PICFLAG} HOSTCC=$self->{config}->{HOSTCC} -CPP=$self->{config}->{CPP} -CPPFLAGS=$self->{config}->{CPPFLAGS} - DEVEL_LDFLAGS=-Wl,-rpath,bin/ LD=$self->{config}->{LD} LDFLAGS=$self->{config}->{LDFLAGS} -Lbin/$devld @@ -226,23 +226,13 @@ sub _prepare_list($$$) $self->output("$ctx->{TYPE}\_$ctx->{NAME}_$var =$tmplist\n"); } -sub _prepare_obj_list($$$) -{ - my ($self,$var,$ctx) = @_; - - my $tmplist = array2oneperline($ctx->{OBJ_LIST}); - return if ($tmplist eq ""); - - $self->output("$var\_$ctx->{NAME}_OBJS =$tmplist\n"); -} - sub SharedLibrary($$) { my ($self,$ctx) = @_; push (@{$self->{shared_libs}}, "bin/$ctx->{LIBRARY_NAME}"); - $self->_prepare_obj_list($ctx->{TYPE}, $ctx); + $self->_prepare_list($ctx, "OBJ_LIST"); $self->_prepare_list($ctx, "CFLAGS"); $self->_prepare_list($ctx, "DEPEND_LIST"); $self->_prepare_list($ctx, "LINK_LIST"); @@ -251,11 +241,11 @@ sub SharedLibrary($$) $self->output(<< "__EOD__" # -$ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy +$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) bin/.dummy \@echo Linking \$\@ \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\ - \$(LIBRARY_$ctx->{NAME}_LINK_FLAGS) \\ - \$(LIBRARY_$ctx->{NAME}_LINK_LIST) + \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\ + \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST) __EOD__ ); @@ -283,14 +273,14 @@ sub MergedObj($$) return unless $ctx->{TARGET}; - $self->_prepare_obj_list($ctx->{TYPE}, $ctx); + $self->_prepare_list($ctx, "OBJ_LIST"); $self->_prepare_list($ctx, "CFLAGS"); $self->_prepare_list($ctx, "DEPEND_LIST"); - $self->output("$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n"); + $self->output("$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n"); $self->output("\t\@echo \"Pre-Linking $ctx->{TYPE} $ctx->{NAME}\"\n"); - $self->output("\t@\$(LD) -r \$($ctx->{TYPE}_$ctx->{NAME}_OBJS) -o $ctx->{TARGET}\n"); + $self->output("\t@\$(LD) -r \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) -o $ctx->{TARGET}\n"); $self->output("\n"); } @@ -300,11 +290,11 @@ sub ObjList($$) return unless $ctx->{TARGET}; - $self->_prepare_obj_list($ctx->{TYPE}, $ctx); + $self->_prepare_list($ctx, "OBJ_LIST"); $self->_prepare_list($ctx, "CFLAGS"); $self->_prepare_list($ctx, "DEPEND_LIST"); $self->output("$ctx->{TARGET}: "); - $self->output("\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n"); + $self->output("\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n"); $self->output("\t\@touch $ctx->{TARGET}\n"); } @@ -314,7 +304,7 @@ sub StaticLibrary($$) push (@{$self->{static_libs}}, $ctx->{OUTPUT}); - $self->_prepare_obj_list($ctx->{TYPE}, $ctx); + $self->_prepare_list($ctx, "OBJ_LIST"); $self->_prepare_list($ctx, "CFLAGS"); $self->_prepare_list($ctx, "DEPEND_LIST"); @@ -323,10 +313,10 @@ sub StaticLibrary($$) $self->output(<< "__EOD__" # -$ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy +$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) bin/.dummy \@echo Linking \$@ \@\$(STLD) \$(STLD_FLAGS) \$@ \\ - \$(LIBRARY_$ctx->{NAME}_LINK_LIST) + \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST) library_$ctx->{NAME}: basics $ctx->{TARGET} @@ -354,7 +344,7 @@ sub Binary($$) push (@{$self->{bin_progs}}, $ctx->{TARGET}); } - $self->_prepare_obj_list($ctx->{TYPE}, $ctx); + $self->_prepare_list($ctx, "OBJ_LIST"); $self->_prepare_list($ctx, "CFLAGS"); $self->_prepare_list($ctx, "DEPEND_LIST"); $self->_prepare_list($ctx, "LINK_LIST"); @@ -363,11 +353,11 @@ sub Binary($$) $self->output(<< "__EOD__" # # -bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) \$(BINARY_$ctx->{NAME}_OBJS) +bin/$ctx->{BINARY}: bin/.dummy \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) \@echo Linking \$\@ \@\$(CC) \$(LDFLAGS) -o \$\@ \\ - \$\(BINARY_$ctx->{NAME}_LINK_LIST) \\ - \$\(BINARY_$ctx->{NAME}_LINK_FLAGS) + \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST) \\ + \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY} __EOD__ @@ -412,7 +402,7 @@ sub ProtoHeader($$) { my ($self,$ctx) = @_; - $self->_prepare_obj_list($ctx->{TYPE}, $ctx); + $self->_prepare_list($ctx, "OBJ_LIST"); } sub write($$) @@ -432,7 +422,7 @@ sub write($$) if ($self->{developer}) { $self->output(<<__EOD__ -#-include \$(_ALL_OBJS_OBJS:.o=.d) +#-include \$(_ALL_OBJS_OBJ_LIST:.o=.d) IDL_FILES = \$(wildcard librpc/idl/*.idl) \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.c,\$(IDL_FILES)) \\ \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_\%_c.c,\$(IDL_FILES)) \\ diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm index 92b2f05c62..b7a9653b2b 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -36,7 +36,7 @@ sub generate_objlist($) my $subsys = shift; $subsys->{TARGET} = "bin/.$subsys->{TYPE}_$subsys->{NAME}"; - $subsys->{OUTPUT} = "\$($subsys->{TYPE}_$subsys->{NAME}_OBJS)"; + $subsys->{OUTPUT} = "\$($subsys->{TYPE}_$subsys->{NAME}_OBJ_LIST)"; } sub generate_shared_library($) @@ -45,7 +45,7 @@ sub generate_shared_library($) my $link_name; @{$lib->{DEPEND_LIST}} = (); - @{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)"); + @{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJ_LIST)"); $link_name = $lib->{NAME}; $link_name =~ s/^LIB//; @@ -73,7 +73,7 @@ sub generate_static_library($) $link_name =~ s/^LIB//; $lib->{LIBRARY_NAME} = "lib".lc($link_name).".a"; - @{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJS)"); + @{$lib->{LINK_LIST}} = ("\$($lib->{TYPE}_$lib->{NAME}\_OBJ_LIST)"); @{$lib->{LINK_FLAGS}} = (); $lib->{TARGET} = "bin/$lib->{LIBRARY_NAME}"; @@ -85,7 +85,7 @@ sub generate_binary($) my $bin = shift; @{$bin->{DEPEND_LIST}} = (); - @{$bin->{LINK_LIST}} = ("\$($bin->{TYPE}_$bin->{NAME}\_OBJS)"); + @{$bin->{LINK_LIST}} = ("\$($bin->{TYPE}_$bin->{NAME}\_OBJ_LIST)"); @{$bin->{LINK_FLAGS}} = (); $bin->{TARGET} = $bin->{OUTPUT} = "bin/$bin->{NAME}"; -- cgit