1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

Automatically write AC_SUBST() vars to mkconfig.mk and use them.

(This used to be commit a22bb7725b0b825a90e955f883a34341e9f0f69e)
This commit is contained in:
Jelmer Vernooij 2008-02-11 00:21:20 +01:00
parent 73be46cf45
commit 1813b711c4
4 changed files with 73 additions and 149 deletions

View File

@ -50,8 +50,6 @@ sub new($$$)
$self->output("default: all\n\n");
$self->_prepare_path_vars();
$self->_prepare_suffix_rules();
$self->_prepare_compiler_linker();
if (!$self->{automatic_deps}) {
@ -69,57 +67,6 @@ sub output($$)
$self->{output} .= $text;
}
sub _prepare_path_vars($)
{
my ($self) = @_;
$self->output(<< "__EOD__"
prefix = $self->{config}->{prefix}
exec_prefix = $self->{config}->{exec_prefix}
selftest_prefix = $self->{config}->{selftest_prefix}
builddir = $self->{config}->{builddir}
srcdir = $self->{config}->{srcdir}
datarootdir = $self->{config}->{datarootdir}
VPATH = \$(builddir):\$(srcdir):heimdal_build:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
BASEDIR = $self->{config}->{prefix}
BINDIR = $self->{config}->{bindir}
SBINDIR = $self->{config}->{sbindir}
LIBDIR = $self->{config}->{libdir}
TORTUREDIR = $self->{config}->{libdir}/torture
MODULESDIR = $self->{config}->{modulesdir}
INCLUDEDIR = $self->{config}->{includedir}
CONFIGDIR = $self->{config}->{sysconfdir}
DATADIR = $self->{config}->{datadir}
SWATDIR = \$(DATADIR)/swat
JSDIR = \$(DATADIR)/js
SETUPDIR = \$(DATADIR)/setup
VARDIR = $self->{config}->{localstatedir}
LOGFILEBASE = $self->{config}->{logfilebase}
NCALRPCDIR = $self->{config}->{localstatedir}/ncalrpc
LOCKDIR = $self->{config}->{lockdir}
PIDDIR = $self->{config}->{piddir}
MANDIR = $self->{config}->{mandir}
PRIVATEDIR = $self->{config}->{privatedir}
WINBINDD_SOCKET_DIR = $self->{config}->{winbindd_socket_dir}
__EOD__
);
}
sub _prepare_suffix_rules($)
{
my ($self) = @_;
$self->output(<< "__EOD__"
FIRST_PREREQ = $self->{config}->{FIRST_PREREQ}
__EOD__
);
}
sub _prepare_compiler_linker($)
{
my ($self) = @_;
@ -140,54 +87,22 @@ sub _prepare_compiler_linker($)
}
$self->output(<< "__EOD__"
SHELL=$self->{config}->{SHELL}
PERL=$self->{config}->{PERL}
PYTHON=$self->{config}->{PYTHON}
SWIG=$self->{config}->{SWIG}
CPP=$self->{config}->{CPP}
CPPFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $self->{config}->{CPPFLAGS}
CC=$self->{config}->{CC}
CFLAGS=$self->{config}->{CFLAGS}
CFLAG_NO_UNUSED_MACROS=$self->{config}->{CFLAG_NO_UNUSED_MACROS}
PICFLAG=$self->{config}->{PICFLAG}
INSTALL_LINK_FLAGS=$extra_link_flags
BNLD=$self->{config}->{LD}
BNLD_FLAGS=$self->{config}->{LDFLAGS} -L$libdir
STLD=$self->{config}->{STLD}
STLD_FLAGS=$self->{config}->{STLD_FLAGS}
SHLD=$self->{config}->{SHLD}
SHLD_FLAGS=$self->{config}->{SHLD_FLAGS} -L\$(builddir)/bin/shared
MDLD=$self->{config}->{MDLD}
MDLD_FLAGS=$self->{config}->{MDLD_FLAGS} -L\$(builddir)/bin/shared
SHLIBEXT=$self->{config}->{SHLIBEXT}
HOSTCC=$self->{config}->{HOSTCC}
HOSTCC_FLAGS=-D_SAMBA_HOSTCC_ \$(CFLAGS)
HOSTLD=$self->{config}->{HOSTLD}
HOSTLD_FLAGS=$self->{config}->{LDFLAGS}
XSLTPROC=$self->{config}->{XSLTPROC}
LIB_PATH_VAR=$self->{config}->{LIB_PATH_VAR}
LEX=$self->{config}->{LEX}
YACC=$self->{config}->{YACC}
YAPP=$self->{config}->{YAPP}
GCOV=$self->{config}->{GCOV}
DEFAULT_TEST_OPTIONS=$self->{config}->{DEFAULT_TEST_OPTIONS}
__EOD__
);
}
@ -281,16 +196,16 @@ sub SharedModule($$)
} else {
push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}");
push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
$self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
$self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/\n";
$self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
$self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
$self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
$self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
$self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n";
$self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
$self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
$self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
if (defined($ctx->{ALIASES})) {
foreach (@{$ctx->{ALIASES}}) {
$self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
$self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
$self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
$self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
$self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
$self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
}
}
}

