From 9207a22a0e624b60f148fe7ac261b130ba6c285d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 17:48:50 +0200 Subject: Move writing autoconf vars into files into m4 macros. (This used to be commit 3ce8a4bb5568bb798c40034e3fa6a613ad2bf43b) --- source4/build/m4/public.m4 | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'source4/build') diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index ba8251e65d..7a9a76d60f 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -12,6 +12,10 @@ dnl SMB_ENABLE(name,default_build) dnl dnl SMB_INCLUDE_MK(file) dnl +dnl SMB_WRITE_MAKEVARS(file) +dnl +dnl SMB_WRITE_PERLVARS(file) +dnl dnl ####################################################### dnl ### And now the implementation ### dnl ####################################################### @@ -150,3 +154,39 @@ $1_ENABLE = $2 SMB_INFO_ENABLES="$SMB_INFO_ENABLES \$enabled{$1} = \"$2\";" ]) + +dnl SMB_WRITE_MAKEVARS(path) +AC_DEFUN([SMB_WRITE_MAKEVARS], +[ +echo "configure: creating $1" +cat >$1<$1< '$AC_Var',]) +); + +$SMB_INFO_ENABLES +1; +CEOF +]) -- cgit From 353afc8d943f6ecfad83af830919afdcc5a853fc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 17:55:50 +0200 Subject: Move writing of data.mk file to m4 macro. (This used to be commit 7fee112d2b86b423c397118f0333065825ea3518) --- source4/build/m4/public.m4 | 31 +++++++++++++++++++++++++++++++ source4/build/smb_build/main.pl | 4 +++- 2 files changed, 34 insertions(+), 1 deletion(-) (limited to 'source4/build') diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 7a9a76d60f..300c64f854 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -190,3 +190,34 @@ $SMB_INFO_ENABLES 1; CEOF ]) + +dnl SMB_BUILD_RUN(OUTPUT_FILE) +AC_DEFUN([SMB_BUILD_RUN], +[ +AC_OUTPUT_COMMANDS( +[ +test "x$ac_abs_srcdir" != "x$ac_abs_builddir" && ( + cd $builddir; + # NOTE: We *must* use -R so we don't follow symlinks (at least on BSD + # systems). + test -d heimdal || cp -R $srcdir/heimdal $builddir/ + test -d heimdal_build || cp -R $srcdir/heimdal_build $builddir/ + test -d build || builddir="$builddir" \ + srcdir="$srcdir" \ + $PERL ${srcdir}/script/buildtree.pl + ) + +$PERL -I${builddir} -I${builddir}/build \ + -I${srcdir} -I${srcdir}/build \ + ${srcdir}/build/smb_build/main.pl $1 || exit $? +], +[ +srcdir="$srcdir" +builddir="$builddir" +PERL="$PERL" + +export PERL +export srcdir +export builddir +]) +]) diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index d31bea73f3..07d0d5a90b 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -13,6 +13,8 @@ use smb_build::summary; use smb_build::config; use strict; +my $output_file = shift @ARGV; + my $INPUT = {}; my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk"); @@ -84,7 +86,7 @@ foreach my $key (values %$OUTPUT) { $mkenv->InitFunctions($key) if defined($key->{INIT_FUNCTIONS}); } -$mkenv->write("data.mk"); +$mkenv->write($output_file); summary::show($OUTPUT, \%config::config); -- cgit From 10676780486c6b7fcf5b11240bc8c2726f58fff2 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 18:08:37 +0200 Subject: Allow specifying different input file to smb_build. (This used to be commit c4bfc0b8daf2e288a278936b279bb4f7848d78e9) --- source4/build/m4/public.m4 | 2 +- source4/build/smb_build/main.pl | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'source4/build') diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 300c64f854..d932f09a69 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -209,7 +209,7 @@ test "x$ac_abs_srcdir" != "x$ac_abs_builddir" && ( $PERL -I${builddir} -I${builddir}/build \ -I${srcdir} -I${srcdir}/build \ - ${srcdir}/build/smb_build/main.pl $1 || exit $? + ${srcdir}/build/smb_build/main.pl --output=$1 main.mk || exit $? ], [ srcdir="$srcdir" diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index 07d0d5a90b..d6476c0cf2 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -11,12 +11,22 @@ use smb_build::config_mk; use smb_build::output; use smb_build::summary; use smb_build::config; +use Getopt::Long; use strict; -my $output_file = shift @ARGV; +my $output_file = "data.mk"; + +my $result = GetOptions ( + 'output' => \$output_file); + +if (not $result) { + exit(1); +} + +my $input_file = shift @ARGV; my $INPUT = {}; -my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk"); +my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, $input_file); my $subsys_output_type = ["MERGED_OBJ"]; -- cgit From 109634ba7788e8ea247b860f60af3df97c9e01f1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 18:33:05 +0200 Subject: Fix --output argument. (This used to be commit a38e473c9e382465ae30f3ca7ae12de500aec5f7) --- source4/build/smb_build/main.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/build') diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index d6476c0cf2..ab889b0e5a 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -17,7 +17,7 @@ use strict; my $output_file = "data.mk"; my $result = GetOptions ( - 'output' => \$output_file); + 'output=s' => \$output_file); if (not $result) { exit(1); -- cgit From 65f365d2ecccc5f0a1fb7c5140e5eade74ac9f08 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 18:33:24 +0200 Subject: Simplify argument handling. (This used to be commit f305c443db8e48efa80eeda8f83073b475dc3fee) --- source4/build/smb_build/config_mk.pm | 7 ++----- source4/build/smb_build/main.pl | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'source4/build') diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 81c3363cfb..56ad0c87c9 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -96,14 +96,11 @@ use vars qw(@parsed_files); @parsed_files = (); -sub _read_config_file +sub _read_config_file($$$) { - use File::Basename; use Cwd; - my $srcdir = shift; - my $builddir = shift; - my $filename = shift; + my ($srcdir, $builddir, $filename) = @_; my @dirlist; # We need to change our working directory because config.mk files can diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index d6476c0cf2..ab889b0e5a 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -17,7 +17,7 @@ use strict; my $output_file = "data.mk"; my $result = GetOptions ( - 'output' => \$output_file); + 'output=s' => \$output_file); if (not $result) { exit(1); -- cgit From 98154fdf05b725a9b7d7bdcd572a165c3fa865c1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 18:55:14 +0200 Subject: Move templates to a separate file. (This used to be commit d9770b651f61a0b70d6afa4610fadc7f199e1d98) --- source4/build/make/rules.mk | 97 +--------------------------------------- source4/build/make/templates.mk | 99 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 96 deletions(-) create mode 100644 source4/build/make/templates.mk (limited to 'source4/build') diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk index c0359a8297..b47cf2d382 100644 --- a/source4/build/make/rules.mk +++ b/source4/build/make/rules.mk @@ -88,102 +88,7 @@ unused_macros: @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 - -# 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: header file, c files -define proto_header_template -$(1): $(2) ; - @echo "Creating $$@" - @$$(PERL) $$(srcdir)/script/mkproto.pl --srcdir=$$(srcdir) --builddir=$$(builddir) --public=/dev/null --private=$$@ $$^ -endef - -# Shared module -# Arguments: Target, dependencies, objects -define shared_module_template - -$(1): $(2) ; - @echo Linking $$@ - @mkdir -p $$(@D) - @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3) - -endef - -# Shared library -# Arguments: Target, dependencies, link flags, soname -define shared_library_template -$(1): $(2) - @echo Linking $$@ - @mkdir -p $$(@D) - @$$(SHLD) $$(LDFLAGS) $$(SHLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) \ - $(3) \ - $$(if $$(SONAMEFLAG), $$(SONAMEFLAG)$(notdir $(4))) - -ifneq ($(notdir $(1)),$(notdir $(4))) -$(4): $(1) - @echo "Creating symbolic link for $$@" - @ln -fs $$( Date: Sun, 18 May 2008 21:09:04 +0200 Subject: Avoid smb_build for prototype headers in some places. (This used to be commit 4876c4efbbafb4e0afa3554cd9f748ab591a2927) --- source4/build/make/templates.mk | 2 ++ source4/build/smb_build/makefile.pm | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'source4/build') diff --git a/source4/build/make/templates.mk b/source4/build/make/templates.mk index 3a1f5656a6..e3ecffb02d 100644 --- a/source4/build/make/templates.mk +++ b/source4/build/make/templates.mk @@ -36,6 +36,8 @@ define proto_header_template $(1): $(2) ; @echo "Creating $$@" @$$(PERL) $$(srcdir)/script/mkproto.pl --srcdir=$$(srcdir) --builddir=$$(builddir) --public=/dev/null --private=$$@ $$^ + +PROTO_HEADERS += $(1) endef # Shared module diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 4c375cecf6..f2df09d9cd 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -227,9 +227,8 @@ sub ProtoHeader($$) { my ($self,$ctx) = @_; - my $target = "\$(addprefix $ctx->{BASEDIR}/, $ctx->{PRIVATE_PROTO_HEADER})"; - $self->output("PROTO_HEADERS += $target\n"); - $self->output("\$(call proto_header_template, $target, \$($ctx->{NAME}_OBJ_FILES:.o=.c))\n"); + my $target = "$ctx->{BASEDIR}/$ctx->{PRIVATE_PROTO_HEADER}"; + $self->output("\$(call proto_header_template,$target,\$($ctx->{NAME}_OBJ_FILES:.o=.c))\n"); } sub write($$) -- cgit From 78f804c497249cc807d8f2d7ac914288b3739c49 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 21:10:09 +0200 Subject: Typo, formatting fixes. (This used to be commit 5c961c0b41e0a41bd41705a103595af7405132a4) --- source4/build/make/templates.mk | 4 +++- source4/build/smb_build/makefile.pm | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'source4/build') diff --git a/source4/build/make/templates.mk b/source4/build/make/templates.mk index 3a1f5656a6..01afb3f2fb 100644 --- a/source4/build/make/templates.mk +++ b/source4/build/make/templates.mk @@ -1,6 +1,8 @@ -# Temapltes file for Samba 4 +# Templates file for Samba 4 # This relies on GNU make. # +# © 2008 Jelmer Vernooij +# ############################################################################### # Templates ############################################################################### diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 4c375cecf6..db8ba4b604 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -227,9 +227,9 @@ sub ProtoHeader($$) { my ($self,$ctx) = @_; - my $target = "\$(addprefix $ctx->{BASEDIR}/, $ctx->{PRIVATE_PROTO_HEADER})"; + my $target = "\$(addprefix $ctx->{BASEDIR}/,$ctx->{PRIVATE_PROTO_HEADER})"; $self->output("PROTO_HEADERS += $target\n"); - $self->output("\$(call proto_header_template, $target, \$($ctx->{NAME}_OBJ_FILES:.o=.c))\n"); + $self->output("\$(call proto_header_template,$target,\$($ctx->{NAME}_OBJ_FILES:.o=.c))\n"); } sub write($$) -- cgit From 4c8756f147f8b9a2806fd76e4cb06bb99d391516 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 22:30:08 +0200 Subject: Create prototype headers from Makefile directory, without smb_build in the middle. (This used to be commit f4a77b96f9c17d853348b70794026e5b9e384942) --- source4/build/smb_build/config_mk.pm | 8 -------- source4/build/smb_build/main.pl | 1 - source4/build/smb_build/makefile.pm | 8 -------- 3 files changed, 17 deletions(-) (limited to 'source4/build') diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 56ad0c87c9..88e24a5876 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -33,8 +33,6 @@ my $section_types = { "ENABLE" => "bool", - "PRIVATE_PROTO_HEADER" => "string", - "CFLAGS" => "list", "LDFLAGS" => "list", "STANDARD_VISIBILITY" => "string", @@ -53,8 +51,6 @@ my $section_types = { "OUTPUT_TYPE" => "list", - "PRIVATE_PROTO_HEADER" => "string", - "CFLAGS" => "list" }, "BINARY" => { @@ -64,8 +60,6 @@ my $section_types = { "ENABLE" => "bool", "INSTALLDIR" => "string", - "PRIVATE_PROTO_HEADER" => "string", - "CFLAGS" => "list", "LDFLAGS" => "list", "STANDARD_VISIBILITY" => "string", @@ -84,8 +78,6 @@ my $section_types = { "ENABLE" => "bool", - "PRIVATE_PROTO_HEADER" => "string", - "CFLAGS" => "list", "LDFLAGS" => "list", "STANDARD_VISIBILITY" => "string" diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index ab889b0e5a..3ff34eedcf 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -92,7 +92,6 @@ foreach my $key (values %$OUTPUT) { grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}})); $mkenv->PythonModule($key) if ($key->{TYPE} eq "PYTHON"); $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}}); - $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER}); $mkenv->InitFunctions($key) if defined($key->{INIT_FUNCTIONS}); } diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index f2df09d9cd..a0fee2736b 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -223,14 +223,6 @@ sub PythonFiles($$) } } -sub ProtoHeader($$) -{ - my ($self,$ctx) = @_; - - my $target = "$ctx->{BASEDIR}/$ctx->{PRIVATE_PROTO_HEADER}"; - $self->output("\$(call proto_header_template,$target,\$($ctx->{NAME}_OBJ_FILES:.o=.c))\n"); -} - sub write($$) { my ($self, $file) = @_; -- cgit From 4c70cda986c86fe536327321d04c29eca81b6409 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 18 May 2008 23:02:47 +0200 Subject: Fix a couple (well, little more than that..) of typos. (This used to be commit a6b52119940a900fb0de3864b8bca94e2965cc24) --- source4/build/make/rules.mk | 2 -- source4/build/make/templates.mk | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'source4/build') diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk index b47cf2d382..176e67a691 100644 --- a/source4/build/make/rules.mk +++ b/source4/build/make/rules.mk @@ -56,8 +56,6 @@ clean:: clean_pch @echo Removing generated files @-rm -f bin/*_init_module.c @-rm -rf librpc/gen_* - @echo Removing proto headers - @-rm -f $(PROTO_HEADERS) distclean:: clean -rm -f include/config.h include/config_tmp.h include/build.h diff --git a/source4/build/make/templates.mk b/source4/build/make/templates.mk index 87aa30c0c0..48678c5603 100644 --- a/source4/build/make/templates.mk +++ b/source4/build/make/templates.mk @@ -35,11 +35,16 @@ endef # Create a prototype header # Arguments: header file, c files define proto_header_template + +proto:: $(1) ; + +clean:: ; + rm -f $(1) + $(1): $(2) ; @echo "Creating $$@" @$$(PERL) $$(srcdir)/script/mkproto.pl --srcdir=$$(srcdir) --builddir=$$(builddir) --public=/dev/null --private=$$@ $$^ -PROTO_HEADERS += $(1) endef # Shared module -- cgit From eb1b76d200ea38fd1cea367016b782776004964c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 19 May 2008 14:15:15 +0200 Subject: build: only add enabled subsystems and modules to ALL_OBJS metze (This used to be commit cc07bd86e270c8016acd0f685d699e4a3e63cfb1) --- source4/build/smb_build/main.pl | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/build') diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index 3ff34eedcf..b31bfaa1f2 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -55,6 +55,7 @@ my $mkenv = new smb_build::makefile(\%config::config, $mkfile); my $shared_libs_used = 0; foreach my $key (values %$OUTPUT) { + next if ($key->{ENABLE} ne "YES"); push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_FILES)"); } -- cgit