Make the mk1mf 'mv' command variable
[openssl.git] / util / mk1mf.pl
index 00a3efebac35f48f7a2accf2e030c6f960994e6c..1f9bdf47b74febff1b9d0c10372f1fcf9ff0ec70 100755 (executable)
@@ -9,7 +9,7 @@
 
 use Cwd;
 
-$INSTALLTOP="/usr/local/ssl";
+$INSTALLTOP="/usr/local";
 $OPENSSLDIR="/usr/local/ssl";
 $OPTIONS="";
 $ssl_version="";
@@ -50,7 +50,7 @@ my %mf_import = (
        PLATFORM       => \$mf_platform,
        CC             => \$mf_cc,
        CFLAG          => \$mf_cflag,
-       DEPFLAG        => \$mf_depflag,
+        DEPFLAG        => \$mf_depflag,
        CPUID_OBJ      => \$mf_cpuid_asm,
        BN_ASM         => \$mf_bn_asm,
        DES_ENC        => \$mf_des_asm,
@@ -83,8 +83,6 @@ while(<IN>) {
 }
 close(IN);
 
-$debug = 1 if $mf_platform =~ /^debug-/;
-
 if ($mf_fipscanisterinternal eq "y") {
        $fips = 1;
        $fipscanisterbuild = 1;
@@ -142,6 +140,7 @@ and [options] can be one of
        no-srp                                  - No SRP
        no-ec                                   - No EC
        no-engine                               - No engine
+       no-egd                                  - No EGD
        no-hw                                   - No hw
        nasm                                    - Use NASM for x86 asm
        nw-nasm                                 - Use NASM x86 asm for NetWare
@@ -183,6 +182,7 @@ $tmp_def="tmp";
 
 $perl="perl" unless defined $perl;
 $mkdir="-mkdir" unless defined $mkdir;
+$mv="mv" unless defined $mv;
 
 ($ssl,$crypto)=("ssl","crypto");
 $ranlib="echo ranlib";
@@ -289,7 +289,6 @@ $cflags.=" -DOPENSSL_NO_DH"   if $no_dh;
 $cflags.=" -DOPENSSL_NO_WHIRLPOOL"   if $no_whirlpool;
 $cflags.=" -DOPENSSL_NO_SOCK" if $no_sock;
 $cflags.=" -DOPENSSL_NO_SSL3" if $no_ssl3;
-$cflags.=" -DOPENSSL_NO_TLSEXT" if $no_tlsext;
 $cflags.=" -DOPENSSL_NO_SRP" if $no_srp;
 $cflags.=" -DOPENSSL_NO_CMS" if $no_cms;
 $cflags.=" -DOPENSSL_NO_ERR"  if $no_err;
@@ -613,7 +612,7 @@ $defs= <<"EOF";
 # N.B. You MUST use -j on FreeBSD.
 # This makefile has been automatically generated from the OpenSSL distribution.
 # This single makefile will build the complete OpenSSL distribution and
-# by default leave the 'intertesting' output files in .${o}out and the stuff
+# by default leave the 'interesting' output files in .${o}out and the stuff
 # that needs deleting in .${o}tmp.
 # The file was generated by running 'make makefile.one', which
 # does a 'make files', which writes all the environment variables from all
@@ -663,6 +662,7 @@ PERLASM_SCHEME=$mf_perlasm_scheme
 CP=$cp
 CP2=$cp2
 RM=$rm
+MV=$mv
 RANLIB=$ranlib
 MKDIR=$mkdir
 MKLIB=$bin_dir$mklib
@@ -753,7 +753,10 @@ headers: \$(HEADER)
 
 lib: \$(LIBS_DEP) \$(E_SHLIB)
 
-exe: \$(T_EXE) \$(BIN_D)$o\$(E_EXE)$exep
+exe: apps tools testapps
+apps: \$(BIN_D)$o\$(E_EXE)$exep \$(BIN_D)${o}CA.pl
+testapps: \$(T_EXE)
+tools: \$(BIN_D)${o}c_rehash
 
 install: all
        \$(MKDIR) \"\$(INSTALLTOP)\"
@@ -778,15 +781,8 @@ reallyclean:
 
 EOF
 
-if ($orig_platform ne 'copy')
-       {
-        $rules .= <<"EOF";
-test: \$(T_EXE)
-       cd \$(BIN_D)
-       ..${o}ms${o}test
-
-EOF
-       }
+$rules .= &do_rehash_rule("rehash.time", "certs/demo apps tools");
+$rules .= &do_test_rule("test", "rehash.time", "run_tests.pl");
 
 my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform";
 $platform_cpp_symbol =~ s/-/_/g;
@@ -814,7 +810,7 @@ if (open(IN,"crypto/buildinf.h"))
        }
 
 open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h";
-printf OUT <<EOF;
+printf OUT <<"EOF";
 #ifdef $platform_cpp_symbol
   /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
   #define CFLAGS "compiler: $cc $cflags"
@@ -1005,7 +1001,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';
+$rules.=&do_dofile_rule("\$(BIN_D)","c_rehash","tools/c_rehash.in");
+$rules.=&do_dofile_rule("\$(BIN_D)","CA.pl","apps/CA.pl.in");
 
 print $defs;
 
@@ -1042,7 +1039,6 @@ sub var_add
        return("") if $no_dsa  && $dir =~ /\/dsa/;
        return("") if $no_dh   && $dir =~ /\/dh/;
        return("") if $no_ec   && $dir =~ /\/ec/;
-       return("") if $no_gost   && $dir =~ /\/ccgost/;
        return("") if $no_cms  && $dir =~ /\/cms/;
        return("") if $no_jpake  && $dir =~ /\/jpake/;
        return("") if !$fips   && $dir =~ /^fips/;
@@ -1085,8 +1081,7 @@ sub var_add
        @a=grep(!/(rmd)|(ripemd)/,@a) if $no_ripemd;
 
        @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa;
-       @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa;
-       @a=grep(!/(^pem_seal$)/,@a) if $no_rsa;
+       @a=grep(!/(^p_open$)/,@a) if $no_rsa;
 
        @a=grep(!/(m_dss$)|(m_dss1$)/,@a) if $no_dsa;
        @a=grep(!/(^d2i_s_)|(^i2d_s_)|(_dsap$)/,@a) if $no_dsa;
@@ -1338,6 +1333,7 @@ sub do_copy_rule
        local($to,$files,$p)=@_;
        local($ret,$_,$n,$pp);
        
+
        $files =~ s/\//$o/g if $o ne '/';
        foreach (split(/\s+/,$files))
                {
@@ -1350,6 +1346,18 @@ sub do_copy_rule
        return($ret);
        }
 
+sub do_dofile_rule
+       {
+       (my $to, my $file, my $tmpl) = @_;
+
+       $file =~ s|/|$o|g if $o ne '/';
+       return <<"EOF";
+$to${o}$file: $tmpl
+       \$(PERL) "-I." "-Mconfigdata" util/dofile.pl "$tmpl" > "$to${o}$file.new"
+       \$(MV) "$to${o}$file.new" "$to${o}$file"
+EOF
+       }
+
 # Options picked up from the OPTIONS line in the top level Makefile
 # generated by Configure.
 
@@ -1391,7 +1399,6 @@ sub read_options
                "gaswin" => \$gaswin,
                "no-ssl3" => \$no_ssl3,
                "no-ssl3-method" => 0,
-               "no-tlsext" => \$no_tlsext,
                "no-srp" => \$no_srp,
                "no-cms" => \$no_cms,
                "no-jpake" => \$no_jpake,
@@ -1402,6 +1409,7 @@ sub read_options
                "no-ec" => \$no_ec,
                "no-gost" => \$no_gost,
                "no-engine" => \$no_engine,
+               "no-egd" => 0,
                "no-hw" => \$no_hw,
                "just-ssl" =>
                        [\$no_rc2, \$no_idea, \$no_des, \$no_bf, \$no_cast,
@@ -1411,6 +1419,7 @@ sub read_options
                "rsaref" => 0,
                "gcc" => \$gcc,
                "debug" => \$debug,
+               "--debug" => \$debug,
                "profile" => \$profile,
                "shlib" => \$shlib,
                "dll" => \$shlib,
@@ -1428,6 +1437,7 @@ sub read_options
                "no-unit-test" => 0,
                "no-deprecated" => 0,
                "no-ocb" => 0,
+               "no-crypto-mdebug" => 0,
                "fips" => \$fips,
                "fipscanisterbuild" => [\$fips, \$fipscanisterbuild],
                "fipscanisteronly" => [\$fips, \$fipscanisterbuild, \$fipscanisteronly],