View File

@ -205,7 +205,7 @@ fi
echo "configure: creating mkconfig.mk"
cat >mkconfig.mk<<CEOF
# mkconfig.mk - Autogenerated by configure, DO NOT EDIT!
dnl AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
dnl AC_Var = $AC_Var])
AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_VARS]), [
AC_Var = $AC_Var])
$MAKE_SETTINGS
CEOF

View File

@ -4,20 +4,20 @@ OBJ_FILES = dynconfig.o
# 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))
CONFIGFILE = $(CONFIGDIR)/smb.conf
CONFIGFILE = $(sysconfdir)/smb.conf
PKGCONFIGDIR = $(LIBDIR)/pkgconfig
LMHOSTSFILE = $(CONFIGDIR)/lmhosts
LMHOSTSFILE = $(sysconfdir)/lmhosts
PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" \
-DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
-DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DDATADIR=\"$(DATADIR)\" \
-DLOGFILEBASE=\"$(LOGFILEBASE)\" \
-DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
-DBINDIR=\"$(bindir)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
-DLOCKDIR=\"$(lockdir)\" -DPIDDIR=\"$(piddir)\" -DDATADIR=\"$(datadir)\" \
-DLOGFILEBASE=\"$(logfilebase)\" \
-DCONFIGDIR=\"$(sysconfdir)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
-DSWATDIR=\"$(SWATDIR)\" \
-DPRIVATE_DIR=\"$(PRIVATEDIR)\" \
-DMODULESDIR=\"$(MODULESDIR)\" -DJSDIR=\"$(JSDIR)\" \
-DPRIVATE_DIR=\"$(privatedir)\" \
-DMODULESDIR=\"$(modulesdir)\" -DJSDIR=\"$(JSDIR)\" \
-DTORTUREDIR=\"$(TORTUREDIR)\" \
-DSETUPDIR=\"$(SETUPDIR)\" -DWINBINDD_SOCKET_DIR=\"$(WINBINDD_SOCKET_DIR)\"
-DSETUPDIR=\"$(SETUPDIR)\" -DWINBINDD_SOCKET_DIR=\"$(winbindd_socket_dir)\"
dynconfig.o: dynconfig.c Makefile
@echo Compiling $<

View File

