From 1ac5c35ed9bf5f557b8f42eee9c392af353430fe Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 23 Dec 2005 13:02:52 +0000 Subject: r12450: Move generation of proto and full object lists to makefile.pm. 'make' now handles expanding the protoheader object list, rather then the build system, which makes the makefile quite a bit shorter. (This used to be commit a4088ccc704f1338c040c53596ff606cc1651d03) --- source4/build/smb_build/input.pm | 4 ++++ source4/build/smb_build/main.pl | 4 ---- source4/build/smb_build/makefile.pm | 34 +++++++++++++++++++++++++++++++++- source4/build/smb_build/output.pm | 22 ---------------------- source4/main.mk | 4 ++-- source4/torture/config.mk | 2 +- 6 files changed, 40 insertions(+), 30 deletions(-) (limited to 'source4') diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index de558e709a..11a5eac1fb 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -132,6 +132,10 @@ sub check($$$$$) my ($INPUT, $enabled, $subsys_ot, $lib_ot, $module_ot) = @_; foreach my $part (values %$INPUT) { + unless(defined($part->{NOPROTO})) { + $part->{NOPROTO} = "NO"; + } + if (defined($enabled->{$part->{NAME}})) { $part->{ENABLE} = $enabled->{$part->{NAME}}; next; diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index cb25fca4ac..22b316a108 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -76,10 +76,6 @@ foreach my $key (values %$OUTPUT) { $mkenv->Header($key) if defined($key->{PUBLIC_HEADERS}); } -# FIXME: These two lines are a hack -$mkenv->ProtoHeader($OUTPUT->{PROTO}); -$mkenv->ProtoHeader($OUTPUT->{ALL_OBJS}); - $mkenv->write("Makefile"); smb_build_h::create_smb_build_h($OUTPUT, "include/smb_build.h"); diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 6aa3e02e5c..b7a6ace404 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -247,6 +247,12 @@ sub SharedLibrary($$) $self->_prepare_list($ctx, "LINK_LIST"); $self->_prepare_list($ctx, "LINK_FLAGS"); + push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)"); + + if ($ctx->{NOPROTO} eq "NO") { + push(@{$self->{proto_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST\)"); + } + $self->output(<< "__EOD__" # @@ -284,6 +290,12 @@ sub MergedObj($$) $self->_prepare_list($ctx, "CFLAGS"); $self->_prepare_list($ctx, "DEPEND_LIST"); + push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)"); + + if ($ctx->{NOPROTO} eq "NO") { + push(@{$self->{proto_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST\)"); + } + $self->output("$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n"); $self->output("\t\@echo \"Pre-Linking $ctx->{TYPE} $ctx->{NAME}\"\n"); @@ -297,6 +309,12 @@ sub ObjList($$) return unless $ctx->{TARGET}; + push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)"); + + if ($ctx->{NOPROTO} eq "NO") { + push(@{$self->{proto_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST\)"); + } + $self->_prepare_list($ctx, "OBJ_LIST"); $self->_prepare_list($ctx, "CFLAGS"); $self->_prepare_list($ctx, "DEPEND_LIST"); @@ -318,6 +336,12 @@ sub StaticLibrary($$) $self->_prepare_list($ctx, "LINK_LIST"); $self->_prepare_list($ctx, "LINK_FLAGS"); + push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)"); + + if ($ctx->{NOPROTO} eq "NO") { + push(@{$self->{proto_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST\)"); + } + $self->output(<< "__EOD__" # $ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) bin/.dummy @@ -350,6 +374,12 @@ sub Binary($$) $installdir = "bin"; } + push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)"); + + if ($ctx->{NOPROTO} eq "NO") { + push(@{$self->{proto_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST\)"); + } + unless (defined($ctx->{INSTALLDIR})) { } elsif ($ctx->{INSTALLDIR} eq "SBINDIR") { push (@{$self->{sbin_progs}}, "$installdir/$ctx->{BINARY}"); @@ -447,13 +477,15 @@ sub write($$) $self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n"); $self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n"); $self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n"); + $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n"); + $self->output("PROTO_OBJS = " . array2oneperline($self->{proto_objs}) . "\n"); $self->_prepare_mk_files(); if ($self->{developer}) { $self->output(<<__EOD__ -#-include \$(_ALL_OBJS_OBJ_LIST:.o=.d) +#-include \$(ALL_OBJS:.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 d39ff62101..d3d0840350 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -97,23 +97,7 @@ sub create_output($) my $depend = shift; my $part; - $depend->{PROTO} = { - OUTPUT_TYPE => "OBJLIST", - TYPE => "PROTO", - NAME => "PROTO", - OBJ_LIST => [] - }; - - $depend->{ALL_OBJS} = { - OUTPUT_TYPE => "OBJLIST", - TYPE => "", - NAME => "ALL_OBJS", - OBJ_LIST => [] - }; - foreach $part (values %{$depend}) { - next if $part->{NAME} eq "PROTO"; - next if $part->{NAME} eq "ALL_OBJS"; next if not defined($part->{OUTPUT_TYPE}); # Combine object lists @@ -133,12 +117,6 @@ sub create_output($) generate_shared_library($part) if $part->{OUTPUT_TYPE} eq "SHARED_LIBRARY"; generate_static_library($part) if $part->{OUTPUT_TYPE} eq "STATIC_LIBRARY"; - - push(@{$depend->{ALL_OBJS}->{OBJ_LIST}}, @{$part->{OBJ_LIST}}) if (defined(@{$part->{OBJ_LIST}})); - - if ((not defined ($part->{NOPROTO})) or ($part->{NOPROTO} eq "NO")) { - push(@{$depend->{PROTO}->{OBJ_LIST}}, @{$part->{OBJ_LIST}}) if (defined(@{$part->{OBJ_LIST}})); - } } foreach $part (values %{$depend}) { diff --git a/source4/main.mk b/source4/main.mk index 118d544665..deb0362386 100644 --- a/source4/main.mk +++ b/source4/main.mk @@ -195,12 +195,12 @@ include/config.h: @echo "You need to rerun ./autogen.sh and ./configure" @/bin/false -include/proto.h: $(PROTO_PROTO_OBJ_LIST:.o=.c) +include/proto.h: $(PROTO_OBJS:.o=.c) @-rm -f include/includes.h.gch @echo "Creating include/proto.h" @$(PERL) script/mkproto.pl --public-define=_PROTO_H_ \ --public=include/proto.h --private=include/proto.h \ - $(PROTO_PROTO_OBJ_LIST) + $(PROTO_OBJS) proto: include/proto.h pch: include/config.h \ diff --git a/source4/torture/config.mk b/source4/torture/config.mk index a19d1c5b4b..70e41467c7 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -280,6 +280,6 @@ gcov: CFLAGS="$(CFLAGS) $(GCOV_FLAGS)" \ LD_FLAGS="$(LD_FLAGS) $(GCOV_FLAGS)" \ LIBS="$(LIBS) $(GCOV_LIBS)" - for I in $(sort $(dir $(_ALL_OBJS_OBJ_LIST))); \ + for I in $(sort $(dir $(ALL_OBJS))); \ do $(GCOV) -p -o $$I $$I/*.c; \ done -- cgit