VMS: rather use a quick file comparison than DIFF
[openssl.git] / Configurations / descrip.mms.tmpl
index 1c5f58af2513202726685835a217ab2e5bffa7d6..dd00fd3e4513890e9767959f7c4c5a40869e82fd 100644 (file)
@@ -105,6 +105,10 @@ ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } grep { !m|^\[\.test\]| } @{$unified_info{programs}}) -}
 TESTPROGS={- join(", ", map { "-\n\t".$_.".EXE" } grep { m|^\[\.test\]| } @{$unified_info{programs}}) -}
 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
+DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
+                    grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
+                    keys %{$unified_info{sources}};
+        join(", ", map { "-\n\t".$_ } @deps); -}
 
 # DESTDIR is for package builders so that they can configure for, say,
 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
@@ -152,7 +156,7 @@ ASFLAG={- $target{asflags} -}
 NODEBUG=@
 .FIRST :
         $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
-        $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","a.;",,,"SYNTAX_ONLY") - "A.;"
+        $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
         $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
         $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
         $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
@@ -200,9 +204,22 @@ NODEBUG=@
 
 # The main targets ###################################################
 
-all : descrip.mms, $(LIBS), $(ENGINES), $(PROGRAMS), $(SCRIPTS), $(TESTPROGS)
-
-test tests : $(TESTPROGS), rehash
+all : configdata.pm, -
+      build_libs_nodep, build_engines_nodep, build_apps_nodep, -
+      depend
+
+build_libs : configdata.pm, build_libs_nodep, depend
+build_libs_nodep : $(LIBS)
+build_engines : configdata.pm, build_engines_nodep, depend
+build_engines_nodep : $(ENGINES)
+build_apps : configdata.pm, build_apps_nodep, depend
+build_apps_nodep : $(PROGRAMS), $(SCRIPTS)
+build_tests : configdata.pm, build_tests_nodep, depend
+build_tests_nodep : $(TESTPROGS)
+
+test tests : configdata.pm, -
+             build_apps_nodep, build_engines_nodep, build_tests_nodep, -
+             depend, rehash
         SET DEFAULT [.test]{- move("test") -}
         DEFINE SRCTOP {- sourcedir() -}
         DEFINE BLDTOP {- builddir() -}
@@ -237,24 +254,18 @@ clean : libclean
         - DELETE [.test]*.LOG;*
         - DELETE []*.MAP;*
 