@ -1,3 +1,12 @@
VPATH = $(builddir):$(srcdir):heimdal_build:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
BASEDIR = $(prefix)
TORTUREDIR = $(libdir)/torture
SWATDIR = $(datadir)/swat
JSDIR = $(datadir)/js
SETUPDIR = $(datadir)/setup
NCALRPCDIR = $(localstatedir)/ncalrpc
default: all
include dynconfig.mk
@ -54,23 +63,23 @@ testsuite:: bin/smbclient bin/cifsdd bin/smbtorture bin/nmblookup
showlayout::
@echo 'Samba will be installed into:'
@echo ' basedir: $(BASEDIR)'
@echo ' bindir: $(BINDIR)'
@echo ' sbindir: $(SBINDIR)'
@echo ' libdir: $(LIBDIR)'
@echo ' modulesdir: $(MODULESDIR)'
@echo ' includedir: $(INCLUDEDIR)'
@echo ' vardir: $(VARDIR)'
@echo ' privatedir: $(PRIVATEDIR)'
@echo ' piddir: $(PIDDIR)'
@echo ' lockdir: $(LOCKDIR)'
@echo ' logfilebase: $(LOGFILEBASE)'
@echo ' bindir: $(bindir)'
@echo ' sbindir: $(sbindir)'
@echo ' libdir: $(libdir)'
@echo ' modulesdir: $(modulesdir)'
@echo ' includedir: $(includedir)'
@echo ' vardir: $(localstatedir)'
@echo ' privatedir: $(privatedir)'
@echo ' piddir: $(piddir)'
@echo ' lockdir: $(lockdir)'
@echo ' logfilebase: $(logfilebase)'
@echo ' setupdir: $(SETUPDIR)'
@echo ' jsdir: $(JSDIR)'
@echo ' swatdir: $(SWATDIR)'
@echo ' mandir: $(MANDIR)'
@echo ' mandir: $(mandir)'
@echo ' torturedir: $(TORTUREDIR)'
@echo ' datadir: $(DATADIR)'
@echo ' winbindd_socket_dir: $(WINBINDD_SOCKET_DIR)'
@echo ' datadir: $(datadir)'
@echo ' winbindd_socket_dir: $(winbindd_socket_dir)'
showflags::
@echo ' srcdir = $(srcdir)'
@ -93,37 +102,37 @@ install:: showlayout everything installbin installdat installswat installmisc in
installdirs::
@$(SHELL) $(srcdir)/script/installdirs.sh \
$(DESTDIR)$(BASEDIR) \
$(DESTDIR)$(BINDIR) \
$(DESTDIR)$(SBINDIR) \
$(DESTDIR)$(bindir) \
$(DESTDIR)$(sbindir) \
$(DESTDIR)$(TORTUREDIR) \
$(DESTDIR)$(LIBDIR) \
$(DESTDIR)$(MODULESDIR) \
$(DESTDIR)$(MANDIR) \
$(DESTDIR)$(VARDIR) \
$(DESTDIR)$(PRIVATEDIR) \
$(DESTDIR)$(DATADIR) \
$(DESTDIR)$(PIDDIR) \
$(DESTDIR)$(LOCKDIR) \
$(DESTDIR)$(LOGFILEBASE) \
$(DESTDIR)$(PRIVATEDIR)/tls \
$(DESTDIR)$(INCLUDEDIR) \
$(DESTDIR)$(libdir) \
$(DESTDIR)$(modulesdir) \
$(DESTDIR)$(mandir) \
$(DESTDIR)$(localstatedir) \
$(DESTDIR)$(privatedir) \
$(DESTDIR)$(datadir) \
$(DESTDIR)$(piddir) \
$(DESTDIR)$(lockdir) \
$(DESTDIR)$(logfilebase) \
$(DESTDIR)$(privatedir)/tls \
$(DESTDIR)$(includedir) \
$(DESTDIR)$(PKGCONFIGDIR) \
$(DESTDIR)$(CONFIGDIR) \
$(DESTDIR)$(sysconfdir) \
installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
@$(SHELL) $(srcdir)/script/installbin.sh \
$(INSTALLPERMS) \
$(DESTDIR)$(BASEDIR) \
$(DESTDIR)$(SBINDIR) \
$(DESTDIR)$(LIBDIR) \
$(DESTDIR)$(VARDIR) \
$(DESTDIR)$(sbindir) \
$(DESTDIR)$(libdir) \
$(DESTDIR)$(localstatedir) \
$(SBIN_PROGS)
@$(SHELL) $(srcdir)/script/installbin.sh \
$(INSTALLPERMS) \
$(DESTDIR)$(BASEDIR) \
$(DESTDIR)$(BINDIR) \
$(DESTDIR)$(LIBDIR) \
$(DESTDIR)$(VARDIR) \
$(DESTDIR)$(bindir) \
$(DESTDIR)$(libdir) \
$(DESTDIR)$(localstatedir) \
$(BIN_PROGS)
@$(SHELL) $(srcdir)/script/installtorture.sh \
$(INSTALLPERMS) \
@ -131,23 +140,23 @@ installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
$(TORTURE_PROGS)
installlib:: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS)
#@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) "$(STLIBEXT)" $(STATIC_LIBS)
@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS)
#@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(STLIBEXT)" $(STATIC_LIBS)
installheader:: headers installdirs
@srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
@srcdir=$(srcdir) builddir=$(builddir) $(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(includedir) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
installdat:: installdirs
@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)
@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(datadir) $(srcdir)
installswat:: installdirs
@$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
installman:: manpages installdirs
@$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
@$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(mandir) $(MANPAGES)
installmisc:: installdirs
@$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(BINDIR)
@$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(JSDIR) $(DESTDIR)$(SETUPDIR) $(DESTDIR)$(bindir)
installpc:: installdirs
@$(SHELL) $(srcdir)/script/installpc.sh $(builddir) $(DESTDIR)$(PKGCONFIGDIR) $(PC_FILES)
@ -159,19 +168,19 @@ uninstallmisc::
#FIXME
uninstallbin::
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(sbindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(SBIN_PROGS)
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(localstatedir) $(DESTDIR)$(BIN_PROGS)
@$(SHELL) $(srcdir)/script/uninstalltorture.sh $(DESTDIR)$(TORTUREDIR) $(TORTURE_PROGS)
uninstalllib::
@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(SHARED_LIBS)
#@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS)
@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(SHARED_LIBS)
#@$(SHELL) $(srcdir)/script/uninstalllib.sh $(DESTDIR)$(libdir) $(STATIC_LIBS)
uninstallheader::
@$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS)
@$(SHELL) $(srcdir)/script/uninstallheader.sh $(DESTDIR)$(includedir) $(PUBLIC_HEADERS)
uninstallman::
@$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
@$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES)
Makefile: config.status $(MK_FILES)
./config.status