summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/m4/public.m42
-rwxr-xr-xsource4/build/make/lex_compile.sh51
-rw-r--r--source4/build/make/python.mk58
-rw-r--r--source4/build/make/rules.mk241
-rwxr-xr-xsource4/build/make/yacc_compile.sh43
-rw-r--r--source4/build/smb_build/config_mk.pm13
-rw-r--r--source4/build/smb_build/header.pm92
-rw-r--r--source4/build/smb_build/input.pm6
-rw-r--r--source4/build/smb_build/main.pl27
-rw-r--r--source4/build/smb_build/makefile.pm202
-rw-r--r--source4/build/smb_build/output.pm56
11 files changed, 492 insertions, 299 deletions
diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4
index eb673446c7..604092c8d7 100644
--- a/source4/build/m4/public.m4
+++ b/source4/build/m4/public.m4
@@ -31,7 +31,6 @@ SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
###################################
# Start Subsystem $1
@<:@SUBSYSTEM::$1@:>@
-OBJ_FILES = \$($1_OBJ_FILES)
PRIVATE_DEPENDENCIES = $3
CFLAGS = \$($1_CFLAGS)
ENABLE = YES
@@ -54,7 +53,6 @@ SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
###################################
# Start Library $1
@<:@LIBRARY::$1@:>@
-OBJ_FILES = \$($1_OBJ_FILES)
PRIVATE_DEPENDENCIES = $3
VERSION = $4
SO_VERSION = $5
diff --git a/source4/build/make/lex_compile.sh b/source4/build/make/lex_compile.sh
new file mode 100755
index 0000000000..9bba7257b1
--- /dev/null
+++ b/source4/build/make/lex_compile.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+LEX="$1"
+SRC="$2"
+DEST="$3"
+shift 3
+ARGS="$*"
+
+dir=`dirname $SRC`
+file=`basename $SRC`
+base=`basename $SRC .l`
+if [ -z "$LEX" ]; then
+ # if $DEST is more recent than $SRC, we can just touch
+ # otherwise we touch but print out warnings
+ if [ -r $DEST ]; then
+ if [ x`find $SRC -newer $DEST -print` = x$SRC ]; then
+ echo "warning: lex not found - cannot generate $SRC => $DEST" >&2
+ echo "warning: lex not found - only updating the timestamp of $DEST" >&2
+ fi
+ touch $DEST;
+ exit;
+ fi
+ echo "error: lex not found - cannot generate $SRC => $DEST" >&2
+ exit 1;
+fi
+# if $DEST is more recent than $SRC, we can just touch
+if [ -r $DEST ]; then
+ if [ x`find $SRC -newer $DEST -print` != x$SRC ]; then
+ touch $DEST;
+ exit;
+ fi
+fi
+TOP=`pwd`
+if cd $dir && $LEX $ARGS $file; then
+ if [ -r $base.yy.c ];then
+ # we must guarantee that config.h comes first
+ echo "#include \"config.h\"" > $base.c
+ sed -e "s|$base\.yy\.c|$DEST|" $base.yy.c >> $base.c
+ rm -f $base.yy.c
+ elif [ -r $base.c ];then
+ # we must guarantee that config.h comes first
+ mv $base.c $base.c.tmp
+ echo "#include \"config.h\"" > $base.c
+ sed -e "s|$base\.yy\.c|$DEST|" $base.c.tmp >> $base.c
+ rm -f $base.c.tmp
+ elif [ ! -r base.c ]; then
+ echo "$base.c nor $base.yy.c generated."
+ exit 1
+ fi
+fi
+cd $TOP
diff --git a/source4/build/make/python.mk b/source4/build/make/python.mk
new file mode 100644
index 0000000000..57bf0169fe
--- /dev/null
+++ b/source4/build/make/python.mk
@@ -0,0 +1,58 @@
+pythonbuilddir = $(builddir)/bin/python
+
+# Install Python
+# Arguments: Module path
+define python_module_template
+
+installpython:: $$(pythonbuilddir)/$(1) ;
+ cp $$< $$(DESTDIR)$$(PYTHONDIR)/$(1)
+
+uninstallpython::
+ rm -f $$(DESTDIR)$$(PYTHONDIR)/$(1) ;
+
+pythonmods:: $$(pythonbuilddir)/$(1) ;
+
+endef
+
+define python_py_module_template
+
+$$(pythonbuilddir)/$(1): $(2) ;
+ mkdir -p $$(@D)
+ cp $$< $$@
+
+$(call python_module_template,$(1))
+
+endef
+
+# Python C module
+# Arguments: Module path, object files
+define python_c_module_template
+
+$$(pythonbuilddir)/$(1): $(2) ;
+ @echo Linking $$@
+ @mkdir -p $$(@D)
+ @$$(MDLD) $$(LDFLAGS) $$(MDLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
+
+$(call python_module_template,$(1))
+endef
+
+# Swig extensions
+swig:: pythonmods
+
+.SUFFIXES: _wrap.c .i
+
+.i_wrap.c:
+ [ "$(SWIG)" == "no" ] || $(SWIG) -O -Wall -I$(srcdir)/scripting/swig -python -keyword $<
+
+realdistclean::
+ @echo "Removing SWIG output files"
+ # FIXME: Remove _wrap.c files
+
+pythonmods::
+
+clean::
+ @echo "Removing python modules"
+ @rm -rf $(pythonbuilddir)
+
+pydoctor:: pythonmods
+ LD_LIBRARY_PATH=bin/shared PYTHONPATH=$(pythonbuilddir) pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package $(pythonbuilddir)/samba
diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk
new file mode 100644
index 0000000000..44277fe3e2
--- /dev/null
+++ b/source4/build/make/rules.mk
@@ -0,0 +1,241 @@
+# Rules file for Samba 4
+# This relies on GNU make.
+#
+# Dependencies command
+DEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ \
+ $(CFLAGS) $(CPPFLAGS) $< -o $@
+# Dependencies for host objects
+HDEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ \
+ $(HOSTCC_FLAGS) $(CPPFLAGS) $< -o $@
+# Dependencies for precompiled headers
+PCHDEPENDS = $(CC) -M -MG -MT include/includes.h.gch -MT $@ \
+ $(CFLAGS) $(CPPFLAGS) $< -o $@
+
+# Run a static analysis checker
+CHECK = $(CC_CHECKER) $(CFLAGS) $(PICFLAG) $(CPPLAGS) -c $< -o $@
+
+# Run the configured compiler
+COMPILE = $(CC) $(CFLAGS) $(PICFLAG) \
+ $(CPPFLAGS) \
+ -c $< -o $@
+
+# Run the compiler for the build host
+HCOMPILE = $(HOSTCC) $(HOSTCC_FLAGS) $(CPPFLAGS) -c $< -o $@
+
+# Precompile headers
+PCHCOMPILE = @$(CC) -Ilib/replace \
+ $(CFLAGS) $(PICFLAG) $(CPPFLAGS) -c $< -o $@
+
+# Partial linking
+PARTLINK = @$(PROG_LD) -r
+
+make_utility_dir = $(srcdir)/build/make/
+
+include/config.h:
+ @echo "include/config.h not present"
+ @echo "You need to rerun ./autogen.sh and ./configure"
+ @/bin/false
+
+pch::
+
+clean:: clean_pch
+ @echo Removing objects
+ @-find . -name '*.o' -exec rm -f '{}' \;
+ @echo Removing hostcc objects
+ @-find . -name '*.ho' -exec rm -f '{}' \;
+ @echo Removing binaries
+ @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS)
+ @echo Removing libraries
+ @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
+ @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o
+ @echo Removing modules
+ @-rm -f bin/modules/*/*.$(SHLIBEXT)
+ @-rm -f bin/*_init_module.c
+ @echo Removing dummy targets
+ @-rm -f bin/.*_*
+ @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
+ -rm -f data.mk
+ -rm -f config.status
+ -rm -f config.log config.cache
+ -rm -f config.pm config.mk
+ -rm -f $(PC_FILES)
+
+removebackup::
+ -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
+
+realdistclean:: distclean removebackup
+ -rm -f include/config_tmp.h.in
+ -rm -f version.h
+ -rm -f configure
+ -rm -f $(MANPAGES)
+
+check:: test
+
+unused_macros:
+ $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
+
+# Create a static library
+%.a:
+ @echo Linking $@
+ @rm -f $@
+ @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) --all=$$@ $$^
+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
+
+###############################################################################
+# File types
+###############################################################################
+
+.SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .$(SHLIBEXT) .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho .idl .hd
+
+.c.d:
+ @echo "Generating dependencies for $<"
+ @$(DEPENDS)
+
+.c.hd:
+ @echo "Generating host-compiler dependencies for $<"
+ @$(HDEPENDS)
+
+include/includes.d: include/includes.h
+ @echo "Generating dependencies for $<"
+ @$(PCHDEPENDS)
+
+.c.o:
+ @if test -n "$(CC_CHECKER)"; then \
+ echo "Checking $< with '$(CC_CHECKER)'"; \
+ $(CHECK) ; \
+ fi
+ @echo "Compiling $<"
+ @-mkdir -p `dirname $@`
+ @$(COMPILE) && exit 0 ; \
+ echo "The following command failed:" 1>&2;\
+ $(COMPILE) >/dev/null 2>&1
+
+
+# echo "$(COMPILE)" 1>&2;\
+
+.c.ho:
+ @echo "Compiling $< with host compiler"
+ @-mkdir -p `dirname $@`
+ @$(HCOMPILE) && exit 0;\
+ echo "The following command failed:" 1>&2;\
+ echo "$(HCOMPILE)" 1>&2;\
+ $(HCOMPILE) >/dev/null 2>&1
+
+.h.h.gch:
+ @echo "Precompiling $<"
+ @$(PCHCOMPILE)
+
+.y.c:
+ @echo "Building $< with $(YACC)"
+ @-$(make_utility_dir)/yacc_compile.sh "$(YACC)" "$<" "$@"
+
+.l.c:
+ @echo "Building $< with $(LEX)"
+ @-$(make_utility_dir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
+
+%.a:
+ @echo Linking $@
+ @rm -f $@
+ @mkdir -p $(@D)
+ @$(STLD) $(STLD_FLAGS) $@ $^
+
+
+DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
+
+.1.xml.1:
+ $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
+
+.3.xml.3:
+ $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
+
+.5.xml.5:
+ $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
+
+.7.xml.7:
+ $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
+
+.8.xml.8:
+ $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
+
+dist:: idl_full manpages configure distclean
+
+configure:
+ ./autogen.sh
+
+showflags::
+ @echo 'Samba will be compiled with flags:'
+ @echo ' CPP = $(CPP)'
+ @echo ' CPPFLAGS = $(CPPFLAGS)'
+ @echo ' CC = $(CC)'
+ @echo ' CFLAGS = $(CFLAGS)'
+ @echo ' PICFLAG = $(PICFLAG)'
+ @echo ' BNLD = $(BNLD)'
+ @echo ' BNLD_FLAGS = $(BNLD_FLAGS)'
+ @echo ' STLD = $(STLD)'
+ @echo ' STLD_FLAGS = $(STLD_FLAGS)'
+ @echo ' SHLD = $(SHLD)'
+ @echo ' SHLD_FLAGS = $(SHLD_FLAGS)'
+ @echo ' MDLD = $(MDLD)'
+ @echo ' MDLD_FLAGS = $(MDLD_FLAGS)'
+ @echo ' SHLIBEXT = $(SHLIBEXT)'
+
+etags:
+ etags `find $(srcdir) -name "*.[ch]"`
+
+ctags:
+ ctags `find $(srcdir) -name "*.[ch]"`
diff --git a/source4/build/make/yacc_compile.sh b/source4/build/make/yacc_compile.sh
new file mode 100755
index 0000000000..a56a51da0a
--- /dev/null
+++ b/source4/build/make/yacc_compile.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+YACC="$1"
+SRC="$2"
+DEST="$3"
+
+dir=`dirname $SRC`
+file=`basename $SRC`
+base=`basename $SRC .y`
+if [ -z "$YACC" ]; then
+ # if $DEST is more recent than $SRC, we can just touch
+ # otherwise we touch but print out warnings
+ if [ -r $DEST ]; then
+ if [ x`find $SRC -newer $DEST -print` = x$SRC ]; then
+ echo "warning: yacc not found - cannot generate $SRC => $DEST" >&2
+ echo "warning: yacc not found - only updating the timestamp of $DEST" >&2
+ fi
+ touch $DEST;
+ exit;
+ fi
+ echo "error: yacc not found - cannot generate $SRC => $DEST" >&2
+ exit 1;
+fi
+# if $DEST is more recent than $SRC, we can just touch
+if [ -r $DEST ]; then
+ if [ x`find $SRC -newer $DEST -print` != x$SRC ]; then
+ touch $DEST;
+ exit;
+ fi
+fi
+TOP=`pwd`
+if cd $dir && $YACC -d $file; then
+ if [ -r y.tab.h -a -r y.tab.c ];then
+ #echo "info: move files"
+ sed -e "/^#/!b" -e "s|y\.tab\.h|$SRC|" -e "s|\"$base.y|\"$SRC|" y.tab.h > $base.h
+ sed -e "s|y\.tab\.c|$SRC|" -e "s|\"$base.y|\"$SRC|" y.tab.c > $base.c
+ rm -f y.tab.c y.tab.h
+ elif [ ! -r $base.h -a ! -r $base.c]; then
+ echo "$base.h nor $base.c generated."
+ exit 1
+ fi
+fi
+cd $TOP
diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm
index d8ec646910..c5e0ac5a74 100644
--- a/source4/build/smb_build/config_mk.pm
+++ b/source4/build/smb_build/config_mk.pm
@@ -23,14 +23,11 @@ my $section_types = {
SWIG_FILE => "string",
"PRIVATE_DEPENDENCIES" => "list",
"PUBLIC_DEPENDENCIES" => "list",
- "OBJ_FILES" => "list",
"ENABLE" => "bool",
"LDFLAGS" => "list",
"CFLAGS" => "list",
},
"SUBSYSTEM" => {
- "OBJ_FILES" => "list",
-
"PRIVATE_DEPENDENCIES" => "list",
"PUBLIC_DEPENDENCIES" => "list",
@@ -47,7 +44,6 @@ my $section_types = {
"SUBSYSTEM" => "string",
"INIT_FUNCTION" => "string",
- "OBJ_FILES" => "list",
"PRIVATE_DEPENDENCIES" => "list",
@@ -62,7 +58,6 @@ my $section_types = {
"CFLAGS" => "list"
},
"BINARY" => {
- "OBJ_FILES" => "list",
"PRIVATE_DEPENDENCIES" => "list",
@@ -88,8 +83,6 @@ my $section_types = {
"INIT_FUNCTION_SENTINEL" => "string",
"OUTPUT_TYPE" => "list",
- "OBJ_FILES" => "list",
-
"PRIVATE_DEPENDENCIES" => "list",
"PUBLIC_DEPENDENCIES" => "list",
@@ -223,6 +216,9 @@ sub run_config_mk($$$$)
{
$section = $1;
$infragment = 0;
+
+ $result->{$section}{EXISTS}{KEY} = "EXISTS";
+ $result->{$section}{EXISTS}{VAL} = 1;
next;
}
@@ -233,6 +229,7 @@ sub run_config_mk($$$$)
$subdir =~ s/^\.$//g;
$subdir =~ s/^\.\///g;
$subdir .= "/" if ($subdir ne "");
+ $makefile .= "basedir := $subdir\n";
$makefile .= run_config_mk($input, $srcdir, $builddir, $subdir.$subfile);
next;
}
@@ -251,7 +248,6 @@ sub run_config_mk($$$$)
$infragment = 1;
next;
}
-
# Assignment
if ($line =~ /^([a-zA-Z0-9_]+)[\t ]*=(.*)$/) {
@@ -280,6 +276,7 @@ sub run_config_mk($$$$)
$input->{$name}{BASEDIR} = $basedir;
foreach my $key (values %{$result->{$section}}) {
+ next if ($key->{KEY} eq "EXISTS");
$key->{VAL} = smb_build::input::strtrim($key->{VAL});
my $vartype = $sectype->{$key->{KEY}};
if (not defined($vartype)) {
diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm
deleted file mode 100644
index c2bdbaf4c8..0000000000
--- a/source4/build/smb_build/header.pm
+++ /dev/null
@@ -1,92 +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";
- unless (/{/) {
- my $fn = $key->{INIT_FUNCTION_TYPE};
- my $n = $_;
- if ($fn =~ /\(\*\)/) {
- $fn =~ s/\(\*\)/$n/;
- $output .= "$fn;\n";
- } else {
- $n =~ s/\&//;
- $output .= "$fn $n;\n";
- }
- }
- }
-
- $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 948f2657b4..eb20a686c1 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -107,7 +107,7 @@ sub check_module($$$)
}
if (grep(/MERGED_OBJ/, @{$mod->{OUTPUT_TYPE}})) {
push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
- unshift (@{$INPUT->{$mod->{SUBSYSTEM}}{PRIVATE_DEPENDENCIES}}, $mod->{NAME});
+ push (@{$INPUT->{$mod->{SUBSYSTEM}}{PRIVATE_DEPENDENCIES}}, $mod->{NAME});
}
}
@@ -151,7 +151,6 @@ sub check_python($$$)
$dirname .= "/" unless $dirname =~ /\/$/;
$dirname = "" if $dirname eq "./";
- $python->{OBJ_FILES} = ["$dirname$basename\_wrap.o"];
$python->{LIBRARY_REALNAME} = "_$basename.\$(SHLIBEXT)";
$python->{PYTHON_FILES} = ["$dirname$basename.py"];
push (@{$python->{CFLAGS}}, "\$(CFLAG_NO_UNUSED_MACROS)");
@@ -189,7 +188,6 @@ sub add_implicit($$)
$INPUT->{$n} = {
TYPE => "MAKE_RULE",
NAME => $n,
- TARGET => "",
OUTPUT_TYPE => undef,
LIBS => ["\$(".uc($n)."_LIBS)"],
LDFLAGS => ["\$(".uc($n)."_LDFLAGS)"],
@@ -249,7 +247,7 @@ sub check($$$$$)
foreach my $part (values %$INPUT) {
$part->{LINK_FLAGS} = [];
- $part->{FULL_OBJ_LIST} = ["\$($part->{NAME}_OBJ_LIST)"];
+ $part->{FULL_OBJ_LIST} = ["\$($part->{NAME}_OBJ_FILES)"];
if ($part->{TYPE} eq "SUBSYSTEM") {
check_subsystem($INPUT, $part, $subsys_ot);
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index c3dc46461b..cb7bf7439e 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -6,7 +6,6 @@
# 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;
@@ -51,8 +50,8 @@ foreach my $key (values %$OUTPUT) {
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->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
if (defined($key->{PC_FILE})) {
$mkenv->output("PC_FILES += $key->{BASEDIR}/$key->{PC_FILE}\n");
}
@@ -62,27 +61,35 @@ foreach my $key (values %$OUTPUT) {
${$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});
- $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER});
+ 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);
}
foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
+ $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
+}
+
+foreach my $key (values %$OUTPUT) {
+ next unless defined $key->{OUTPUT_TYPE};
+
+ $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
$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}) or
+ defined($key->{PUBLIC_PROTO_HEADER});
+ $mkenv->InitFunctions($key) if defined($key->{INIT_FUNCTIONS});
}
$mkenv->write("data.mk");
-header::create_smb_build_h($OUTPUT, "include/build.h");
summary::show($OUTPUT, \%config::config);
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 03198fd944..f25872d4bf 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -23,12 +23,11 @@ sub new($$$)
$self->{output} = "";
- $self->{mkfile} = $mkfile;
-
$self->output("################################################\n");
$self->output("# Autogenerated by build/smb_build/makefile.pm #\n");
$self->output("################################################\n");
$self->output("\n");
+ $self->output($mkfile);
return $self;
}
@@ -73,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($)
@@ -113,45 +102,43 @@ sub _prepare_list($$$)
$self->output("$ctx->{NAME}_$var =$tmplist\n");
}
-sub SharedModulePrimitives($$)
+sub PythonModule($$)
{
my ($self,$ctx) = @_;
-
- #FIXME
+
+ $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");
+
+ $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("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\@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");
+ $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");
- }
+ if (defined($ctx->{ALIASES})) {
+ foreach (@{$ctx->{ALIASES}}) {
+ $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
}
}
@@ -160,47 +147,19 @@ sub SharedModule($$)
$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} =~ /\(\*\)/) {
+ $self->output("\$($ctx->{NAME}_OBJ_FILES): CFLAGS+=-D$ctx->{INIT_FUNCTION}=init_module\n");
}
- $self->output(<< "__EOD__"
-#
-
-$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__
-);
+ $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");
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("$ctx->{SHAREDDIR}/$_.\$(SHLIBEXT): $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n");
+ $self->output("\t\@ln -fs \$(<F) \$@\n");
+ $self->output("PLUGINS += $ctx->{SHAREDDIR}/$_.\$(SHLIBEXT)\n");
}
}
- $self->output("\n");
}
sub SharedLibraryPrimitives($$)
@@ -220,7 +179,7 @@ sub SharedLibrary($$)
{
my ($self,$ctx) = @_;
- $self->output("SHARED_LIBS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n") if (defined($ctx->{SO_VERSION}));
+ $self->output("SHARED_LIBS += $ctx->{RESULT_SHARED_LIBRARY}\n") if (defined($ctx->{SO_VERSION}));
$self->_prepare_list($ctx, "DEPEND_LIST");
$self->_prepare_list($ctx, "LINK_FLAGS");
@@ -233,14 +192,14 @@ $ctx->{RESULT_SHARED_LIBRARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL
\$($ctx->{NAME}\_FULL_OBJ_LIST) \\
\$($ctx->{NAME}_LINK_FLAGS) \\
\$(if \$(SONAMEFLAG), \$(SONAMEFLAG)$ctx->{LIBRARY_SONAME})
+ifneq ($ctx->{LIBRARY_REALNAME}, $ctx->{LIBRARY_SONAME})
+ \@test \$($ctx->{NAME}_VERSION) = \$($ctx->{NAME}_SOVERSION) || ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}
+endif
+ifdef $ctx->{NAME}_SOVERSION
+ \@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}
+endif
__EOD__
);
- if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) {
- $self->output("\t\@test \$($ctx->{NAME}_VERSION) = \$($ctx->{NAME}_SOVERSION) || ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}\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");
}
sub MergedObj($$)
@@ -250,28 +209,29 @@ sub MergedObj($$)
return unless defined($ctx->{OUTPUT});
$self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
- $self->output(<< "__EOD__"
-#
-$ctx->{RESULT_MERGED_OBJ}: \$($ctx->{NAME}_OBJ_LIST)
- \@echo Partially linking \$@
- \@mkdir -p \$(\@D)
- \$(PARTLINK) -o \$@ \$($ctx->{NAME}_OBJ_LIST)
-
-__EOD__
-);
+ $self->output("\$(call partial_link_template, \$($ctx->{NAME}_OUTPUT), \$($ctx->{NAME}_OBJ_FILES))\n");
}
-sub StaticLibrary($$)
+sub StaticLibraryPrimitives($$)
{
my ($self,$ctx) = @_;
- return unless (defined($ctx->{OBJ_FILES}));
-
- $self->output("STATIC_LIBS += $ctx->{TARGET_STATIC_LIBRARY}\n") if ($ctx->{TYPE} eq "LIBRARY");
-
$self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
+}
+
+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->{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");
}
@@ -280,37 +240,21 @@ 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__
- );
+$self->output("\$(call binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n");
}
}
@@ -319,10 +263,7 @@ sub PythonFiles($$)
my ($self,$ctx) = @_;
foreach (@{$ctx->{PYTHON_FILES}}) {
- my $target = "bin/python/".basename($_);
- my $source = output::add_dir_str($ctx->{BASEDIR}, $_);
- $self->output("$target: $source\n\n");
- $self->output("PYTHON_PYS += $target\n");
+ $self->output("\$(eval \$(call python_py_module_template," . basename($_) . ",\$(addprefix $ctx->{BASEDIR}/, $_)))\n");
}
}
@@ -330,25 +271,17 @@ sub ProtoHeader($$)
{
my ($self,$ctx) = @_;
- my $priv = output::add_dir_str($ctx->{BASEDIR}, $ctx->{PRIVATE_PROTO_HEADER});
- $self->output("PROTO_HEADERS += $priv\n");
-
- $self->output("$priv: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_LIST:.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) --all=\$@ \$($ctx->{NAME}_OBJ_LIST)\n\n");
+ 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) = @_;
- $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n");
-
$self->_prepare_mk_files();
- $self->output($self->{mkfile});
-
open(MAKEFILE,">$file") || die ("Can't open $file\n");
print MAKEFILE $self->{output};
close(MAKEFILE);
@@ -374,7 +307,6 @@ sub CFlags($$)
my $src_ne_build = ($srcdir ne $builddir) ? 1 : 0;
- return unless defined ($key->{OBJ_LIST});
return unless defined ($key->{FINAL_CFLAGS});
return unless (@{$key->{FINAL_CFLAGS}} > 0);
@@ -388,19 +320,19 @@ sub CFlags($$)
my @cflags = ();
foreach my $flag (@sorted_cflags) {
if($src_ne_build) {
- if($flag =~ m#^-I([^/].*$)#) {
- my $dir = $1;
- $dir =~ s#^\$\((?:src|build)dir\)/?##;
+ if($flag =~ m#^-I([^/].*$)#) {
+ my $dir = $1;
+ $dir =~ s#^\$\((?:src|build)dir\)/?##;
push(@cflags, "-I$builddir/$dir", "-I$srcdir/$dir");
- next;
- }
+ next;
+ }
}
push(@cflags, $flag);
}
my $cflags = join(' ', @cflags);
- $self->output("\$(patsubst %.ho,%.d,\$($key->{NAME}_OBJ_LIST:.o=.d)) \$($key->{NAME}_OBJ_LIST): CFLAGS+= $cflags\n");
+ $self->output("\$(patsubst %.ho,%.d,\$($key->{NAME}_OBJ_FILES:.o=.d)) \$($key->{NAME}_OBJ_FILES): CFLAGS+= $cflags\n");
}
1;
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 4ae4a62cf4..b2737b0929 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -9,38 +9,6 @@ package output;
use strict;
use smb_build::config;
-sub add_dir_str($$)
-{
- my ($dir,$file) = @_;
- my $dirsep = "/";
-
- $dir =~ s/^\.$//g;
- $dir =~ s/^\.\///g;
-
- $dirsep = "" if ($dir eq "");
-
- my $ret = $file;
- if (substr($ret, 0, 1) ne "\$") {
- $ret = "$dir$dirsep$file";
- $ret =~ s/([^\/\.]+)\/\.\.\///g;
- $ret =~ s/([^\/\.]+)\/\.\.\///g;
- }
-
- return $ret;
-}
-
-sub add_dir_array($$)
-{
- my ($dir,$files) = @_;
- my @ret = ();
-
- foreach (@{$files}) {
- push (@ret, add_dir_str($dir, $_));
- }
-
- return @ret;
-}
-
sub generate_shared_library($)
{
my $lib = shift;
@@ -97,11 +65,9 @@ sub generate_merged_obj($)
my $link_name = $lib->{NAME};
$link_name =~ s/^LIB//;
- if (defined($lib->{OBJ_FILES})) {
- $lib->{MERGED_OBJNAME} = lc($link_name).".o";
- $lib->{RESULT_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}";
- $lib->{TARGET_MERGED_OBJ} = $lib->{RESULT_MERGED_OBJ};
- }
+ $lib->{MERGED_OBJNAME} = lc($link_name).".o";
+ $lib->{RESULT_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}";
+ $lib->{TARGET_MERGED_OBJ} = $lib->{RESULT_MERGED_OBJ};
}
sub generate_static_library($)
@@ -116,12 +82,10 @@ sub generate_static_library($)
$lib->{LIBRARY_NAME} = "lib".lc($link_name).".a";
- if (defined($lib->{OBJ_FILES})) {
- $lib->{RESULT_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}";
- $lib->{TARGET_STATIC_LIBRARY} = $lib->{RESULT_STATIC_LIBRARY};
- $lib->{STATICDIR} = 'bin/static';
- $lib->{OUTPUT_STATIC_LIBRARY} = "-l".lc($link_name);
- }
+ $lib->{RESULT_STATIC_LIBRARY} = "bin/static/$lib->{LIBRARY_NAME}";
+ $lib->{TARGET_STATIC_LIBRARY} = $lib->{RESULT_STATIC_LIBRARY};
+ $lib->{STATICDIR} = 'bin/static';
+ $lib->{OUTPUT_STATIC_LIBRARY} = "-l".lc($link_name);
}
sub generate_binary($)
@@ -160,10 +124,6 @@ sub create_output($$)
foreach $part (values %{$depend}) {
next unless(defined($part->{OUTPUT_TYPE}));
- # Combine object lists
- my @list = add_dir_array($part->{BASEDIR}, $part->{OBJ_FILES});
- push(@{$part->{OBJ_LIST}}, @list) if defined($part->{OBJ_FILES});
-
generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}});
generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}});
generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}});
@@ -197,7 +157,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}));
}
}
}