summaryrefslogtreecommitdiff
path: root/infrastructure/makebuildenv.pl.in
diff options
context:
space:
mode:
Diffstat (limited to 'infrastructure/makebuildenv.pl.in')
-rwxr-xr-xinfrastructure/makebuildenv.pl.in125
1 files changed, 83 insertions, 42 deletions
diff --git a/infrastructure/makebuildenv.pl.in b/infrastructure/makebuildenv.pl.in
index 456bd265..5ed4a0ab 100755
--- a/infrastructure/makebuildenv.pl.in
+++ b/infrastructure/makebuildenv.pl.in
@@ -39,16 +39,8 @@ unless(-d 'local')
# flags about the environment
my %env_flags;
-my $windows_include_path = "";
-if ($target_windows)
-{
- $module_dependency{"lib/common"} = ["lib/win32"];
- push @implicit_deps, "lib/win32";
-}
-else
-{
- # $env_flags{'IGNORE_lib/win32'} = 1;
-}
+$module_dependency{"lib/common"} = ["lib/win32"];
+push @implicit_deps, "lib/win32";
# print "Flag: $_\n" for(keys %env_flags);
@@ -408,13 +400,41 @@ for my $mod (@implicit_deps, @modules)
"test script file for $module for writing\n";
print TESTFILE "#!/bin/sh\necho TEST: $module\n";
- if(-d "$module/testfiles")
+ if ($target_windows)
+ {
+ print TESTFILE <<__E;
+kill_process()
+{
+ if test -r testfiles/\$1.pid; then
+ /bin/kill -0 -f `cat testfiles/\$1.pid` \\
+ && /bin/kill -f `cat testfiles/\$1.pid`
+ rm testfiles/\$1.pid
+ fi
+}
+__E
+ }
+ else
+ {
+ print TESTFILE <<__E;
+kill_process()
+{
+ test -r testfiles/\$1.pid \\
+ && kill -0 `cat testfiles/\$1.pid` \\
+ && kill `cat testfiles/\$1.pid`
+}
+__E
+ }
+
+ if (-d "$module/testfiles")
{
print TESTFILE <<__E;
echo Killing any running daemons...
-test -r testfiles/bbackupd.pid && kill `cat testfiles/bbackupd.pid`
-test -r testfiles/bbstored.pid && kill `cat testfiles/bbstored.pid`
+kill_process bbackupd
+kill_process bbstored
+__E
+ }
+ print TESTFILE <<__E;
echo Removing old test files...
chmod -R a+rwx testfiles
rm -rf testfiles
@@ -423,9 +443,8 @@ echo Copying new test files...
cp -p -R ../../../$module/testfiles .
__E
- }
- if(-e "$module/testextra")
+ if (-e "$module/testextra")
{
open FL,"$module/testextra" or die
"Can't open $module/testextra";
@@ -435,12 +454,11 @@ __E
print TESTFILE "$runcmd\n";
- if(-d "$module/testfiles")
+ if (-d "$module/testfiles")
{
print TESTFILE <<__E;
-# echo Killing any running daemons...
-test -r testfiles/bbackupd.pid && kill `cat testfiles/bbackupd.pid`
-test -r testfiles/bbstored.pid && kill `cat testfiles/bbstored.pid`
+kill_process bbackupd
+kill_process bbstored
__E
}
@@ -487,8 +505,7 @@ __E
# make include path
- my $include_paths = $windows_include_path .
- join(' ',map {'-I../../'.$_} @all_deps_for_module);
+ my $include_paths = join(' ',map {'-I../../'.$_} @all_deps_for_module);
# is target a library?
my $target_is_library = ($type ne 'bin' && $type ne 'test');
@@ -515,6 +532,9 @@ __E
open MAKE,">$mod/Makefile".$mk_name_extra or die "Can't open Makefile for $mod\n";
my $debug_link_extra = ($target_is_library)?'':'../../debug/lib/debug/debug.a';
+ my $default_cxxflags = '@CXXFLAGS@';
+ $default_cxxflags =~ s/ -O2//g;
+
my $release_flags = "-O2";
if ($target_windows)
{
@@ -531,15 +551,21 @@ CXX = @CXX@
AR = @AR@
RANLIB = @RANLIB@
PERL = @PERL@
-WINDRES = windres
+WINDRES = @WINDRES@
+
+DEFAULT_CXXFLAGS = @CPPFLAGS@ $default_cxxflags @CXXFLAGS_STRICT@ \\
+ $include_paths $extra_platform_defines \\
+ -DBOX_VERSION="\\"$product_version\\""
+LDFLAGS = @LDFLAGS@ @LDADD_RDYNAMIC@
+
.ifdef RELEASE
-CXXFLAGS = -DNDEBUG $release_flags @CXXFLAGS_STRICT@ $include_paths $extra_platform_defines -DBOX_VERSION="\\"$product_version\\""
+CXXFLAGS = -DBOX_RELEASE_BUILD $release_flags \$(DEFAULT_CXXFLAGS)
OUTBASE = ../../release
OUTDIR = ../../release/$mod
DEPENDMAKEFLAGS = -D RELEASE
VARIENT = RELEASE
.else
-CXXFLAGS = -g @CXXFLAGS_STRICT@ $include_paths $extra_platform_defines -DBOX_VERSION="\\"$product_version\\""
+CXXFLAGS = -g \$(DEFAULT_CXXFLAGS)
OUTBASE = ../../debug
OUTDIR = ../../debug/$mod
DEPENDMAKEFLAGS =
@@ -560,11 +586,11 @@ _AR = \$(AR)
_RANLIB = \$(RANLIB)
.else
HIDE = @
-_CXX = @ echo "[CXX] " \$(*F) && \$(CXX)
-_LINK = @ echo "[LINK] " \$(*F) && \$(CXX)
-_WINDRES = @ echo "[WINDRES]" \$(*F) && \$(WINDRES)
-_AR = @ echo "[AR] " \$(*F) && \$(AR)
-_RANLIB = @ echo "[RANLIB] " \$(*F) && \$(RANLIB)
+_CXX = @ echo " [CXX] " \$(*F) && \$(CXX)
+_LINK = @ echo " [LINK] " \$(*F) && \$(CXX)
+_WINDRES = @ echo " [WINDRES]" \$(*F) && \$(WINDRES)
+_AR = @ echo " [AR] " \$(*F) && \$(AR)
+_RANLIB = @ echo " [RANLIB] " \$(*F) && \$(RANLIB)
.endif
__E
@@ -573,11 +599,11 @@ __E
{
print MAKE <<__E;
HIDE = \$(if \$(V),,@)
-_CXX = \$(if \$(V),\$(CXX), @ echo "[CXX] \$<" && \$(CXX))
-_LINK = \$(if \$(V),\$(CXX), @ echo "[LINK] \$@" && \$(CXX))
-_WINDRES = \$(if \$(V),\$(WINDRES), @ echo "[WINDRES] \$<" && \$(WINDRES))
-_AR = \$(if \$(V),\$(AR), @ echo "[AR] \$@" && \$(AR))
-_RANLIB = \$(if \$(V),\$(RANLIB), @ echo "[RANLIB] \$@" && \$(RANLIB))
+_CXX = \$(if \$(V),\$(CXX), @ echo " [CXX] \$<" && \$(CXX))
+_LINK = \$(if \$(V),\$(CXX), @ echo " [LINK] \$@" && \$(CXX))
+_WINDRES = \$(if \$(V),\$(WINDRES), @ echo " [WINDRES] \$<" && \$(WINDRES))
+_AR = \$(if \$(V),\$(AR), @ echo " [AR] \$@" && \$(AR))
+_RANLIB = \$(if \$(V),\$(RANLIB), @ echo " [RANLIB] \$@" && \$(RANLIB))
__E
}
@@ -683,6 +709,7 @@ __E
if ($is_cpp)
{
$make .= "\t\$(_CXX) \$(CXXFLAGS) $compile_line_extra ".
+ "-DBOX_MODULE=\"\\\"$mod\\\"\" " .
"-c $file -o $out_name\n\n";
}
elsif ($is_rc)
@@ -726,8 +753,9 @@ __E
# run make for things we require
for my $dep (@all_deps_for_module)
{
- $deps_makeinfo .= "\t\t\$(HIDE) (cd ../../$dep; \$(MAKE)$sub_make_options \$(DEPENDMAKEFLAGS) -D NODEPS)\n";
+ $deps_makeinfo .= "\t\t\$(HIDE) (cd ../../$dep; \$(MAKE)$sub_make_options -q \$(DEPENDMAKEFLAGS) -D NODEPS || \$(MAKE)$sub_make_options \$(DEPENDMAKEFLAGS) -D NODEPS)\n";
}
+
$deps_makeinfo .= ".\tendif\n.endif\n\n";
}
print MAKE $deps_makeinfo if $bsd_make;
@@ -771,7 +799,7 @@ __E
{
# make a library archive...
print MAKE "\t\$(HIDE) (echo -n > $end_target; rm $end_target)\n";
- print MAKE "\t\$(_AR) -q $end_target $o_file_list\n";
+ print MAKE "\t\$(_AR) cq $end_target $o_file_list\n";
print MAKE "\t\$(_RANLIB) $end_target\n";
}
else
@@ -796,7 +824,9 @@ __E
}
# link line...
- print MAKE "\t\$(_LINK) $link_line_extra -o $end_target $o_file_list $lib_files$lo $platform_lib_files\n";
+ print MAKE "\t\$(_LINK) \$(LDFLAGS) $link_line_extra " .
+ "-o $end_target $o_file_list " .
+ "$lib_files$lo $platform_lib_files\n";
}
# tests need to copy the test file over
if($type eq 'test')
@@ -814,7 +844,11 @@ __E
print MAKE $make,"\n";
# and a clean target
- print MAKE "clean:\n\t-rm -rf \$(OUTDIR)/*\n.\tifndef SUBCLEAN\n";
+ print MAKE <<EOF;
+clean:
+ -rm -rf \$(OUTDIR)/*
+. ifndef SUBCLEAN
+EOF
for my $dep (@all_deps_for_module)
{
print MAKE "\t\$(HIDE) (cd ../../$dep; \$(MAKE) \$(DEPENDMAKEFLAGS) -D SUBCLEAN clean)\n";
@@ -851,7 +885,7 @@ __E
{
s/\A\.\s*(ifdef|else|endif|ifndef)/$1/;
s/\A\.\s*include\s+<(.+?)>/include $1/;
- s/-D\s+(\w+)/$1=1/;
+ s/-D\s+(\w+)/$1=1/g;
print MAKE;
}
@@ -896,11 +930,18 @@ sub additional_objects_from_make_fragment
chomp;
if(m/link-extra:\s*(.+)\Z/)
{
- my @o = split /\s+/,$1;
- for(@o)
+ my $extra = $1;
+ do
{
- push @$objs_r,$1 if m/\A(.+)\.o\Z/;
+ my @o = split /\s+/, $extra;
+ for(@o)
+ {
+ push @$objs_r,$1 if m/\A(.+)\.o\Z/;
+ }
+ last unless $extra =~ m'\\$';
+ $extra = <FL>;
}
+ while(1);
}
elsif(m/include-makefile:\s*(\S+)/)
{