aboutsummaryrefslogtreecommitdiffstats
path: root/util/mk1mf.pl
diff options
context:
space:
mode:
authorBen Laurie <ben@links.org>2013-03-23 19:05:19 +0000
committerBen Laurie <ben@links.org>2013-04-06 15:11:11 +0100
commit3b4d86bff5a8911a061a8a6e5ec1d21b1f651c18 (patch)
tree7e32c770cbc99e393c8f7be586be18bd22dfa421 /util/mk1mf.pl
parent282a480a352e2aac4fad6e75932d951659bff62d (diff)
downloadopenssl-3b4d86bff5a8911a061a8a6e5ec1d21b1f651c18.tar.gz
Get closer to a working single Makefile with test support.
Diffstat (limited to 'util/mk1mf.pl')
-rwxr-xr-xutil/mk1mf.pl40
1 files changed, 28 insertions, 12 deletions
diff --git a/util/mk1mf.pl b/util/mk1mf.pl
index 087671b6c3..7860375c56 100755
--- a/util/mk1mf.pl
+++ b/util/mk1mf.pl
@@ -2,8 +2,12 @@
# A bit of an evil hack but it post processes the file ../MINFO which
# is generated by `make files` in the top directory.
# This script outputs one mega makefile that has no shell stuff or any
-# funny stuff
-#
+# funny stuff (if the target is not "copy").
+# If the target is "copy", then it tries to create a makefile that can be
+# safely used with the -j flag and that is compatible with the top-level
+# Makefile, in the sense that it uses the same options and assembler files etc.
+
+use Cwd;
$INSTALLTOP="/usr/local/ssl";
$OPENSSLDIR="/usr/local/ssl";
@@ -188,7 +192,7 @@ $mkdir="-mkdir" unless defined $mkdir;
$ranlib="echo ranlib";
$cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc';
-$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.';
+$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:getcwd();
$bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:'';
# $bin_dir.=$o causes a core dump on my sparc :-(
@@ -748,6 +752,10 @@ $banner
\$(INC_D):
\$(MKDIR) \"\$(INC_D)\"
+# This needs to be invoked once, when the makefile is first constructed, or
+# after cleaning.
+init: \$(TMP_D) \$(LIB_D) headers
+
headers: \$(HEADER) \$(EXHEADER)
lib: \$(LIBS_DEP) \$(E_SHLIB)
@@ -762,11 +770,6 @@ install: all
\$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
$extra_install
-
-test: \$(T_EXE)
- cd \$(BIN_D)
- ..${o}ms${o}test
-
clean:
\$(RM) \$(TMP_D)$o*.*
@@ -782,7 +785,17 @@ reallyclean:
\$(RM) -rf \$(INC_D)
EOF
-
+
+if ($orig_platform ne 'copy')
+ {
+ $rules .= <<"EOF";
+test: \$(T_EXE)
+ cd \$(BIN_D)
+ ..${o}ms${o}test
+
+EOF
+ }
+
my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform";
$platform_cpp_symbol =~ s/-/_/g;
if (open(IN,"crypto/buildinf.h"))
@@ -1014,6 +1027,8 @@ if ($fips)
$rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)", ($fips && !$shlib) ? 2 : 0);
+$rules .= get_tests('test/Makefile') if $orig_platform eq 'copy';
+
print $defs;
if ($platform eq "linux-elf") {
@@ -1288,9 +1303,10 @@ sub cc_compile_target
$ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/);
$target =~ s/\//$o/g if $o ne "/";
$source =~ s/\//$o/g if $o ne "/";
-# FIXME: do dependencies instead of all headers.
- $ret ="$target: \$(SRC_D)$o$source \$(HEADER) \$(EXHEADER)\n\t";
- $ret.="\$(CC) ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n";
+ $ret ="$target: \$(SRC_D)$o$source\n\t";
+ $ret.="\$(CC) -MMD ${ofile}$target $ex_flags -c \$(SRC_D)$o$source\n\n";
+ $target =~ s/\.o$/.d/;
+ $ret.=".sinclude \"$target\"\n\n";
return($ret);
}