diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-05-20 08:03:35 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-05-20 08:03:35 +1000 |
commit | 343fea32ccd205c68b23ee894a8ab4f9413af746 (patch) | |
tree | 692412a9e06c8947a84aef39d3def68d74774c13 /source4/build | |
parent | 38c68f1d5bf972f2473a41bf15c4a54efdc38b7e (diff) | |
parent | d817b435342956295f0a31b91203d1a63ae12063 (diff) | |
download | samba-343fea32ccd205c68b23ee894a8ab4f9413af746.tar.gz samba-343fea32ccd205c68b23ee894a8ab4f9413af746.tar.bz2 samba-343fea32ccd205c68b23ee894a8ab4f9413af746.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-local
Fix config.mk due to changing syntax.
Conflicts:
source/libcli/config.mk
source/nbt_server/config.mk
(This used to be commit 6a1c76f29f78183f44dfac6f468c5e728d2cb2cf)
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/m4/public.m4 | 71 | ||||
-rw-r--r-- | source4/build/make/rules.mk | 99 | ||||
-rw-r--r-- | source4/build/make/templates.mk | 108 | ||||
-rw-r--r-- | source4/build/smb_build/config_mk.pm | 15 | ||||
-rw-r--r-- | source4/build/smb_build/main.pl | 18 | ||||
-rw-r--r-- | source4/build/smb_build/makefile.pm | 9 |
6 files changed, 197 insertions, 123 deletions
diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index ba8251e65d..d932f09a69 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,70 @@ $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<<CEOF +# $1 - Autogenerated by configure, DO NOT EDIT! +AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [ +AC_Var = $AC_Var]) +$MAKE_SETTINGS +CEOF +]) + +dnl SMB_WRITE_PERLVARS(path) +AC_DEFUN([SMB_WRITE_PERLVARS], +[ +echo "configure: creating $1" +cat >$1<<CEOF +# config.pm - Autogenerate by configure. DO NOT EDIT! + +package config; +require Exporter; +@ISA = qw(Exporter); +@EXPORT_OK = qw(%enabled %config); +use strict; + +use vars qw(%enabled %config); + +%config = (AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [ + AC_Var => '$AC_Var',]) +); + +$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 --output=$1 main.mk || exit $? +], +[ +srcdir="$srcdir" +builddir="$builddir" +PERL="$PERL" + +export PERL +export srcdir +export builddir +]) +]) diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk index c0359a8297..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 @@ -88,102 +86,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 $$(<F) $$@ -endif - -ifneq ($(notdir $(1)),$(notdir $(5))) -$(5): $(1) - @echo "Creating symbolic link for $$@" - @ln -fs $$(<F) $$@ -endif -endef - -# Shared alias -# Arguments: Target, subsystem name, alias name -define shared_module_alias_template -bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1) - @ln -fs $$(<F) $$@ - -PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT) - -uninstallplugins:: - @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT) -installplugins:: - @ln -fs $(1) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT) - -endef - -define shared_module_install_template -installplugins:: bin/modules/$(1)/$(2) - @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2) - @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/ - @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2) -uninstallplugins:: - @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2) - @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2) - -endef +include build/make/templates.mk ############################################################################### # File types diff --git a/source4/build/make/templates.mk b/source4/build/make/templates.mk new file mode 100644 index 0000000000..48678c5603 --- /dev/null +++ b/source4/build/make/templates.mk @@ -0,0 +1,108 @@ +# Templates file for Samba 4 +# This relies on GNU make. +# +# © 2008 Jelmer Vernooij <jelmer@samba.org> +# +############################################################################### +# 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 + +proto:: $(1) ; + +clean:: ; + rm -f $(1) + +$(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 $$(<F) $$@ +endif + +ifneq ($(notdir $(1)),$(notdir $(5))) +$(5): $(1) + @echo "Creating symbolic link for $$@" + @ln -fs $$(<F) $$@ +endif +endef + +# Shared alias +# Arguments: Target, subsystem name, alias name +define shared_module_alias_template +bin/modules/$(2)/$(3).$$(SHLIBEXT): $(1) + @ln -fs $$(<F) $$@ + +PLUGINS += bin/modules/$(2)/$(3).$$(SHLIBEXT) + +uninstallplugins:: + @-rm $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT) +installplugins:: + @ln -fs $(1) $$(DESTDIR)$$(modulesdir)/$(2)/$(3).$$(SHLIBEXT) + +endef + +define shared_module_install_template +installplugins:: bin/modules/$(1)/$(2) + @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2) + @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/ + @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2) +uninstallplugins:: + @echo Uninstalling $$(DESTDIR)$$(modulesdir)/$(1)/$(2) + @-rm $$(DESTDIR)$$(modulesdir)/$(1)/$(2) + +endef diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 81c3363cfb..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" @@ -96,14 +88,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 d31bea73f3..b31bfaa1f2 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -11,10 +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 = "data.mk"; + +my $result = GetOptions ( + 'output=s' => \$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"]; @@ -43,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)"); } @@ -80,11 +93,10 @@ 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}); } -$mkenv->write("data.mk"); +$mkenv->write($output_file); summary::show($OUTPUT, \%config::config); diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 4c375cecf6..a0fee2736b 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -223,15 +223,6 @@ sub PythonFiles($$) } } -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"); -} - sub write($$) { my ($self, $file) = @_; |