use strict;
use base 'smb_build::env';
+use Cwd 'abs_path';
sub new($$$)
{
$self->_prepare_path_vars();
$self->_prepare_compiler_linker();
+ if (!$self->{automatic_deps}) {
+ $self->output("ALL_PREDEP = proto\n");
+ $self->output(".NOTPARALLEL:\n");
+ }
+
return $self;
}
prefix = $self->{config}->{prefix}
exec_prefix = $self->{config}->{exec_prefix}
selftest_prefix = $self->{config}->{selftest_prefix}
-VPATH = $self->{config}->{srcdir}:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb
+VPATH = $self->{config}->{srcdir}:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
srcdir = $self->{config}->{srcdir}
builddir = $self->{config}->{builddir}
my $devld_local = "";
my $devld_install = "";
+ my $builddir_headers = "";
$self->{duplicate_build} = 0;
if ($self->{config}->{LIBRARY_OUTPUT_TYPE} eq "SHARED_LIBRARY") {
}
$devld_install = " -Wl,-rpath-link,\$(builddir)/bin";
}
+
+ if (!(abs_path($self->{config}->{srcdir}) eq abs_path($self->{config}->{builddir}))) {
+ $builddir_headers= "-I\$(builddir)/include -I\$(builddir) -I\$(builddir)/lib ";
+ }
$self->output(<< "__EOD__"
SHELL=$self->{config}->{SHELL}
CPPFLAGS=$self->{config}->{CPPFLAGS}
CC=$self->{config}->{CC}
-CFLAGS=-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -D_SAMBA_BUILD_ -DHAVE_CONFIG_H $self->{config}->{CFLAGS} \$(CPPFLAGS)
+CFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -D_SAMBA_BUILD_ -DHAVE_CONFIG_H $self->{config}->{CFLAGS} \$(CPPFLAGS)
PICFLAG=$self->{config}->{PICFLAG}
HOSTCC=$self->{config}->{HOSTCC}
LDFLAGS=$self->{config}->{LDFLAGS} -L\$(builddir)/bin
STLD=$self->{config}->{AR}
-STLD_FLAGS=-rc -L\$(builddir)/bin
+STLD_FLAGS=-rc
SHLD=$self->{config}->{CC}
SHLD_FLAGS=$self->{config}->{LDSHFLAGS} -L\$(builddir)/bin
my $self = shift;
my @tmp = ();
-
foreach (@smb_build::config_mk::parsed_files) {
s/ .*$//g;
push (@tmp, $_);
}
if ($ctx->{TYPE} eq "LIBRARY") {
- push (@{$self->{shared_libs}}, "$ctx->{DEBUGDIR}/$ctx->{LIBRARY_REALNAME}");
- push (@{$self->{installable_shared_libs}}, "$installdir/$ctx->{LIBRARY_REALNAME}");
+ push (@{$self->{shared_libs}}, "$ctx->{DEBUGDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
+ push (@{$self->{installable_shared_libs}}, "$installdir/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
} elsif ($ctx->{TYPE} eq "MODULE") {
- push (@{$self->{shared_modules}}, "$ctx->{DEBUGDIR}/$ctx->{LIBRARY_REALNAME}");
+ push (@{$self->{shared_modules}}, "$ctx->{TARGET}");
push (@{$self->{plugins}}, "$installdir/$ctx->{LIBRARY_REALNAME}");
- my $fixedname = $ctx->{NAME};
-
- $fixedname =~ s/^$ctx->{SUBSYSTEM}_//g;
-
- $self->{install_plugins} .= "\t\@echo Installing $installdir/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$fixedname.\$(SHLIBEXT)\n";
+ $self->{install_plugins} .= "\t\@echo Installing $installdir/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{LIBRARY_REALNAME}\n";
$self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/\n";
- $self->{install_plugins} .= "\t\@cp $installdir/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$fixedname.\$(SHLIBEXT)\n";
- $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$fixedname.\$(SHLIBEXT)\n";
- $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$fixedname.\$(SHLIBEXT)\n";
+ $self->{install_plugins} .= "\t\@cp $installdir/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{LIBRARY_REALNAME}\n";
+ $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{LIBRARY_REALNAME}\n";
+ $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{LIBRARY_REALNAME}\n";
+ if (defined($ctx->{ALIASES})) {
+ foreach (@{$ctx->{ALIASES}}) {
+ $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$_.\$(SHLIBEXT)\n";
+ $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$_.\$(SHLIBEXT)\n";
+ }
+ }
}
$self->_prepare_list($ctx, "OBJ_LIST");
defined($ctx->{LIBRARY_SONAME})) {
$soarg = "$self->{config}->{SONAMEFLAG}$ctx->{LIBRARY_SONAME} ";
if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) {
- $soargdebug = "\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{DEBUGDIR}/$ctx->{LIBRARY_SONAME}\n";
+ $soargdebug = "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{DEBUGDIR}/$ctx->{LIBRARY_SONAME}";
}
}
- if ($self->{duplicate_build}) {
+ my $singlesoarg = "";
+
+ if ($ctx->{DEBUGDIR} ne $installdir) {
$self->output(<< "__EOD__"
#
\@mkdir -p $ctx->{DEBUGDIR}
\@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \\
\$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) $soarg \\
- $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
-$soargdebug
+ $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)$soargdebug
__EOD__
);
+ if (defined($ctx->{ALIASES})) {
+ foreach (@{$ctx->{ALIASES}}) {
+ $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{DEBUGDIR}/$_.\$(SHLIBEXT)\n");
+ }
+ }
+
+ $self->output("\n");
+ } else {
+ if ($self->{config}->{SONAMEFLAG} ne "" and
+ defined($ctx->{LIBRARY_SONAME}) and
+ $ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) {
+ $singlesoarg = "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $installdir/$ctx->{LIBRARY_SONAME}";
+ }
+
}
$self->output(<< "__EOD__"
$installdir/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
\@echo Linking \$\@
- \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
+ \@mkdir -p $installdir
+ \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
\$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) $soarg \\
- $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
+ $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)$singlesoarg
__EOD__
);
{
my ($self,$ctx) = @_;
- push (@{$self->{static_libs}}, $ctx->{OUTPUT});
+ push (@{$self->{static_libs}}, $ctx->{TARGET});
$self->_prepare_list($ctx, "OBJ_LIST");
$self->_prepare_list($ctx, "CFLAGS");
$self->output(<< "__EOD__"
#
-$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)
+$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)
\@echo Linking \$@
\@\$(STLD) \$(STLD_FLAGS) \$@ \\
- \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
+ \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)
__EOD__
);
{
my ($self,$ctx) = @_;
+ my $dir = $ctx->{BASEDIR};
+
+ $dir =~ s/^\.\///g;
+
foreach (@{$ctx->{PUBLIC_HEADERS}}) {
- push (@{$self->{headers}}, "$ctx->{BASEDIR}/$_");
+ push (@{$self->{headers}}, "$dir/$_");
}
}
$link_name =~ s/^LIB//g;
$link_name = lc($link_name);
- if (not defined($ctx->{DESCRIPTION})) {
- warn("$ctx->{NAME} has not DESCRIPTION set, not generating .pc file");
- return;
- }
+ return if (not defined($ctx->{DESCRIPTION}));
my $path = "$ctx->{BASEDIR}/$link_name.pc";
"",
"$ctx->{VERSION}",
$ctx->{DESCRIPTION},
- 1
+ defined($ctx->{INIT_FUNCTIONS})
);
}
$ctx->{PUBLIC_PROTO_HEADER} = $ctx->{PRIVATE_PROTO_HEADER};
}
- $self->output("$dir/$ctx->{PUBLIC_PROTO_HEADER}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST:.o=.c)\n");
+ $self->output("$dir/$ctx->{PUBLIC_PROTO_HEADER}: $ctx->{MK_FILE} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST:.o=.c)\n");
$self->output("\t\@echo \"$comment\"\n");
- $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --private=$dir/$ctx->{PRIVATE_PROTO_HEADER} --public=$dir/$ctx->{PUBLIC_PROTO_HEADER} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
+ $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --private=$dir/$ctx->{PRIVATE_PROTO_HEADER} --public=$dir/$ctx->{PUBLIC_PROTO_HEADER} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
}
sub write($$)
# nasty hack to allow running locally
if ($self->{duplicate_build}) {
- $self->output("bin/libdynconfig.\$(SHLIBEXT): dynconfig-devel.o\n");
- $self->output("bin/libdynconfig.\$(SHLIBEXT): LIBRARY_DYNCONFIG_OBJ_LIST=dynconfig-devel.o\n");
+ $self->output("bin/libdynconfig.\$(SHLIBEXT).0.0.1: dynconfig-devel.o\n");
+ $self->output("bin/libdynconfig.\$(SHLIBEXT).0.0.1: LIBRARY_DYNCONFIG_OBJ_LIST=dynconfig-devel.o\n");
}
$self->_prepare_mk_files();
$self->output($self->{mkfile});
- if ($self->{developer}) {
- $self->output("-include \$(DEP_FILES)\n");
+ if ($self->{automatic_deps}) {
+ $self->output("
+ifneq (\$(MAKECMDGOALS),clean)
+ifneq (\$(MAKECMDGOALS),distclean)
+ifneq (\$(MAKECMDGOALS),realdistclean)
+-include \$(DEP_FILES)
+endif
+endif
+endif
+");
} else {
- $self->output("include static_deps.mk\n");
+ $self->output("include \$(srcdir)/static_deps.mk\n");
}
open(MAKEFILE,">$file") || die ("Can't open $file\n");