-DCLEAN_CMD=$(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }"
-dclean :
-        $(DCLEAN_CMD) < descrip.mms > descrip.mms.new
-        RENAME descrip.mms.new descrip.mms
-        PURGE descrip.mms
-
-{- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
-               grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
-               keys %{$unified_info{sources}};
-   ""; -}
-depend : {- join(",-\n\t", @deps); -}
-        $(DCLEAN_CMD) < 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 { "TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
-        CLOSE DESCRIP
-        RENAME descrip.mms.new descrip.mms
-        PURGE descrip.mms
+depend : descrip.mms
+descrip.mms : FORCE
+        @ $(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
 
 # Install helper targets #############################################
 
@@ -288,7 +299,7 @@ install_dev : check_INSTALLTOP
         @ {- output_off() if $config{no_shared}; "" -} !
         {- join("\n        ",
                 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:['arch'.LIB]" }
-                map { $unified_info{sharednames}->{$_} || () } 
+                map { $unified_info{sharednames}->{$_} || () }
                 @{$unified_info{libraries}}) -}
         @ {- output_on() if $config{no_shared}; "" -} !
 
@@ -340,7 +351,7 @@ install_config : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
                 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
                 > [.VMS]openssl_shutdown.com
 
-vmsconfig.pm : descrip.mms
+vmsconfig.pm : configdata.pm
         OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
         WRITE CONFIG "package vmsconfig;"
         WRITE CONFIG "use strict; use warnings;"
@@ -372,7 +383,7 @@ check_INSTALLTOP :
 
 # Helper targets #####################################################
 
-rehash : [.apps]openssl.exe, copy-certs
+rehash : copy-certs, build_apps_nodep
         !MCR [.apps]openssl.exe rehash {- builddir("certs", "demo") -}
         $(PERL) [.tools]c_rehash. [.certs.demo]
 
@@ -391,8 +402,8 @@ debug_logicals :
 
 # Building targets ###################################################
 
-descrip.mms : {- sourcefile("Configurations", "descrip.mms.tmpl") -} $(SRCDIR)Configure ! $(SRCDIR)config.com
-        @ WRITE SYS$OUTPUT "descrip.mms is older than $?."
+configdata.pm : {- sourcefile("Configurations", "descrip.mms.tmpl") -} $(SRCDIR)Configure ! $(SRCDIR)config.com
+        @ WRITE SYS$OUTPUT "Detected changed: $?"
         @ WRITE SYS$OUTPUT "Reconfiguring..."
         perl $(SRCDIR)Configure reconf
         @ WRITE SYS$OUTPUT "*************************************************"
@@ -400,48 +411,11 @@ descrip.mms : {- sourcefile("Configurations", "descrip.mms.tmpl") -} $(SRCDIR)Co
         @ WRITE SYS$OUTPUT "***   Please run the same mms command again   ***"
         @ WRITE SYS$OUTPUT "***                                           ***"
         @ WRITE SYS$OUTPUT "*************************************************"
-        @ exit %10000000
+        @ PIPE ( EXIT %X10000000 )
 
 {-
   use File::Basename;
   use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
-  sub src2dep {
-      my %args = @_;
-      my $dep = $args{obj};
-      my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
-
-      # Because VMS C isn't very good at combining a /INCLUDE path with
-      # #includes having a relative directory (like '#include "../foo.h"),
-      # the best choice is to move to the first source file's intended
-      # directory before compiling, and make sure to write the object file
-      # in the correct position (important when the object tree is other
-      # than the source tree).
-      my $forward = dirname($args{srcs}->[0]);
-      my $backward = abs2rel(rel2abs("."), rel2abs($forward));
-      my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
-      my $depn = basename($dep);
-      my $srcs =
-          join(", ",
-               map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
-      my $incs =
-          "/INCLUDE=(".join(",",
-                            map {
-                               file_name_is_absolute($_)
-                               ? $_ : catdir($backward,$_)
-                            } @{$args{incs}}).")";
-      my $before = $unified_info{before}->{$dep.".OBJ"} || "\@ !";
-      my $after = $unified_info{after}->{$dep.".OBJ"} || "\@ !";
-
-      return <<"EOF";
-$dep.MMS : $deps
-        ${before}
-        SET DEFAULT $forward
-        \$(CC) \$(CFLAGS)${incs} /MMS=(TARGET=.OBJ)/OBJECT=${depd}${depn}.MMS $srcs
-        SET DEFAULT $backward
-        ${after}
-        - PURGE $dep.MMS
-EOF
-  }
   sub src2obj {
       my %args = @_;
       my $obj = $args{obj};
@@ -470,7 +444,14 @@ EOF
       my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
 
       return <<"EOF";
-$obj.OBJ : $deps
+$obj.MMS : $deps
+        ${before}
+        SET DEFAULT $forward
+        \$(CC) \$(CFLAGS)${incs} /MMS=(FILE=${objd}${objn}.MMS,TARGET=$obj.OBJ) /NOOBJECT $srcs
+        SET DEFAULT $backward
+        ${after}
+        - PURGE $obj.MMS
+$obj.OBJ : $obj.MMS
         ${before}
         SET DEFAULT $forward
         \$(CC) \$(CFLAGS)${incs} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
@@ -624,7 +605,8 @@ EOF
                            rel2abs($config{builddir}));
       return <<"EOF";
 $script : $sources
-        \$(PERL) "-I\$(BUILDDIR)" "-Mconfigdata" $dofile $sources > $script
+        \$(PERL) "-I\$(BUILDDIR)" "-Mconfigdata" $dofile -
+           "-o$target{build_file}" $sources > $script
         SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
         PURGE $script
 EOF