diff options
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/m4/check_ld.m4 | 34 | ||||
-rw-r--r-- | source4/build/m4/public.m4 | 75 | ||||
-rw-r--r-- | source4/build/make/python.mk | 14 | ||||
-rw-r--r-- | source4/build/make/rules.mk | 107 | ||||
-rw-r--r-- | source4/build/make/templates.mk | 108 | ||||
-rw-r--r-- | source4/build/smb_build/config_mk.pm | 22 | ||||
-rwxr-xr-x | source4/build/smb_build/dot.pl | 4 | ||||
-rw-r--r-- | source4/build/smb_build/header.pm | 82 | ||||
-rw-r--r-- | source4/build/smb_build/input.pm | 56 | ||||
-rw-r--r-- | source4/build/smb_build/main.pl | 39 | ||||
-rw-r--r-- | source4/build/smb_build/makefile.pm | 190 | ||||
-rw-r--r-- | source4/build/smb_build/output.pm | 2 | ||||
-rw-r--r-- | source4/build/tests/unixsock.c | 93 |
13 files changed, 281 insertions, 545 deletions
diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4 index 0d0742e5d2..3a74ffc239 100644 --- a/source4/build/m4/check_ld.m4 +++ b/source4/build/m4/check_ld.m4 @@ -151,36 +151,12 @@ if test $BLDSHARED = true; then ac_cv_shmod_works=yes rm -f shlib.${SHLIBEXT} shlib.o ]) - if test $ac_cv_shlib_works = no -o $ac_cv_shmod_works = no; then - BLDSHARED=false + if test $ac_cv_shlib_works = no; then + AC_MSG_ERROR(unable to build shared libraries) + fi + if test $ac_cv_shmod_works = no; then + AC_MSG_ERROR(unable to build shared modules) fi -fi - -if test $BLDSHARED != true; then - SHLD="shared-libraries-disabled" - SHLD_FLAGS="shared-libraries-disabled" - MDLD="shared-modules-disabled" - MDLD_FLAGS="shared-modules-disabled" - SHLIBEXT="shared_libraries_disabled" - SONAMEFLAG="shared-libraries-disabled" - PICFLAG="" - AC_MSG_CHECKING([SHLD]) - AC_MSG_RESULT([$SHLD]) - AC_MSG_CHECKING([SHLD_FLAGS]) - AC_MSG_RESULT([$SHLD_FLAGS]) - - AC_MSG_CHECKING([MDLD]) - AC_MSG_RESULT([$MDLD]) - AC_MSG_CHECKING([MDLD_FLAGS]) - AC_MSG_RESULT([$MDLD_FLAGS]) - - AC_MSG_CHECKING([SHLIBEXT]) - AC_MSG_RESULT([$SHLIBEXT]) - AC_MSG_CHECKING([SONAMEFLAG]) - AC_MSG_RESULT([$SONAMEFLAG]) - - AC_MSG_CHECKING([PICFLAG]) - AC_MSG_RESULT([$PICFLAG]) fi AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension]) diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 1eae998ca4..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 ####################################################### @@ -37,13 +41,13 @@ ENABLE = YES " ]) -dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags) +dnl SMB_LIBRARY(name,obj_files,required_subsystems,cflags,ldflags) AC_DEFUN([SMB_LIBRARY], [ MAKE_SETTINGS="$MAKE_SETTINGS $1_CFLAGS = $6 $1_LDFLAGS = $7 -$1_ENABLE = YES +n1_ENABLE = YES $1_OBJ_FILES = $2 " @@ -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/python.mk b/source4/build/make/python.mk index 6c1798212e..66e5def8f0 100644 --- a/source4/build/make/python.mk +++ b/source4/build/make/python.mk @@ -1,14 +1,18 @@ pythonbuilddir = $(builddir)/bin/python +installpython:: + mkdir -p $(DESTDIR)$(pythondir) + # Install Python # Arguments: Module path define python_module_template installpython:: $$(pythonbuilddir)/$(1) ; - cp $$< $$(DESTDIR)$$(PYTHONDIR)/$(1) + mkdir -p $$(DESTDIR)$$(pythondir)/$$(dir $(1)) + cp $$< $$(DESTDIR)$$(pythondir)/$(1) uninstallpython:: - rm -f $$(DESTDIR)$$(PYTHONDIR)/$(1) ; + rm -f $$(DESTDIR)$$(pythondir)/$(1) ; pythonmods:: $$(pythonbuilddir)/$(1) ; @@ -25,7 +29,7 @@ $(call python_module_template,$(1)) endef # Python C module -# Arguments: Module path, object files +# Arguments: File name, dependencies, link list define python_c_module_template $$(pythonbuilddir)/$(1): $(2) ; @@ -39,9 +43,9 @@ endef # Swig extensions swig:: pythonmods -.SUFFIXES: _wrap.c .i +.SUFFIXES: _wrap.c .i .py -.i_wrap.c: +%_wrap.c %.py: %.i [ "$(SWIG)" == "no" ] || $(SWIG) -O -Wall -I$(srcdir)/scripting/swig -python -keyword $< realdistclean:: diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk index faefb4e323..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 @@ -211,8 +114,8 @@ include/includes.d: include/includes.h @echo "Compiling $<" @-mkdir -p `dirname $@` @$(COMPILE) && exit 0 ; \ - $(COMPILE) - + echo "The following command failed:" 1>&2;\ + echo "$(subst ",\",$(COMPILE))" 1>&2 && exit 1 .c.ho: @@ -220,7 +123,7 @@ include/includes.d: include/includes.h @-mkdir -p `dirname $@` @$(HCOMPILE) && exit 0;\ echo "The following command failed:" 1>&2;\ - echo "$(HCOMPILE)" 1>&2;\ + echo "$(subst ",\",$(HCOMPILE))" 1>&2;\ $(HCOMPILE) >/dev/null 2>&1 .h.h.gch: @@ -233,7 +136,7 @@ include/includes.d: include/includes.h .l.c: @echo "Building $< with $(LEX)" - @-$(make_utility_dir)/script/lex_compile.sh "$(LEX)" "$<" "$@" + @-$(make_utility_dir)/lex_compile.sh "$(LEX)" "$<" "$@" %.a: @echo Linking $@ diff --git a/source4/build/make/templates.mk b/source4/build/make/templates.mk new file mode 100644 index 0000000000..41a7ccd0a5 --- /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 $(notdir $(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 307c391e07..652a52fa60 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -20,7 +20,7 @@ my $section_types = { "LDFLAGS" => "list", }, "PYTHON" => { - SWIG_FILE => "string", + "LIBRARY_REALNAME" => "string", "PRIVATE_DEPENDENCIES" => "list", "PUBLIC_DEPENDENCIES" => "list", "ENABLE" => "bool", @@ -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 @@ -208,7 +197,7 @@ sub run_config_mk($$$$) $prev = ""; } - if ($line =~ /^\[([-a-zA-Z0-9_:]+)\][\t ]*$/) + if ($line =~ /^\[([-a-zA-Z0-9_.:]+)\][\t ]*$/) { $section = $1; $infragment = 0; @@ -244,7 +233,6 @@ sub run_config_mk($$$$) $infragment = 1; next; } - # Assignment if ($line =~ /^([a-zA-Z0-9_]+)[\t ]*=(.*)$/) { @@ -254,7 +242,7 @@ sub run_config_mk($$$$) next; } - die("$parsing_file:$linenum: Bad line while parsing $parsing_file"); + die("$parsing_file:$linenum: Bad line"); } $makefile .= "# }END $parsing_file\n"; diff --git a/source4/build/smb_build/dot.pl b/source4/build/smb_build/dot.pl index e50ee50f95..b30c320c6e 100755 --- a/source4/build/smb_build/dot.pl +++ b/source4/build/smb_build/dot.pl @@ -26,10 +26,10 @@ sub generate($$$) foreach my $part (values %{$depend}) { next if (defined($only) and not contains($only,$part->{NAME})); foreach my $elem (@{$part->{PUBLIC_DEPENDENCIES}}) { - $res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* public */\n"; + $res .= "\t\"$part->{NAME}\" -> \"$elem\" [style=filled]; /* public */\n"; } foreach my $elem (@{$part->{PRIVATE_DEPENDENCIES}}) { - $res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* private */\n"; + $res .= "\t\"$part->{NAME}\" -> \"$elem\" [style=dotted]; /* private */\n"; } } diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm deleted file mode 100644 index dfb7c62e54..0000000000 --- a/source4/build/smb_build/header.pm +++ /dev/null @@ -1,82 +0,0 @@ -# SMB Build System -# - create output for build.h -# -# Copyright (C) Stefan (metze) Metzmacher 2004 -# Copyright (C) Jelmer Vernooij 2005 -# Released under the GNU GPL - -package header; -use strict; - -sub _add_define_section($) -{ - my $DEFINE = shift; - my $output = ""; - - $output .= " -/* $DEFINE->{COMMENT} */ -#define $DEFINE->{KEY} $DEFINE->{VAL} -"; - - return $output; -} - -sub _prepare_build_h($) -{ - my $depend = shift; - my @defines = (); - my $output = ""; - - foreach my $key (values %$depend) { - my $DEFINE = (); - next if ($key->{TYPE} ne "LIBRARY" and - $key->{TYPE} ne "MODULE" and - $key->{TYPE} ne "SUBSYSTEM" and - $key->{TYPE} ne "BINARY"); - next unless defined($key->{INIT_FUNCTIONS}); - - my $name = $key->{NAME}; - $name =~ s/-/_/g; - $DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT"; - $DEFINE->{KEY} = "STATIC_$name\_MODULES"; - $DEFINE->{VAL} = "\\\n"; - foreach (@{$key->{INIT_FUNCTIONS}}) { - $DEFINE->{VAL} .= "\t$_, \\\n"; - } - - die("Invalid sentinel") unless ($key->{INIT_FUNCTION_SENTINEL}); - $DEFINE->{VAL} .= "\t$key->{INIT_FUNCTION_SENTINEL} \n"; - - push(@defines,$DEFINE); - } - - # - # loop over all BUILD_H define sections - # - foreach (@defines) { $output .= _add_define_section($_); } - - return $output; -} - -########################################################### -# This function creates include/build.h from the SMB_BUILD -# context -# -# create_build_h($SMB_BUILD_CTX) -# -# $SMB_BUILD_CTX - the global SMB_BUILD context -# -# $output - the resulting output buffer -sub create_smb_build_h($$) -{ - my ($CTX, $file) = @_; - - open(BUILD_H,">$file") || die ("Can't open `$file'\n"); - print BUILD_H "/* autogenerated by build/smb_build/main.pl */\n"; - print BUILD_H _prepare_build_h($CTX); - close(BUILD_H); - - print __FILE__.": creating $file\n"; -} - -1; diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 3ca2f22f0c..a76da496d9 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -94,10 +94,8 @@ sub check_module($$$) unless (defined($mod->{INIT_FUNCTION_SENTINEL})) { $mod->{INIT_FUNCTION_SENTINEL} = "NULL"; } if (not defined($mod->{OUTPUT_TYPE})) { - if (not defined($INPUT->{$mod->{SUBSYSTEM}}->{TYPE})) { - die("Invalid type for subsystem $mod->{SUBSYSTEM}"); - } - if ($INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") { + if ((not defined($INPUT->{$mod->{SUBSYSTEM}}->{TYPE})) or + $INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") { $mod->{OUTPUT_TYPE} = undef; } else { $mod->{OUTPUT_TYPE} = $default_ot; @@ -140,24 +138,12 @@ sub check_python($$$) $python->{INSTALLDIR} = "PYTHONDIR"; unless (defined($python->{CFLAGS})) { $python->{CFLAGS} = []; } - if (defined($python->{SWIG_FILE})) { - my $dirname = dirname($python->{SWIG_FILE}); - my $basename = basename($python->{SWIG_FILE}, ".i"); - - $dirname .= "/" unless $dirname =~ /\/$/; - $dirname = "" if $dirname eq "./"; - - $python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)"; - $python->{PYTHON_FILES} = ["$dirname$basename.py"]; - push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_UNUSED_MACROS)"); - push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_CAST_QUAL)"); - $python->{INIT_FUNCTION} = "{ (char *)\"_$basename\", init_$basename }"; - } else { - my $basename = $python->{NAME}; - $basename =~ s/^python_//g; + my $basename = $python->{NAME}; + $basename =~ s/^python_//g; + unless (defined($python->{LIBRARY_REALNAME})) { $python->{LIBRARY_REALNAME} = "$basename.\$(SHLIBEXT)"; - $python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }"; } + $python->{INIT_FUNCTION} = "{ (char *)\"$basename\", init$basename }"; push (@{$python->{CFLAGS}}, "\$(EXT_LIB_PYTHON_CFLAGS)"); $python->{SUBSYSTEM} = "LIBPYTHON"; @@ -172,6 +158,8 @@ sub check_binary($$) return if ($bin->{ENABLE} ne "YES"); ($bin->{BINARY} = (lc $bin->{NAME})) if not defined($bin->{BINARY}); + unless (defined($bin->{INIT_FUNCTION_SENTINEL})) { $bin->{INIT_FUNCTION_SENTINEL} = "NULL"; } + unless (defined($bin->{INIT_FUNCTION_TYPE})) { $bin->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; } $bin->{OUTPUT_TYPE} = ["BINARY"]; add_libreplace($bin); @@ -181,15 +169,13 @@ sub add_implicit($$) { my ($INPUT, $n) = @_; - $INPUT->{$n} = { - TYPE => "MAKE_RULE", - NAME => $n, - OUTPUT_TYPE => undef, - LIBS => ["\$(".uc($n)."_LIBS)"], - LDFLAGS => ["\$(".uc($n)."_LDFLAGS)"], - CFLAGS => ["\$(".uc($n)."_CFLAGS)"], - CPPFLAGS => ["\$(".uc($n)."_CPPFLAGS)"] - }; + $INPUT->{$n}->{TYPE} = "MAKE_RULE"; + $INPUT->{$n}->{NAME} = $n; + $INPUT->{$n}->{OUTPUT_TYPE} = undef; + $INPUT->{$n}->{LIBS} = ["\$(".uc($n)."_LIBS)"]; + $INPUT->{$n}->{LDFLAGS} = ["\$(".uc($n)."_LDFLAGS)"]; + $INPUT->{$n}->{CFLAGS} = ["\$(".uc($n)."_CFLAGS)"]; + $INPUT->{$n}->{CPPFLAGS} = ["\$(".uc($n)."_CPPFLAGS)"]; } sub calc_unique_deps($$$$$$$$) @@ -198,7 +184,7 @@ sub calc_unique_deps($$$$$$$$) my ($name, $INPUT, $deps, $udeps, $withlibs, $forward, $pubonly, $busy) = @_; foreach my $n (@$deps) { - add_implicit($INPUT, $n) unless (defined($INPUT->{$n})); + add_implicit($INPUT, $n) unless (defined($INPUT->{$n}) and defined($INPUT->{$n}->{TYPE})); my $dep = $INPUT->{$n}; if (grep (/^$n$/, @$busy)) { next if (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ"); @@ -206,19 +192,19 @@ sub calc_unique_deps($$$$$$$$) } next if (grep /^$n$/, @$udeps); - push (@{$udeps}, $dep->{NAME}) if $forward; + push (@{$udeps}, $n) if $forward; if (defined ($dep->{OUTPUT_TYPE}) && ($withlibs or (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") or (@{$dep->{OUTPUT_TYPE}}[0] eq "STATIC_LIBRARY"))) { - push (@$busy, $dep->{NAME}); - calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy); - calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PRIVATE_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy) unless $pubonly; + push (@$busy, $n); + calc_unique_deps($n, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy); + calc_unique_deps($n, $INPUT, $dep->{PRIVATE_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy) unless $pubonly; pop (@$busy); } - unshift (@{$udeps}, $dep->{NAME}) unless $forward; + unshift (@{$udeps}, $n) unless $forward; } } diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index 14897840a6..88289af26d 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -6,16 +6,27 @@ # Released under the GNU GPL use smb_build::makefile; -use smb_build::header; use smb_build::input; 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"]; @@ -44,27 +55,24 @@ 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)"); } foreach my $key (values %$OUTPUT) { next unless defined $key->{OUTPUT_TYPE}; + $mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}}); - $mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); - if (defined($key->{PC_FILE})) { - $mkenv->output("PC_FILES += $key->{BASEDIR}/$key->{PC_FILE}\n"); - } $mkenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); if ($key->{TYPE} eq "LIBRARY" and ${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") { $shared_libs_used = 1; } - $mkenv->SharedModulePrimitives($key) if ($key->{TYPE} eq "MODULE" or - $key->{TYPE} eq "PYTHON") and - grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); - $mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES}); + if ($key->{TYPE} eq "MODULE" and @{$key->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ" and defined($key->{INIT_FUNCTION})) { + $mkenv->output("$key->{SUBSYSTEM}_INIT_FUNCTIONS += $key->{INIT_FUNCTION},\n"); + } $mkenv->CFlags($key); } @@ -80,15 +88,14 @@ foreach my $key (values %$OUTPUT) { $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); - $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or - $key->{TYPE} eq "PYTHON") and - grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); + $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" and + 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"); -header::create_smb_build_h($OUTPUT, "include/build.h"); +$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 8f3f1701b7..0269cfe8a3 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -72,17 +72,7 @@ sub _prepare_mk_files($) push (@tmp, $_); } - $self->output(" -ifneq (\$(MAKECMDGOALS),clean) -ifneq (\$(MAKECMDGOALS),distclean) -ifneq (\$(MAKECMDGOALS),realdistclean) -"); $self->output("MK_FILES = " . array2oneperline(\@tmp) . "\n"); - $self->output(" -endif -endif -endif -"); } sub array2oneperline($) @@ -112,94 +102,41 @@ sub _prepare_list($$$) $self->output("$ctx->{NAME}_$var =$tmplist\n"); } -sub SharedModulePrimitives($$) +sub PythonModule($$) { my ($self,$ctx) = @_; - - #FIXME + + $self->_prepare_list($ctx, "FULL_OBJ_LIST"); + $self->_prepare_list($ctx, "DEPEND_LIST"); + $self->_prepare_list($ctx, "LINK_FLAGS"); + + $self->output("\$(eval \$(call python_c_module_template,$ctx->{LIBRARY_REALNAME},\$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}\_FULL_OBJ_LIST) \$($ctx->{NAME}_LINK_FLAGS)))\n"); } sub SharedModule($$) { my ($self,$ctx) = @_; - my $init_obj = ""; - my $sane_subsystem = lc($ctx->{SUBSYSTEM}); $sane_subsystem =~ s/^lib//; - if ($ctx->{TYPE} eq "PYTHON") { - $self->output("PYTHON_DSOS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); - } else { - $self->output("PLUGINS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); - $self->output("installplugins:: $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); - $self->output("\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); - $self->output("\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n"); - $self->output("\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); - if (defined($ctx->{ALIASES})) { - foreach (@{$ctx->{ALIASES}}) { - $self->output("\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); - $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); - } - } - - $self->output("uninstallplugins::\n"); - $self->output("\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); - $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n"); - - if (defined($ctx->{ALIASES})) { - foreach (@{$ctx->{ALIASES}}) { - $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); - } - } - } + $self->output("PLUGINS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("\$(eval \$(call shared_module_install_template,$sane_subsystem,$ctx->{LIBRARY_REALNAME}))\n"); - $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); $self->_prepare_list($ctx, "FULL_OBJ_LIST"); $self->_prepare_list($ctx, "DEPEND_LIST"); $self->_prepare_list($ctx, "LINK_FLAGS"); - if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON" and - $ctx->{INIT_FUNCTION_TYPE} =~ /\(\*\)/) { - my $init_fn = $ctx->{INIT_FUNCTION_TYPE}; - $init_fn =~ s/\(\*\)/init_module/; - my $proto_fn = $ctx->{INIT_FUNCTION_TYPE}; - $proto_fn =~ s/\(\*\)/$ctx->{INIT_FUNCTION}/; - - $self->output(<< "__EOD__" -bin/$ctx->{NAME}_init_module.c: - \@echo Creating \$\@ - \@echo \"#include \\\"includes.h\\\"\" > \$\@ - \@echo \"$proto_fn;\" >> \$\@ - \@echo \"_PUBLIC_ $init_fn\" >> \$\@ - \@echo \"{\" >> \$\@ - \@echo \" return $ctx->{INIT_FUNCTION}();\" >> \$\@ - \@echo \"}\" >> \$\@ - \@echo \"\" >> \$\@ -__EOD__ -); - $init_obj = "bin/$ctx->{NAME}_init_module.o"; + if (defined($ctx->{INIT_FUNCTION}) and $ctx->{INIT_FUNCTION_TYPE} =~ /\(\*\)/ and not ($ctx->{INIT_FUNCTION} =~ /\(/)) { + $self->output("\$($ctx->{NAME}_OBJ_FILES): CFLAGS+=-D$ctx->{INIT_FUNCTION}=init_module\n"); } - $self->output(<< "__EOD__" -# + $self->output("\$(eval \$(call shared_module_template,$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}\_FULL_OBJ_LIST) \$($ctx->{NAME}_LINK_FLAGS)))\n"); -$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST) $init_obj - \@echo Linking \$\@ - \@mkdir -p $ctx->{SHAREDDIR} - \@\$(MDLD) \$(LDFLAGS) \$(MDLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\ - \$($ctx->{NAME}\_FULL_OBJ_LIST) $init_obj \\ - \$($ctx->{NAME}_LINK_FLAGS) -__EOD__ -); if (defined($ctx->{ALIASES})) { - foreach (@{$ctx->{ALIASES}}) { - $self->output("\t\@rm -f $ctx->{SHAREDDIR}/$_.\$(SHLIBEXT)\n"); - $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$_.\$(SHLIBEXT)\n"); - } + $self->output("\$(eval \$(foreach alias,". join(' ', @{$ctx->{ALIASES}}) . ",\$(call shared_module_alias_template,$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME},$sane_subsystem,\$(alias))))\n"); } - $self->output("\n"); } sub StaticLibraryPrimitives($$) @@ -224,59 +161,33 @@ sub SharedLibrary($$) { my ($self,$ctx) = @_; - if (!defined($ctx->{LIBRARY_SONAME})) { - $ctx->{LIBRARY_SONAME} = ""; - } - - $self->output("SHARED_LIBS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("SHARED_LIBS += $ctx->{RESULT_SHARED_LIBRARY}\n"); $self->_prepare_list($ctx, "DEPEND_LIST"); $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) - \@\$(SHLD) \$(LDFLAGS) \$(SHLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\ - \$($ctx->{NAME}\_FULL_OBJ_LIST) \\ - \$($ctx->{NAME}_LINK_FLAGS) \\ - \$(if \$(SONAMEFLAG), \$(SONAMEFLAG)$ctx->{LIBRARY_SONAME}) -__EOD__ -); - if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) { - $self->output("ifneq (\$($ctx->{NAME}_VERSION),\$($ctx->{NAME}_SOVERSION))\n"); - $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}\n"); - $self->output("endif\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"); + $self->output("\$(eval \$(call shared_library_template,$ctx->{RESULT_SHARED_LIBRARY}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}\_FULL_OBJ_LIST) \$($ctx->{NAME}_LINK_FLAGS),$ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME},$ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}))\n"); } sub MergedObj($$) { my ($self, $ctx) = @_; - return unless defined($ctx->{OUTPUT}); - - $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); - $self->output(<< "__EOD__" -# -$ctx->{RESULT_MERGED_OBJ}: \$($ctx->{NAME}_OBJ_FILES) - \@echo Partially linking \$@ - \@mkdir -p \$(\@D) - \$(PARTLINK) -o \$@ \$($ctx->{NAME}_OBJ_FILES) + $self->output("\$(call partial_link_template, $ctx->{OUTPUT}, \$($ctx->{NAME}_OBJ_FILES))\n"); +} -__EOD__ -); +sub InitFunctions($$) +{ + my ($self, $ctx) = @_; + $self->output("\$($ctx->{NAME}_OBJ_FILES): CFLAGS+=-DSTATIC_$ctx->{NAME}_MODULES=\"\$($ctx->{NAME}_INIT_FUNCTIONS)$ctx->{INIT_FUNCTION_SENTINEL}\"\n"); } sub StaticLibrary($$) { my ($self,$ctx) = @_; - $self->output("STATIC_LIBS += $ctx->{TARGET_STATIC_LIBRARY}\n") if ($ctx->{TYPE} eq "LIBRARY"); - + $self->output("STATIC_LIBS += $ctx->{RESULT_STATIC_LIBRARY}\n") if ($ctx->{TYPE} eq "LIBRARY"); + $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); $self->output("$ctx->{RESULT_STATIC_LIBRARY}: \$($ctx->{NAME}_FULL_OBJ_LIST)\n"); } @@ -285,74 +196,31 @@ sub Binary($$) my ($self,$ctx) = @_; unless (defined($ctx->{INSTALLDIR})) { + $self->output("BINARIES += $ctx->{TARGET_BINARY}\n"); } elsif ($ctx->{INSTALLDIR} eq "SBINDIR") { - $self->output("SBIN_PROGS += bin/$ctx->{BINARY}\n"); + $self->output("SBIN_PROGS += $ctx->{RESULT_BINARY}\n"); } elsif ($ctx->{INSTALLDIR} eq "BINDIR") { - $self->output("BIN_PROGS += bin/$ctx->{BINARY}\n"); + $self->output("BIN_PROGS += $ctx->{RESULT_BINARY}\n"); } - $self->output("binaries:: $ctx->{TARGET_BINARY}\n"); - $self->_prepare_list($ctx, "FULL_OBJ_LIST"); $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__ - ); - } -} - -sub PythonFiles($$) -{ - my ($self,$ctx) = @_; - - foreach (@{$ctx->{PYTHON_FILES}}) { - my $target = "bin/python/".basename($_); - my $source = "\$(addprefix $ctx->{BASEDIR}/, $_)"; - $self->output("$target: $source\n\n"); - $self->output("PYTHON_PYS += $target\n"); +$self->output("\$(call binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n"); } } -sub ProtoHeader($$) -{ - my ($self,$ctx) = @_; - - my $priv = "$ctx->{BASEDIR}/$ctx->{PRIVATE_PROTO_HEADER}"; - $self->output("PROTO_HEADERS += $priv\n"); - - $self->output("$priv: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_FILES:.o=.c) \$(srcdir)/script/mkproto.pl\n"); - $self->output("\t\@echo \"Creating \$@\"\n"); - $self->output("\t\@mkdir -p \$(\@D)\n"); - $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --public=/dev/null --private=\$@ \$($ctx->{NAME}_OBJ_FILES)\n\n"); -} - sub write($$) { my ($self, $file) = @_; - $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n"); - $self->_prepare_mk_files(); - $self->output($self->{mkfile}); + $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n"); open(MAKEFILE,">$file") || die ("Can't open $file\n"); print MAKEFILE $self->{output}; diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm index aeff7d48ce..f9f12c3a73 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -154,7 +154,7 @@ sub create_output($$) push (@{$part->{FULL_OBJ_LIST}}, $elem->{TARGET}); } else { push(@{$part->{LINK_FLAGS}}, "\$($elem->{NAME}_OUTPUT)") if defined($elem->{OUTPUT}); - push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET}); + push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if (defined($elem->{TARGET})); } } } diff --git a/source4/build/tests/unixsock.c b/source4/build/tests/unixsock.c deleted file mode 100644 index f2765d68f6..0000000000 --- a/source4/build/tests/unixsock.c +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c-file-style: "linux" -*- - * - * Try creating a Unix-domain socket, opening it, and reading from it. - * The POSIX name for these is AF_LOCAL/PF_LOCAL. - * - * This is used by the Samba autoconf scripts to detect systems which - * don't have Unix-domain sockets, such as (probably) VMS, or systems - * on which they are broken under some conditions, such as RedHat 7.0 - * (unpatched). We can't build WinBind there at the moment. - * - * Coding standard says to always use exit() for this, not return, so - * we do. - * - * Martin Pool <mbp@samba.org>, June 2000. */ - -/* TODO: Look for AF_LOCAL (most standard), AF_UNIX, and AF_FILE. */ - -#include <stdio.h> - -#ifdef HAVE_SYS_SOCKET_H -# include <sys/socket.h> -#endif - -#ifdef HAVE_SYS_UN_H -# include <sys/un.h> -#endif - -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif - -#if HAVE_SYS_WAIT_H -# include <sys/wait.h> -#endif - -#if HAVE_ERRNO_DECL -# include <errno.h> -#else -extern int errno; -#endif - -static int bind_socket(char const *filename) -{ - int sock_fd; - struct sockaddr_un name; - size_t size; - - /* Create the socket. */ - if ((sock_fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) { - perror ("socket(PF_LOCAL, SOCK_STREAM)"); - exit(1); - } - - /* Bind a name to the socket. */ - name.sun_family = AF_LOCAL; - strncpy(name.sun_path, filename, sizeof (name.sun_path)); - - /* The size of the address is - the offset of the start of the filename, - plus its length, - plus one for the terminating null byte. - Alternatively you can just do: - size = SUN_LEN (&name); - */ - size = SUN_LEN(&name); - /* XXX: This probably won't work on unfriendly libcs */ - - if (bind(sock_fd, (struct sockaddr *) &name, size) < 0) { - perror ("bind"); - exit(1); - } - - return sock_fd; -} - - -int main(void) -{ - int sock_fd; - int kid; - char const *filename = "conftest.unixsock.sock"; - - /* abolish hanging */ - alarm(15); /* secs */ - - if ((sock_fd = bind_socket(filename)) < 0) - exit(1); - - /* the socket will be deleted when autoconf cleans up these - files. */ - - exit(0); -} |