From 86acf90e4335f79cd34e400d687930d922332d8f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 17 Sep 2005 13:08:49 +0000 Subject: r10294: Generate Makefile directly rather then thru Makefile.in. Autoconf substitution variables are now no longer used. This is one more step towards a (hopefully) perl-based configure (This used to be commit 6f9956a1dd870c0669c288b0fe72b7b1c8773dd0) --- source4/build/smb_build/main.pl | 2 +- source4/build/smb_build/makefile.pm | 88 +++++++++++++++++++++---------------- source4/build/smb_build/output.pm | 2 +- source4/configure.in | 5 ++- source4/lib/registry/config.mk | 2 +- source4/main.mk | 4 +- 6 files changed, 59 insertions(+), 44 deletions(-) (limited to 'source4') diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index e6a330e99d..677488312e 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -21,7 +21,7 @@ my $INPUT = {}; my $mkfile = smb_build::config_mk::run_config_mk($INPUT, "main.mk"); my $DEPEND = smb_build::input::check($INPUT, \%config::enabled); my $OUTPUT = output::create_output($DEPEND); -makefile::create_makefile_in($OUTPUT, $mkfile, "Makefile.in"); +makefile::create_makefile($OUTPUT, $mkfile, "Makefile"); smb_build_h::create_smb_build_h($OUTPUT, "include/smb_build.h"); open DOTTY, ">samba4-deps.dot"; diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index f0c17b693e..36183f210f 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -15,23 +15,43 @@ sub _prepare_path_vars() { my $output; - $output = << '__EOD__'; -prefix = @prefix@ -exec_prefix = @exec_prefix@ -selftest_prefix = @selftest_prefix@ -VPATH = @srcdir@ -srcdir = @srcdir@ -builddir = @builddir@ - -BASEDIR = @prefix@ -BINDIR = @bindir@ -SBINDIR = @sbindir@ -datadir = @datadir@ -LIBDIR = @libdir@ -CONFIGDIR = @configdir@ -localstatedir = @localstatedir@ -SWATDIR = @swatdir@ -VARDIR = @localstatedir@ + $config{srcdir} = '.'; + $config{builddir} = '.'; + + if ($config{prefix} eq "NONE") { + $config{prefix} = $config{ac_default_prefix}; + } + + if ($config{exec_prefix} eq "NONE") { + $config{exec_prefix} = $config{prefix}; + } + + $output = << "__EOD__"; +prefix = $config{prefix} +exec_prefix = $config{exec_prefix} +selftest_prefix = $config{selftest_prefix} +VPATH = $config{srcdir} +srcdir = $config{srcdir} +builddir = $config{builddir} + +BINDIR = $config{bindir} +SBINDIR = $config{sbindir} +datadir = $config{datadir} +LIBDIR = $config{libdir} +CONFIGDIR = $config{configdir} +localstatedir = $config{localstatedir} +SWATDIR = $config{swatdir} +VARDIR = $config{localstatedir} +LOGFILEBASE = $config{logfilebase} +NCALRPCDIR = $config{localstatedir}/ncalrpc +LOCKDIR = $config{lockdir} +PIDDIR = $config{piddir} +MANDIR = $config{mandir} +PRIVATEDIR = $config{privatedir} + +__EOD__ + + $output.= << '__EOD__'; # The permissions to give the executables INSTALLPERMS = 0755 @@ -39,27 +59,16 @@ INSTALLPERMS = 0755 # set these to where to find various files # These can be overridden by command line switches (see smbd(8)) # or in smb.conf (see smb.conf(5)) -LOGFILEBASE = @logfilebase@ CONFIGFILE = $(CONFIGDIR)/smb.conf LMHOSTSFILE = $(CONFIGDIR)/lmhosts -NCALRPCDIR = @localstatedir@/ncalrpc # This is where smbpasswd et al go -PRIVATEDIR = @privatedir@ SMB_PASSWD_FILE = $(PRIVATEDIR)/smbpasswd -# the directory where lock files go -LOCKDIR = @lockdir@ - -# the directory where pid files go -PIDDIR = @piddir@ - -MANDIR = @mandir@ - PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\" \ -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \ -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DLIBDIR=\"$(LIBDIR)\" \ - -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\" \ + -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"$(SHLIBEXT)\" \ -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \ -DSWATDIR=\"$(SWATDIR)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \ -DPRIVATE_DIR=\"$(PRIVATEDIR)\" @@ -91,12 +100,15 @@ STLD_FLAGS=-rc SHLD=$config{CC} SHLD_FLAGS=$config{LDSHFLAGS} +SONAMEFLAG=$config{SONAMEFLAG} +SHLIBEXT=$config{SHLIBEXT} XSLTPROC=$config{XSLTPROC} LEX=$config{LEX} YACC=$config{YACC} YAPP=$config{YAPP} +PIDL_ARGS=$config{PIDL_ARGS} GCOV=$config{GCOV} @@ -537,7 +549,7 @@ clean: heimdal_clean distclean: clean -rm -f bin/.dummy -rm -f include/config.h include/smb_build.h - -rm -f Makefile Makefile.in + -rm -f Makefile -rm -f config.status -rm -f config.log config.cache -rm -f samba4-deps.dot @@ -616,12 +628,12 @@ sub _prepare_rule_lists($) ########################################################### # This function prepares the output for Makefile # -# $output = _prepare_makefile_in($OUTPUT) +# $output = _prepare_makefile($OUTPUT) # # $OUTPUT - the global OUTPUT context # # $output - the resulting output buffer -sub _prepare_makefile_in($) +sub _prepare_makefile($) { my ($CTX) = @_; my $output; @@ -666,21 +678,21 @@ __EOD__ } ########################################################### -# This function creates Makefile.in from the OUTPUT +# This function creates Makefile from the OUTPUT # context # -# create_makefile_in($OUTPUT) +# create_makefile($OUTPUT) # # $OUTPUT - the global OUTPUT context # # $output - the resulting output buffer -sub create_makefile_in($$$) +sub create_makefile($$$) { my ($CTX, $mk, $file) = @_; - open(MAKEFILE_IN,">$file") || die ("Can't open $file\n"); - print MAKEFILE_IN _prepare_makefile_in($CTX) . $mk; - close(MAKEFILE_IN); + open(MAKEFILE,">$file") || die ("Can't open $file\n"); + print MAKEFILE _prepare_makefile($CTX) . $mk; + close(MAKEFILE); print "build/smb_build/main.pl: creating $file\n"; return; diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm index 68a0060b6c..f6c4a78274 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -37,7 +37,7 @@ sub generate_shared_library($) $lib->{LIBRARY_SONAME} = $lib->{LIBRARY_NAME}.".$lib->{MAJOR_VERSION}"; $lib->{LIBRARY_REALNAME} = $lib->{LIBRARY_SONAME}.".$lib->{MINOR_VERSION}.$lib->{RELEASE_VERSION}"; $lib->{TARGET} = "bin/lib$lib->{LIBRARY_REALNAME}"; - @{$lib->{LINK_FLAGS}} = ("\@SONAMEFLAG\@$lib->{LIBRARY_SONAME}"); + @{$lib->{LINK_FLAGS}} = ("\$(SONAMEFLAG)$lib->{LIBRARY_SONAME}"); } $lib->{OUTPUT} = "-l".lc($lib->{NAME}); } diff --git a/source4/configure.in b/source4/configure.in index 752b7ad52f..6da3a52c33 100644 --- a/source4/configure.in +++ b/source4/configure.in @@ -84,6 +84,8 @@ dnl Remove -I/usr/include/? from CFLAGS and CPPFLAGS CFLAGS_REMOVE_USR_INCLUDE(CFLAGS) CFLAGS_REMOVE_USR_INCLUDE(CPPFLAGS) +AC_SUBST(ac_default_prefix) + echo "configure: creating config.pm" cat >config.pm<