9995b43b9f6c0343447b2a87f3cf9c3a88b20b0e
[openssl.git] / Configurations / descrip.mms.tmpl
1 ## descrip.mms to build OpenSSL on OpenVMS
2 ##
3 ## {- join("\n## ", @autowarntext) -}
4 {-
5   use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
6
7   # Our prefix, claimed when speaking with the VSI folks Tuesday
8   # January 26th 2016
9   our $osslprefix = 'OSSL$';
10   (our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/;
11
12   our $sover_dirname = sprintf "%02d%02d", split(/\./, $config{shlib_version_number});
13   our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
14
15   our $sourcedir = $config{sourcedir};
16   our $builddir = $config{builddir};
17   sub sourcefile {
18       catfile($sourcedir, @_);
19   }
20   sub buildfile {
21       catfile($builddir, @_);
22   }
23   sub sourcedir {
24       catdir($sourcedir, @_);
25   }
26   sub builddir {
27       catdir($builddir, @_);
28   }
29   sub tree {
30       (my $x = shift) =~ s|\]$|...]|;
31       $x
32   }
33   sub move {
34       my $f = catdir(@_);
35       my $b = abs2rel(rel2abs("."),rel2abs($f));
36       $sourcedir = catdir($b,$sourcedir)
37           if !file_name_is_absolute($sourcedir);
38       $builddir = catdir($b,$builddir)
39           if !file_name_is_absolute($builddir);
40       "";
41   }
42
43   # Because we need to make two computations of these data,
44   # we store them in arrays for reuse
45   our @libs =
46       map { (my $x = $_) =~ s/\.a$//; $x }
47       @{$unified_info{libraries}};
48   our @shlibs =
49       map { $unified_info{sharednames}->{$_} || () }
50       grep(!/\.a$/, @{$unified_info{libraries}});
51   our @install_libs =
52       map { (my $x = $_) =~ s/\.a$//; $x }
53       @{$unified_info{install}->{libraries}};
54   our @install_shlibs =
55       map { $unified_info{sharednames}->{$_} || () }
56       grep(!/\.a$/, @{$unified_info{install}->{libraries}});
57   our @generated = ( ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
58                        grep { defined $unified_info{generate}->{$_} }
59                        map { @{$unified_info{sources}->{$_}} }
60                        grep { /\.o$/ } keys %{$unified_info{sources}} ),
61                      ( grep { /\.h$/ } keys %{$unified_info{generate}} ) );
62
63   # This is a horrible hack, but is needed because recursive inclusion of files
64   # in different directories does not work well with HP C.
65   my $sd = sourcedir("crypto", "async", "arch");
66   foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
67       (my $x = $_) =~ s|\.o$|.OBJ|;
68       $unified_info{before}->{$x}
69           = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
70         define arch 'arch_include');
71       $unified_info{after}->{$x}
72           = qq(deassign arch);
73   }
74   my $sd1 = sourcedir("ssl","record");
75   my $sd2 = sourcedir("ssl","statem");
76   my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
77                             keys %{$unified_info{sources}});
78   foreach (@ssl_locl_users) {
79       (my $x = $_) =~ s|\.o$|.OBJ|;
80       $unified_info{before}->{$x}
81           = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
82         define record 'record_include'
83         statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
84         define statem 'statem_include');
85       $unified_info{after}->{$x}
86           = qq(deassign statem
87         deassign record);
88   }
89   # This makes sure things get built in the order they need
90   # to. You're welcome.
91   sub dependmagic {
92       my $target = shift;
93
94       return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
95   }
96   #use Data::Dumper;
97   #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
98   #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
99   "";
100 -}
101 PLATFORM={- $config{target} -}
102 OPTIONS={- $config{options} -}
103 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
104 SRCDIR={- $config{sourcedir} -}
105 BLDDIR={- $config{builddir} -}
106
107 # Allow both V and VERBOSE to indicate verbosity.  This only applies
108 # to testing.
109 VERBOSE=$(V)
110
111 VERSION={- $config{version} -}
112 MAJOR={- $config{major} -}
113 MINOR={- $config{minor} -}
114 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
115 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
116 SHLIB_MAJOR={- $config{shlib_major} -}
117 SHLIB_MINOR={- $config{shlib_minor} -}
118 SHLIB_TARGET={- $target{shared_target} -}
119
120 EXE_EXT=.EXE
121 LIB_EXT=.OLB
122 SHLIB_EXT=.EXE
123 OBJ_EXT=.OBJ
124 DEP_EXT=.D
125
126 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
127 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
128 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
129 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
130 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
131 {- output_off() if $disabled{makedepend}; "" -}
132 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
133                     grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
134                     keys %{$unified_info{sources}};
135         join(", ", map { "-\n\t".$_ } @deps); -}
136 {- output_on() if $disabled{makedepend}; "" -}
137 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
138 GENERATED={- join(", ", map { "-\n\t".$_ } @generated) -}
139
140 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
141 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
142 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -}
143 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -}
144 {- output_off() if $disabled{apps}; "" -}
145 BIN_SCRIPTS=[.tools]c_rehash.pl
146 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
147 {- output_on() if $disabled{apps}; "" -}
148
149 APPS_OPENSSL={- use File::Spec::Functions;
150                 catfile("apps","openssl") -}
151
152 # DESTDIR is for package builders so that they can configure for, say,
153 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
154 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
155 # MMS with /MACROS=(DESTDIR=STAGING:[USER]).  The result will end up in
156 # STAGING:[USER.OPENSSL].
157 # Normally it is left empty.
158 DESTDIR=
159
160 # Do not edit this manually. Use Configure --prefix=DIR to change this!
161 INSTALLTOP={- our $installtop =
162                   catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
163               $installtop -}
164 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
165 # This is the standard central area to store certificates, private keys...
166 OPENSSLDIR={- catdir($config{openssldir}) or
167               $config{prefix} ? catdir($config{prefix},"COMMON")
168                               : "SYS\$COMMON:[OPENSSL-COMMON]" -}
169 # The same, but for C
170 OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
171 # Where installed engines reside, for C
172 ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
173
174 CC= {- $target{cc} -}
175 DEFINES={- our $defines = join(",",
176                                '__dummy', # To make comma processing easier
177                                @{$target{defines}}, @{$config{defines}}) -}
178 CPPFLAGS={- our $cppflags = join('', $target{cppflags}, $config{cppflags}) -}
179 CPPFLAGS_Q={- $cppflags =~ s|"|""|g; $defines =~ s|"|""|g;
180               $cppflags."/DEFINE($defines)" -}
181 CFLAGS={- $target{cflags} -} {- $config{cflags} -}
182 LDFLAGS= {- $target{lflags} -}
183 EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
184 LIB_DEFINES={- join("",
185                     (map { ",$_" }
186                      @{$target{shared_defines}},
187                      'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
188                      'ENGINESDIR="""$(ENGINESDIR_C)"""')) -}
189 LIB_CFLAGS={- $target{lib_cflags} // "" -}
190 DSO_CFLAGS={- $target{dso_cflags} // "" -}
191 BIN_CFLAGS={- $target{bin_cflags} // "" -}
192 NO_INST_LIB_CFLAGS={- $target{no_inst_lib_cflags} // '$(LIB_CFLAGS)' -}
193 NO_INST_DSO_CFLAGS={- $target{no_inst_dso_cflags} // '$(DSO_CFLAGS)' -}
194 NO_INST_BIN_CFLAGS={- $target{no_inst_bin_cflags} // '$(BIN_CFLAGS)' -}
195
196 PERL={- $config{perl} -}
197
198 # We let the C compiler driver to take care of .s files. This is done in
199 # order to be excused from maintaining a separate set of architecture
200 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
201 # gcc, then the driver will automatically translate it to -xarch=v8plus
202 # and pass it down to assembler.
203 AS={- $target{as} -}
204 ASFLAG={- $target{asflags} -}
205
206 # .FIRST and .LAST are special targets with MMS and MMK.
207 # The defines in there are for C.  includes that look like
208 # this:
209 #
210 #    #include <openssl/foo.h>
211 #    #include "internal/bar.h"
212 #
213 # will use the logical names to find the files.  Expecting
214 # DECompHP C to find files in subdirectories of whatever was
215 # given with /INCLUDE is a fantasy, unfortunately.
216 NODEBUG=@
217 .FIRST :
218         $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
219         $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
220         $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
221         $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
222         $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
223         $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
224         $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
225         $(NODEBUG) staging_dir = "$(DESTDIR)"
226         $(NODEBUG) staging_instdir = ""
227         $(NODEBUG) staging_datadir = ""
228         $(NODEBUG) IF staging_dir .NES. "" THEN -
229                 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
230         $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
231                 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
232         $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
233                 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
234         $(NODEBUG) IF staging_dir .NES. "" THEN -
235                 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
236         $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
237                 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
238         $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
239                 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
240         $(NODEBUG) !
241         $(NODEBUG) ! Installation logical names
242         $(NODEBUG) !
243         $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
244         $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
245         $(NODEBUG) DEFINE ossl_installroot 'installtop'
246         $(NODEBUG) DEFINE ossl_dataroot 'datatop'
247         $(NODEBUG) !
248         $(NODEBUG) ! Figure out the architecture
249         $(NODEBUG) !
250         $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
251         $(NODEBUG) !
252         $(NODEBUG) ! Set up logical names for the libraries, so LINK and
253         $(NODEBUG) ! running programs can use them.
254         $(NODEBUG) !
255         $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
256
257 .LAST :
258         $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
259         $(NODEBUG) DEASSIGN ossl_dataroot
260         $(NODEBUG) DEASSIGN ossl_installroot
261         $(NODEBUG) DEASSIGN internal
262         $(NODEBUG) DEASSIGN openssl
263 .DEFAULT :
264         @ ! MMS cannot handle no actions...
265
266 # The main targets ###################################################
267
268 {- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep
269 {- dependmagic('build_libs'); -} : build_libs_nodep
270 {- dependmagic('build_engines'); -} : build_engines_nodep
271 {- dependmagic('build_programs'); -} : build_programs_nodep
272
273 build_generated : $(GENERATED_MANDATORY)
274 build_libs_nodep : $(LIBS), $(SHLIBS)
275 build_engines_nodep : $(ENGINES)
276 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
277
278 # Kept around for backward compatibility
279 build_apps build_tests : build_programs
280
281 # Convenience target to prebuild all generated files, not just the mandatory
282 # ones
283 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
284
285 test : tests
286 {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep
287         @ ! {- output_off() if $disabled{tests}; "" -}
288         SET DEFAULT [.test]{- move("test") -}
289         CREATE/DIR [.test-runs]
290         DEFINE SRCTOP {- sourcedir() -}
291         DEFINE BLDTOP {- builddir() -}
292         DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
293         DEFINE OPENSSL_ENGINES {- builddir("engines") -}
294         DEFINE OPENSSL_DEBUG_MEMORY "on"
295         IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
296         $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
297         DEASSIGN OPENSSL_DEBUG_MEMORY
298         DEASSIGN OPENSSL_ENGINES
299         DEASSIGN BLDTOP
300         DEASSIGN SRCTOP
301         SET DEFAULT [-]{- move("..") -}
302         @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
303         @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
304         @ ! {- output_on() if !$disabled{tests}; "" -}
305
306 list-tests :
307         @ ! {- output_off() if $disabled{tests}; "" -}
308         @ DEFINE SRCTOP {- sourcedir() -}
309         @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
310         @ DEASSIGN SRCTOP
311         @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
312         @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
313         @ ! {- output_on() if !$disabled{tests}; "" -}
314
315 install : install_sw install_ssldirs install_docs
316         @ WRITE SYS$OUTPUT ""
317         @ WRITE SYS$OUTPUT "######################################################################"
318         @ WRITE SYS$OUTPUT ""
319         @ IF "$(DESTDIR)" .EQS. "" THEN -
320              PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
321                     WRITE SYS$OUTPUT "" ; -
322                     WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
323                     WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
324                     WRITE SYS$OUTPUT "" )
325         @ IF "$(DESTDIR)" .NES. "" THEN -
326              PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
327                     WRITE SYS$OUTPUT "" ; -
328                     WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
329                     WRITE SYS$OUTPUT staging_instdir ; -
330                     WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
331                     WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
332                     WRITE SYS$OUTPUT staging_datadir ; -
333                     WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
334                     WRITE SYS$OUTPUT "" ; -
335                     WRITE SYS$OUTPUT "When in its final destination," ; -
336                     WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
337                     WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
338                     WRITE SYS$OUTPUT "" )
339
340 check_install :
341         spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
342
343 uninstall : uninstall_docs uninstall_sw
344
345 # Because VMS wants the generation number (or *) to delete files, we can't
346 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
347 libclean :
348         {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
349         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
350
351 clean : libclean
352         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
353         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
354         {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
355         {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
356         - DELETE [...]*.MAP;*
357         - DELETE [...]*.D;*
358         - DELETE [...]*.OBJ;*,*.LIS;*
359         - DELETE []CXX$DEMANGLER_DB.;*
360         - DELETE [.VMS]openssl_startup.com;*
361         - DELETE [.VMS]openssl_shutdown.com;*
362         - DELETE []vmsconfig.pm;*
363
364 distclean : clean
365         - DELETE configdata.pm;*
366         - DELETE descrip.mms;*
367
368 depend : descrip.mms
369 descrip.mms : FORCE
370         @ ! {- output_off() if $disabled{makedepend}; "" -}
371         @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
372                 < descrip.mms > descrip.mms-new
373         @ OPEN/APPEND DESCRIP descrip.mms-new
374         @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
375         {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
376         @ CLOSE DESCRIP
377         @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
378                  RENAME descrip.mms-new descrip.mms )
379         @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
380         -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
381         @ ! {- output_on() if $disabled{makedepend}; "" -}
382
383 # Install helper targets #############################################
384
385 install_sw : all install_shared _install_dev_ns -
386              install_engines _install_runtime_ns -
387              install_startup install_ivp
388
389 uninstall_sw : uninstall_shared _uninstall_dev_ns -
390                uninstall_engines _uninstall_runtime_ns -
391                uninstall_startup uninstall_ivp
392
393 install_docs : install_html_docs
394
395 uninstall_docs : uninstall_html_docs
396
397 install_ssldirs : check_INSTALLTOP
398         - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
399         IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
400                 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
401         IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
402                 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
403         IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
404                 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
405         COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
406         @ ! Install configuration file
407         COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
408                 ossl_dataroot:[000000]openssl.cnf-dist
409         IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
410                 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
411                         ossl_dataroot:[000000]openssl.cnf
412         @ ! Install CTLOG configuration file
413         COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
414                 ossl_dataroot:[000000]ct_log_list.cnf-dist
415         IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
416                 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
417                         ossl_dataroot:[000000]ct_log_list.cnf
418
419 install_shared : check_INSTALLTOP
420         @ {- output_off() if $disabled{shared}; "" -} !
421         @ WRITE SYS$OUTPUT "*** Installing shareable images"
422         @ ! Install shared (runtime) libraries
423         - CREATE/DIR ossl_installroot:[LIB.'arch']
424         {- join("\n        ",
425                 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
426                 @install_shlibs) -}
427         @ {- output_on() if $disabled{shared}; "" -} !
428
429 _install_dev_ns : check_INSTALLTOP
430         @ WRITE SYS$OUTPUT "*** Installing development files"
431         @ ! Install header files
432         - CREATE/DIR ossl_installroot:[include.openssl]
433         COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
434         @ ! Install static (development) libraries
435         - CREATE/DIR ossl_installroot:[LIB.'arch']
436         {- join("\n        ",
437                 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
438                 @install_libs) -}
439
440 install_dev : install_shared _install_dev_ns
441
442 _install_runtime_ns : check_INSTALLTOP
443         @ ! Install the main program
444         - CREATE/DIR ossl_installroot:[EXE.'arch']
445         COPY/PROT=W:RE [.APPS]openssl.EXE -
446                 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
447         @ ! Install scripts
448         COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
449         @ ! {- output_on() if $disabled{apps}; "" -}
450
451 install_runtime : install_shared _install_runtime_ns
452
453 install_engines : check_INSTALLTOP
454         @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
455         @ WRITE SYS$OUTPUT "*** Installing engines"
456         - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
457         {- join("\n        ",
458                 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
459                 @{$unified_info{install}->{engines}}) -}
460         @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
461
462 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
463                  [.VMS]openssl_utils.com, check_INSTALLTOP
464         - CREATE/DIR ossl_installroot:[SYS$STARTUP]
465         COPY/PROT=W:RE [.VMS]openssl_startup.com -
466                 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
467         COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
468                 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
469         COPY/PROT=W:RE [.VMS]openssl_utils.com -
470                 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
471
472 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
473         - CREATE/DIR ossl_installroot:[SYSTEST]
474         COPY/PROT=W:RE [.VMS]openssl_ivp.com -
475                 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
476
477 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
478         - CREATE/DIR [.VMS]
479         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
480                 {- sourcefile("VMS", "openssl_startup.com.in") -} -
481                 > [.VMS]openssl_startup.com
482
483 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
484         - CREATE/DIR [.VMS]
485         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
486                 {- sourcefile("VMS", "openssl_utils.com.in") -} -
487                 > [.VMS]openssl_utils.com
488
489 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
490         - CREATE/DIR [.VMS]
491         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
492                 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
493                 > [.VMS]openssl_shutdown.com
494
495 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
496         - CREATE/DIR [.VMS]
497         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
498                 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
499                 > [.VMS]openssl_ivp.com
500
501 vmsconfig.pm : configdata.pm
502         OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
503         WRITE CONFIG "package vmsconfig;"
504         WRITE CONFIG "use strict; use warnings;"
505         WRITE CONFIG "use Exporter;"
506         WRITE CONFIG "our @ISA = qw(Exporter);"
507         WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
508         WRITE CONFIG "our %config = ("
509         WRITE CONFIG "  target => '","{- $config{target} -}","',"
510         WRITE CONFIG "  version => '","{- $config{version} -}","',"
511         WRITE CONFIG "  shlib_version_number => '","{- $config{shlib_version_number} -}","',"
512         WRITE CONFIG "  shlib_major => '","{- $config{shlib_major} -}","',"
513         WRITE CONFIG "  shlib_minor => '","{- $config{shlib_minor} -}","',"
514         WRITE CONFIG "  no_shared => '","{- $disabled{shared} -}","',"
515         WRITE CONFIG "  INSTALLTOP => '$(INSTALLTOP)',"
516         WRITE CONFIG "  OPENSSLDIR => '$(OPENSSLDIR)',"
517         WRITE CONFIG "  pointer_size => '","{- $target{pointer_size} -}","',"
518         WRITE CONFIG ");"
519         WRITE CONFIG "our %target = ();"
520         WRITE CONFIG "our %disabled = ();"
521         WRITE CONFIG "our %withargs = ();"
522         WRITE CONFIG "our %unified_info = ();"
523         WRITE CONFIG "1;"
524         CLOSE CONFIG
525
526 install_html_docs : check_INSTALLTOP
527         sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
528         $(PERL) {- sourcefile("util", "process_docs.pl") -} -
529                 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
530                 --type=html
531
532 check_INSTALLTOP :
533         @ IF "$(INSTALLTOP)" .EQS. "" THEN -
534                 WRITE SYS$ERROR "INSTALLTOP should not be empty"
535         @ IF "$(INSTALLTOP)" .EQS. "" THEN -
536                 EXIT %x10000002
537
538 # Helper targets #####################################################
539
540 # Developer targets ##################################################
541
542 debug_logicals :
543         SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
544
545 # Building targets ###################################################
546
547 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
548         @ WRITE SYS$OUTPUT "Reconfiguring..."
549         perl $(SRCDIR)Configure reconf
550         @ WRITE SYS$OUTPUT "*************************************************"
551         @ WRITE SYS$OUTPUT "***                                           ***"
552         @ WRITE SYS$OUTPUT "***   Please run the same mms command again   ***"
553         @ WRITE SYS$OUTPUT "***                                           ***"
554         @ WRITE SYS$OUTPUT "*************************************************"
555         @ PIPE ( EXIT %X10000000 )
556
557 {-
558   use File::Basename;
559   use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
560
561   # Helper function to figure out dependencies on libraries
562   # It takes a list of library names and outputs a list of dependencies
563   sub compute_lib_depends {
564       if ($disabled{shared}) {
565           return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_;
566       }
567       return map { $_ =~ /\.a$/
568                    ? $`.".OLB"
569                    : $unified_info{sharednames}->{$_}.".EXE" } @_;
570   }
571
572   sub generatesrc {
573       my %args = @_;
574       my $generator = join(" ", @{$args{generator}});
575       my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
576       my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
577
578       if ($args{src} !~ /\.[sS]$/) {
579           if ($args{generator}->[0] =~ m|^.*\.in$|) {
580               my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
581                                                    "util", "dofile.pl")),
582                                    rel2abs($config{builddir}));
583               return <<"EOF";
584 $args{src} : $args{generator}->[0] $deps
585         \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
586             "-o$target{build_file}" $generator > \$@
587 EOF
588           } else {
589               return <<"EOF";
590 $args{src} : $args{generator}->[0] $deps
591         \$(PERL)$generator_incs $generator > \$@
592 EOF
593           }
594       } else {
595           die "No method to generate assembler source present.\n";
596       }
597   }
598
599   sub src2obj {
600       my %args = @_;
601       (my $obj = $args{obj}) =~ s|\.o$||;
602       my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
603
604       # Because VMS C isn't very good at combining a /INCLUDE path with
605       # #includes having a relative directory (like '#include "../foo.h"),
606       # the best choice is to move to the first source file's intended
607       # directory before compiling, and make sure to write the object file
608       # in the correct position (important when the object tree is other
609       # than the source tree).
610       my $forward = dirname($args{srcs}->[0]);
611       my $backward = abs2rel(rel2abs("."), rel2abs($forward));
612       my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
613       my $objn = basename($obj);
614       my $srcs =
615           join(", ",
616                map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
617       my $cflags = '$(CFLAGS)';
618       if ($args{installed}) {
619           $cflags .= { lib => '$(LIB_CFLAGS)',
620                        dso => '$(DSO_CFLAGS)',
621                        bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
622       } else {
623           $cflags .= { lib => '$(NO_INST_LIB_CFLAGS)',
624                        dso => '$(NO_INST_DSO_CFLAGS)',
625                        bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
626       }
627       $cflags .= '$(CPPFLAGS)';
628       $cflags .= { lib => '$(LIB_CPPFLAGS)',
629                    dso => '$(DSO_CPPFLAGS)',
630                    bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
631       my $defines = '$(DEFINES)';
632       $defines .= { lib => '$(LIB_DEFINES)',
633                     dso => '$(DSO_DEFINES)',
634                     bin => '$(BIN_DEFINES)' } -> {$args{intent}};
635       $cflags .= '/DEFINE=('.$defines.')';
636       
637       my $incs_on = "\@ !";
638       my $incs_off = "\@ !";
639       my $incs = "";
640       my @incs = ();
641       push @incs, @{$args{incs}} if @{$args{incs}};
642       unless ($disabled{zlib}) {
643           # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
644           # incarnations.
645           push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
646       }
647       if (@incs) {
648           $incs_on =
649               "DEFINE tmp_includes "
650               .join(",-\n\t\t\t", map {
651                                       file_name_is_absolute($_)
652                                       ? $_ : catdir($backward,$_)
653                                   } @incs);
654           $incs_off = "DEASSIGN tmp_includes";
655           $incs = " /INCLUDE=(tmp_includes:)";
656       }
657       my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
658       my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
659       my $depbuild = $disabled{makedepend} ? ""
660           : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
661
662       return <<"EOF"
663 $obj.OBJ : $deps
664         ${before}
665         SET DEFAULT $forward
666         $incs_on
667         \$(CC) ${cflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
668         $incs_off
669         SET DEFAULT $backward
670         ${after}
671         - PURGE $obj.OBJ
672 EOF
673       . ($disabled{makedepend} ? "" : <<"EOF"
674         \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
675                  RENAME $obj.tmp-D $obj.d )
676         \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
677 EOF
678         );
679   }
680   sub libobj2shlib {
681       my %args = @_;
682       my $lib = $args{lib};
683       my $shlib = $args{shlib};
684       my $libd = dirname($lib);
685       my $libn = basename($lib);
686       my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x }
687                  grep { $_ =~ m|\.o$| }
688                  @{$args{objs}};
689       my @defs = grep { $_ =~ /\.opt$/ } @{$args{objs}};
690       my @deps = compute_lib_depends(@{$args{deps}});
691       die "More than one symbol vector" if scalar @defs > 1;
692       my $deps = join(", -\n\t\t", @defs, @deps);
693       my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
694       my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
695                                                      "VMS", "translatesyms.pl")),
696                                      rel2abs($config{builddir}));
697       # The "[]" hack is because in .OPT files, each line inherits the
698       # previous line's file spec as default, so if no directory spec
699       # is present in the current line and the previous line has one that
700       # doesn't apply, you're in for a surprise.
701       my $write_opt1 =
702           join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
703                                  "WRITE OPT_FILE \"$x" } @objs).
704           "\"";
705       my $write_opt2 =
706           join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
707                              $x =~ s|(\.EXE)|$1/SHARE|;
708                              $x =~ s|(\.OLB)|$1/LIB|;
709                              "WRITE OPT_FILE \"$x\"" } @deps)
710           || "\@ !";
711       return <<"EOF"
712 $shlib.EXE : $lib.OLB $deps
713         \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
714         OPEN/WRITE/SHARE=READ OPT_FILE $lib-components.OPT
715         $write_opt1
716         $write_opt2
717         CLOSE OPT_FILE
718         LINK \$(LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
719                 $lib-components.OPT/OPT \$(EX_LIBS)
720         DELETE $defs[0]-translated;*,$lib-components.OPT;*
721         PURGE $shlib.EXE,$shlib.MAP
722 EOF
723         . ($config{target} =~ m|alpha| ? "" : <<"EOF"
724         SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
725 EOF
726         );
727   }
728   sub obj2dso {
729       my %args = @_;
730       my $lib = $args{lib};
731       my $libd = dirname($lib);
732       my $libn = basename($lib);
733       (my $libn_nolib = $libn) =~ s/^lib//;
734       my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
735       my @deps = compute_lib_depends(@{$args{deps}});
736       my $deps = join(", -\n\t\t", @objs, @deps);
737       my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
738       my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
739                                                "VMS", "engine.opt")),
740                                rel2abs($config{builddir}));
741       # The "[]" hack is because in .OPT files, each line inherits the
742       # previous line's file spec as default, so if no directory spec
743       # is present in the current line and the previous line has one that
744       # doesn't apply, you're in for a surprise.
745       my $write_opt1 =
746           join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
747                                  "WRITE OPT_FILE \"$x" } @objs).
748           "\"";
749       my $write_opt2 =
750           join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
751                              $x =~ s|(\.EXE)|$1/SHARE|;
752                              $x =~ s|(\.OLB)|$1/LIB|;
753                              "WRITE OPT_FILE \"$x\"" } @deps)
754           || "\@ !";
755       return <<"EOF"
756 $lib.EXE : $deps
757         OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
758         TYPE $engine_opt /OUTPUT=OPT_FILE:
759         $write_opt1
760         $write_opt2
761         CLOSE OPT_FILE
762         LINK \$(LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(EX_LIBS)
763         - PURGE $lib.EXE,$lib.OPT,$lib.MAP
764 EOF
765         . ($config{target} =~ m|alpha| ? "" : <<"EOF"
766         SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
767 EOF
768         );
769   }
770   sub obj2lib {
771       my %args = @_;
772       (my $lib = $args{lib}) =~ s/\.a$//;
773       my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
774       my $objs = join(", -\n\t\t", @objs);
775       my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_" }
776                                    @objs));
777       return <<"EOF";
778 $lib.OLB : $objs
779         LIBRARY/CREATE/OBJECT $lib.OLB
780         $fill_lib
781         - PURGE $lib.OLB
782 EOF
783   }
784   sub obj2bin {
785       my %args = @_;
786       my $bin = $args{bin};
787       my $bind = dirname($bin);
788       my $binn = basename($bin);
789       my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
790       my $objs = join(",", @objs);
791       my @deps = compute_lib_depends(@{$args{deps}});
792       my $deps = join(", -\n\t\t", @objs, @deps);
793
794       my $olb_count = scalar grep(m|\.OLB$|, @deps);
795       my $analyse_objs = "@ !";
796       if ($olb_count > 0) {
797           my $analyse_quals =
798               $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
799           $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
800       }
801       # The "[]" hack is because in .OPT files, each line inherits the
802       # previous line's file spec as default, so if no directory spec
803       # is present in the current line and the previous line has one that
804       # doesn't apply, you're in for a surprise.
805       my $write_opt1 =
806           join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
807                                  "\@ WRITE OPT_FILE \"$x" } @objs).
808           "\"";
809       my $write_opt2 =
810           join("\n\t", map { my @lines = ();
811                              my $x = $_ =~ /\[/ ? $_ : "[]".$_;
812                              if ($x =~ m|\.EXE$|) {
813                                  push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
814                              } elsif ($x =~ m|\.OLB$|) {
815                                  (my $l = $x) =~ s/\W/_/g;
816                                  push @lines, 
817                                      "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB\$(INCLUDE_MAIN_$l)\"",
818                                      "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
819                              }
820                              @lines
821                            } @deps)
822           || "\@ !";
823       # The linking commands looks a bit complex, but it's for good reason.
824       # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
825       # bar.obj happens to have a symbol that also exists in libsomething.exe,
826       # the linker will warn about it, loudly, and will then choose to pick
827       # the first copy encountered (the one in bar.obj in this example).
828       # On Unix and on Windows, the corresponding maneuvre goes through
829       # silently with the same effect.
830       # With some test programs, made for checking the internals of OpenSSL,
831       # we do this kind of linking deliberately, picking a few specific object
832       # files from within [.crypto] or [.ssl] so we can reach symbols that are
833       # otherwise unreachable (since the shareable images only exports the
834       # symbols listed in [.util]*.num), and then with the shared libraries
835       # themselves.  So we need to silence the warning about multiply defined
836       # symbols, to mimic the way linking work on Unix and Windows, and so
837       # the build isn't interrupted (MMS stops when warnings are signaled,
838       # by default), and so someone building doesn't have to worry where it
839       # isn't necessary.  If there are other warnings, however, we show them
840       # and let it break the build.
841       return <<"EOF"
842 $bin.EXE : $deps
843         $analyse_objs
844         @ OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
845         $write_opt1
846         $write_opt2
847         @ CLOSE OPT_FILE
848         TYPE $bin.opt ! For debugging
849         - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
850                     LINK \$(LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(EX_LIBS) ; -
851                link_status = \$status ; link_severity = link_status .AND. 7
852         @ search_severity = 1
853         -@ IF link_severity .EQ. 0 THEN -
854                 pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | -
855                      SPAWN/WAIT/NOLOG/OUT=NLA0: -
856                           SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
857                      search_severity = \$severity
858         @ ! search_severity is 3 when the last search didn't find any matching
859         @ ! string: %SEARCH-I-NOMATCHES, no strings matched
860         @ ! If that was the result, we pretend linking got through without
861         @ ! fault or warning.
862         @ IF search_severity .EQ. 3 THEN link_severity = 1
863         @ ! At this point, if link_severity shows that there was a fault
864         @ ! or warning, make sure to restore the linking status.
865         -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG
866         -@ DELETE $bin.LINKLOG;*
867         @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
868         - PURGE $bin.EXE,$bin.OPT
869 EOF
870       . ($config{target} =~ m|alpha| ? "" : <<"EOF"
871         SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
872 EOF
873         );
874   }
875   sub in2script {
876       my %args = @_;
877       my $script = $args{script};
878       return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
879       my $sources = join(" ", @{$args{sources}});
880       my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
881                                            "util", "dofile.pl")),
882                            rel2abs($config{builddir}));
883       return <<"EOF";
884 $script : $sources
885         \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
886             "-o$target{build_file}" $sources > $script
887         SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
888         PURGE $script
889 EOF
890   }
891   ""    # Important!  This becomes part of the template result.
892 -}