Configuration: Simplify generating list of generated files in build file templates
[openssl.git] / Configurations / descrip.mms.tmpl
index e8780e42d8a8282bd8a6b86e952a0bd5a75d1992..09b67637be3cb2e4050adaaf3246a213febf37bd 100644 (file)
@@ -3,6 +3,7 @@
 ## {- join("\n## ", @autowarntext) -}
 {-
   use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
+  use File::Basename;
 
   # Our prefix, claimed when speaking with the VSI folks Tuesday
   # January 26th 2016
   our @install_shlibs =
       map { $unified_info{sharednames}->{$_} || () }
       grep(!/\.a$/, @{$unified_info{install}->{libraries}});
-  our @generated = ( ( map { (my $x = $_) =~ s|\.[sS]$|\.asm|; $x }
-                       grep { defined $unified_info{generate}->{$_} }
-                       map { @{$unified_info{sources}->{$_}} }
-                       grep { /\.o$/ } keys %{$unified_info{sources}} ),
-                     ( grep { /\.h$/ } keys %{$unified_info{generate}} ) );
 
   # This is a horrible hack, but is needed because recursive inclusion of files
   # in different directories does not work well with HP C.
@@ -135,7 +131,9 @@ DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
         join(", ", map { "-\n\t".$_ } @deps); -}
 {- output_on() if $disabled{makedepend}; "" -}
 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
-GENERATED={- join(", ", map { "-\n\t".$_ } @generated) -}
+GENERATED={- # common0.tmpl provides @generated
+             join(", ", map { (my $x = $_) =~ s|\.[sS]$|.asm|; "-\n\t".$x }
+                        @generated) -}
 
 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
@@ -176,7 +174,7 @@ ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
 CC={- $config{CC} -}
 CPP={- $config{CPP} -}
 DEFINES={- our $defines1 = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
-INCLUDES={- our $includes1 = join('', map { ",$_" } @{$config{CPPINCLUDES}}) -}
+INCLUDES={- our $includes1 = join(',', @{$config{CPPINCLUDES}}) -}
 CPPFLAGS={- our $cppflags1 = join('', @{$config{CPPFLAGS}}) -}
 CFLAGS={- join('', @{$config{CFLAGS}}) -}
 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
@@ -221,23 +219,28 @@ CNF_EX_LIBS={- join('', map{ ",$_" } @{$target{ex_libs}},
 LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (),
                          @{$config{lib_asflags}},
                          '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
-LIB_DEFINES={- join('', (map { ",$_" } @{$target{lib_defines}},
+LIB_DEFINES={- our $lib_defines =
+               join('', (map { ",$_" } @{$target{lib_defines}},
                                        @{$target{shared_defines}},
                                        @{$config{lib_defines}},
-                                       @{$config{shared_defines}},
-                                       'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
+                                       @{$config{shared_defines}}));
+               join('', $lib_defines,
+                        (map { ",$_" } 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
                                        'ENGINESDIR="""$(ENGINESDIR_C)"""'),
                         '$(CNF_DEFINES)', '$(DEFINES)') -}
-LIB_INCLUDES={- join(',', @{$target{lib_includes}},
+LIB_INCLUDES={- our $lib_includes =
+                join(',', @{$target{lib_includes}},
                           @{$target{shared_includes}},
                           @{$config{lib_includes}},
                           @{$config{shared_includes}}) -}
-LIB_CPPFLAGS={- join('', "'qual_includes'",
-                         '/DEFINE=(__dummy$(LIB_DEFINES))',
-                         $target{lib_cppflags} || (),
+LIB_CPPFLAGS={- our $lib_cppflags =
+                join('', $target{lib_cppflags} || (),
                          $target{shared_cppflags} || (),
                          @{$config{lib_cppflags}},
-                         @{$config{shared_cppflag}},
+                         @{$config{shared_cppflag}});
+                join('', "'qual_includes'",
+                         '/DEFINE=(__dummy$(LIB_DEFINES))',
+                         $lib_cppflags,
                          '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
 LIB_CFLAGS={- join('', $target{lib_cflags} || (),
                        $target{shared_cflag} || (),
@@ -325,9 +328,10 @@ NO_INST_BIN_CFLAGS={- join('', $target{no_inst_bin_cflags}
 PERLASM_SCHEME={- $target{perlasm_scheme} -}
 
 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
-CPPFLAGS_Q={- (my $c = $cppflags1.$cppflags2) =~ s|"|""|g;
-              (my $d = $defines1.$defines2) =~ s|"|""|g;
-              my $i = join(',', $includes1 || (), $includes2 || ());
+CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags2.$cppflags1) =~ s|"|""|g;
+              (my $d = $lib_defines.$defines2.$defines1) =~ s|"|""|g;
+              my $i = join(',', $lib_includes || (), $includes2 || (),
+                                $includes1 || ());
               my $x = $c;
               $x .= "/INCLUDE=($i)" if $i;
               $x .= "/DEFINE=($d)" if $d;
@@ -498,16 +502,7 @@ distclean : clean
 depend : descrip.mms
 descrip.mms : FORCE
        @ ! {- output_off() if $disabled{makedepend}; "" -}
-        @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
-                < descrip.mms > descrip.mms-new
-        @ OPEN/APPEND DESCRIP descrip.mms-new
-        @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
-        {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
-        @ CLOSE DESCRIP
-        @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
-                 RENAME descrip.mms-new descrip.mms )
-        @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
-        -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
+       @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "VMS C"
        @ ! {- output_on() if $disabled{makedepend}; "" -}
 
 # Install helper targets #############################################
@@ -880,9 +875,9 @@ EOF
       my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
       my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
       my $depbuild = $disabled{makedepend} ? ""
-          : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
+          : " /MMS=(FILE=${objd}${objn}.D,TARGET=$obj.OBJ)";
 
-      return <<"EOF"
+      return <<"EOF";
 $obj.OBJ : $deps
         ${before}
         SET DEFAULT $forward
@@ -893,12 +888,6 @@ $obj.OBJ : $deps
         ${after}
         - PURGE $obj.OBJ
 EOF
-      . ($disabled{makedepend} ? "" : <<"EOF"
-        \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
-                 RENAME $obj.tmp-D $obj.d )
-        \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
-EOF
-        );
   }
   sub libobj2shlib {
       my %args = @_;