1 ## descrip.mms to build OpenSSL on OpenVMS
3 ## {- join("\n## ", @autowarntext) -}
5 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
9 (our $osslprefix_q = platform->osslprefix()) =~ s/\$/\\\$/;
11 our $sover_dirname = platform->shlib_version_as_filename();
12 our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
14 our $sourcedir = $config{sourcedir};
15 our $builddir = $config{builddir};
17 # Split the native path
18 (my $vol, my $dirs, my $file) = File::Spec->splitpath($_[0]);
19 my @dirs = File::Spec->splitdir($dirs);
21 # Reassemble it as a Unix path
23 return File::Spec::Unix->catpath(
24 '', File::Spec::Unix->catdir('', $vol ? $vol : (), @dirs), $file);
27 catfile($sourcedir, @_);
30 catfile($builddir, @_);
33 catdir($sourcedir, @_);
36 catdir($builddir, @_);
39 (my $x = shift) =~ s|\]$|...]|;
43 # Because we need to make two computations of these data,
44 # we store them in arrays for reuse
46 map { platform->staticname($_) }
47 @{$unified_info{libraries}};
49 map { platform->sharedname($_) // () }
50 @{$unified_info{libraries}};
52 map { platform->staticname($_) }
53 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
54 @{$unified_info{libraries}};
56 map { platform->sharedname($_) // () }
57 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
58 @{$unified_info{libraries}};
59 our @install_engines =
60 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
61 && $unified_info{attributes}->{modules}->{$_}->{engine} }
62 @{$unified_info{modules}};
63 our @install_modules =
64 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
65 && !$unified_info{attributes}->{modules}->{$_}->{engine} }
66 @{$unified_info{modules}};
67 our @install_programs =
68 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
69 @{$unified_info{programs}};
70 our @install_bin_scripts =
71 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
72 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
73 @{$unified_info{scripts}};
74 our @install_misc_scripts =
75 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
76 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
77 @{$unified_info{scripts}};
81 our @cnf_asflags = ($target{asflags} || (), @{$config{asflags}});
82 our @cnf_defines = (@{$target{defines}}, @{$config{defines}});
83 our @cnf_includes = (@{$target{includes}}, @{$config{includes}});
84 our @cnf_cppflags = ($target{cppflags} || (), @{$config{cppflags}});
85 our @cnf_cflags = ($target{cflags} || (), @{$config{cflags}});
86 our @cnf_cxxflags = ($target{cxxflags} || (), @{$config{cxxflags}});
87 our @cnf_ldflags = ($target{lflags} || (), @{$config{lflags}});
88 our @cnf_ex_libs = (map{ ",$_" } @{$target{ex_libs}}, @{$config{ex_libs}});
90 # Variables starting with $lib_ are used to build library object files
91 # and shared libraries.
92 # Variables starting with $dso_ are used to build DSOs and their object files.
93 # Variables starting with $bin_ are used to build programs and their object
96 # The following array is special and is treated separately from the rest of
98 our @lib_cppincludes = (@{$target{lib_includes}}, @{$target{shared_includes}},
99 @{$config{lib_includes}}, @{$config{shared_includes}},
102 our $lib_cppdefines =
103 join(',', @{$target{lib_defines}}, @{$target{shared_defines}},
104 @{$config{lib_defines}}, @{$config{shared_defines}},
106 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
107 'ENGINESDIR="""$(ENGINESDIR_C)"""',
108 'MODULESDIR="""$(MODULESDIR_C)"""',
113 join(' ', $target{lib_asflags} || (), @{$config{lib_asflags}},
114 @cnf_asflags, '$(ASFLAGS)');
116 join('', $target{lib_cppflags} || (), $target{shared_cppflags} || (),
117 @{$config{lib_cppflags}}, @{$config{shared_cppflag}},
118 @cnf_cppflags, '/DEFINE=('.$lib_cppdefines.')', '$(CPPFLAGS)');
119 my @lib_cflags = ( $target{lib_cflags} // () );
120 my @lib_cflags_no_inst = ( $target{no_inst_lib_cflags} // @lib_cflags );
121 my @lib_cflags_cont = ( $target{shared_cflag} || (),
122 @{$config{lib_cflags}}, @{$config{shared_cflag}},
123 $cnf_cflags, '$(CFLAGS)');
124 our $lib_cflags = join('', @lib_cflags, @lib_cflags_cont );
125 our $lib_cflags_no_inst = join('', @lib_cflags_no_inst, @lib_cflags_cont );
127 join('', $target{lib_lflags} || (), $target{shared_ldflag} || (),
128 @{$config{lib_lflags}}, @{$config{shared_ldflag}},
129 @cnf_ldflags, '$(LDFLAGS)');
130 our $lib_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
132 # The following array is special and is treated separately from the rest of
133 # the dso_ variables.
134 our @dso_cppincludes = (@{$target{dso_includes}}, @{$target{module_includes}},
135 @{$config{dso_includes}}, @{$config{module_includes}},
138 our $dso_cppdefines =
139 join(',', @{$target{dso_defines}}, @{$target{module_defines}},
140 @{$config{dso_defines}}, @{$config{module_defines}},
146 join(' ', $target{dso_asflags} || (), $target{module_asflags} || (),
147 @{$config{dso_asflags}}, @{$config{module_asflags}},
148 @cnf_asflags, '$(ASFLAGS)');
150 join('', $target{dso_cppflags} || (), $target{module_cppflags} || (),
151 @{$config{dso_cppflags}}, @{$config{module_cppflag}},
153 '/DEFINE=('.$dso_cppdefines.')',
155 my @dso_cflags = ( $target{dso_cflags} // () );
156 my @dso_cflags_no_inst = ( $target{no_inst_dso_cflags} // @dso_cflags );
157 my @dso_cflags_cont = ( $target{module_cflag} || (),
158 @{$config{dso_cflags}}, @{$config{module_cflag}},
159 $cnf_cflags, '$(CFLAGS)');
160 our $dso_cflags = join('', @dso_cflags, @dso_cflags_cont );
161 our $dso_cflags_no_inst = join('', @dso_cflags_no_inst, @dso_cflags_cont );
163 join('', $target{dso_lflags} || (), $target{module_ldflag} || (),
164 @{$config{dso_lflags}}, @{$config{module_ldflag}},
165 @cnf_ldflags, '$(LDFLAGS)');
166 our $dso_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
168 # The following array is special and is treated separately from the rest of
169 # the bin_ variables.
170 our @bin_cppincludes = (@{$target{bin_includes}},
171 @{$config{bin_includes}},
174 our $bin_cppdefines =
175 join(',', @{$target{bin_defines}},
176 @{$config{bin_defines}},
182 join(' ', $target{bin_asflags} || (),
183 @{$config{bin_asflags}},
184 @cnf_asflags, '$(ASFLAGS)');
186 join('', $target{bin_cppflags} || (),
187 @{$config{bin_cppflags}},
189 '/DEFINE=('.$bin_cppdefines.')',
191 my @bin_cflags = ( $target{bin_cflags} // () );
192 my @bin_cflags_no_inst = ( $target{no_inst_bin_cflags} // @bin_cflags );
193 my @bin_cflags_cont = ( @{$config{bin_cflags}},
194 $cnf_cflags, '$(CFLAGS)');
195 our $bin_cflags = join('', @bin_cflags, @bin_cflags_cont );
196 our $bin_cflags_no_inst = join('', @bin_cflags_no_inst, @bin_cflags_cont );
198 join('', $target{bin_cflags} || (),
199 @{$config{bin_cflags}},
200 @cnf_cflags, '$(CFLAGS)');
202 join('', $target{bin_lflags} || (),
203 @{$config{bin_lflags}},
204 @cnf_ldflags, '$(LDFLAGS)');
205 our $bin_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
207 # This is a horrible hack, but is needed because recursive inclusion of files
208 # in different directories does not work well with HP C.
209 my $sd = sourcedir("crypto", "async", "arch");
210 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
211 my $obj = platform->obj($_);
212 $unified_info{before}->{$obj}
213 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
214 define arch 'arch_include');
215 $unified_info{after}->{$obj}
218 my $sd32 = sourcedir("crypto", "ec", "curve448", "arch_32");
219 my $sd64 = sourcedir("crypto", "ec", "curve448", "arch_64");
220 foreach (grep /\[\.crypto\.ec\.curve448.*?\].*?\.o$/, keys %{$unified_info{sources}}) {
221 my $obj = platform->obj($_);
222 $unified_info{before}->{$obj}
223 = qq(arch_32_include = F\$PARSE("$sd32","A.;",,,"SYNTAX_ONLY") - "A.;"
224 define arch_32 'arch_32_include'
225 arch_64_include = F\$PARSE("$sd64","A.;",,,"SYNTAX_ONLY") - "A.;"
226 define arch_64 'arch_64_include');
227 $unified_info{after}->{$obj}
228 = qq(deassign arch_64
231 my $sd1 = sourcedir("ssl","record");
232 my $sd2 = sourcedir("ssl","statem");
233 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
234 keys %{$unified_info{sources}});
235 foreach (@ssl_locl_users) {
236 my $obj = platform->obj($_);
237 $unified_info{before}->{$obj}
238 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
239 define record 'record_include'
240 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
241 define statem 'statem_include');
242 $unified_info{after}->{$obj}
247 # This makes sure things get built in the order they need
248 # to. You're welcome.
252 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
256 PLATFORM={- $config{target} -}
257 OPTIONS={- $config{options} -}
258 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
259 SRCDIR={- $config{sourcedir} -}
260 BLDDIR={- $config{builddir} -}
261 FIPSKEY={- $config{FIPSKEY} -}
263 # Allow both V and VERBOSE to indicate verbosity. This only applies
266 VERBOSE_FAILURE=$(VF)
268 VERSION={- "$config{full_version}" -}
269 MAJOR={- $config{major} -}
270 MINOR={- $config{minor} -}
271 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
272 SHLIB_TARGET={- $target{shared_target} -}
274 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
275 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
276 FIPSMODULENAME={- # We do some extra checking here, as there should be only one
279 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
280 && $unified_info{attributes}->{modules}->{$_}->{fips} }
281 @{$unified_info{modules}};
282 die "More that one FIPS module" if scalar @fipsmodules > 1;
283 join(", ", map { basename(platform->dso($_)) } @fipsmodules) -}
284 MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{modules}}) -}
285 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
286 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
287 {- output_off() if $disabled{makedepend}; "" -}
288 DEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ }
289 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
290 keys %{$unified_info{sources}};
291 join(", ", map { "-\n\t".$_ } @deps); -}
292 {- output_on() if $disabled{makedepend}; "" -}
293 GENERATED_MANDATORY={- join(", ",
294 map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
295 GENERATED_PODS={- # common0.tmpl provides @generated
300 $unified_info{attributes}->{depends}
301 ->{$x}->{$_}->{pod} // 0
303 keys %{$unified_info{attributes}->{depends}->{$x}}
307 GENERATED={- # common0.tmpl provides @generated
308 join(", ", map { platform->convertext($_) } @generated) -}
310 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
311 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
312 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
313 INSTALL_MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @install_modules) -}
314 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
315 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
316 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
317 HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
318 HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
319 HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
320 HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
322 APPS_OPENSSL="{- use File::Spec::Functions;
323 catfile("apps","openssl") -}"
325 # DESTDIR is for package builders so that they can configure for, say,
326 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
327 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
328 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
329 # STAGING:[USER.OPENSSL].
330 # Normally it is left empty.
333 # Do not edit this manually. Use Configure --prefix=DIR to change this!
334 INSTALLTOP={- our $installtop =
335 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
337 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
338 # This is the standard central area to store certificates, private keys...
339 OPENSSLDIR={- catdir($config{openssldir}) or
340 $config{prefix} ? catdir($config{prefix},"COMMON")
341 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
342 # The same, but for C
343 OPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000]
344 # Where installed ENGINE modules reside, for C
345 ENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
346 # Where modules reside, for C
347 MODULESDIR_C={- platform->osslprefix() -}MODULES{- $sover_dirname.$target{pointer_size} -}:
349 ##### User defined commands and flags ################################
352 CPP={- $config{CPP} -}
353 DEFINES={- our $defines = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
354 #INCLUDES={- our $includes = join(',', @{$config{CPPINCLUDES}}) -}
355 CPPFLAGS={- our $cppflags = join('', @{$config{CPPFLAGS}}) -}
356 CFLAGS={- join('', @{$config{CFLAGS}}) -}
357 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
358 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
360 PERL={- $config{PERL} -}
363 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
365 ##### Special command flags ##########################################
367 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
369 PERLASM_SCHEME={- $target{perlasm_scheme} -}
371 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
372 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags) =~ s|"|""|g;
373 (my $d = $lib_cppdefines) =~ s|"|""|g;
374 my $i = join(',', @lib_cppincludes || (), '$(INCLUDES)');
376 $x .= "/INCLUDE=($i)" if $i;
377 $x .= "/DEFINE=($d)" if $d;
380 # .FIRST and .LAST are special targets with MMS and MMK.
381 # The defines in there are for C. includes that look like
384 # #include <openssl/foo.h>
385 # #include "internal/bar.h"
387 # will use the logical names to find the files. Expecting
388 # DECompHP C to find files in subdirectories of whatever was
389 # given with /INCLUDE is a fantasy, unfortunately.
392 $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
393 $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop'
395 $(NODEBUG) staging_dir = "$(DESTDIR)"
396 $(NODEBUG) staging_instdir = ""
397 $(NODEBUG) staging_datadir = ""
398 $(NODEBUG) IF staging_dir .NES. "" THEN -
399 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
400 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
401 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
402 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
403 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
404 $(NODEBUG) IF staging_dir .NES. "" THEN -
405 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
406 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
407 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
408 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
409 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
411 $(NODEBUG) ! Installation logical names
413 $(NODEBUG) ! This also creates a few DCL variables that are used for
414 $(NODEBUG) ! the "install_msg" target.
416 $(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
417 $(NODEBUG) installtop = installroot + ".]"
418 $(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
419 $(NODEBUG) datatop = dataroot + ".]"
420 $(NODEBUG) DEFINE ossl_installroot 'installtop'
421 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
423 $(NODEBUG) ! Override disturbing system logicals. We can't deassign
424 $(NODEBUG) ! them, so we create it instead. This is an unfortunate
425 $(NODEBUG) ! necessity.
427 $(NODEBUG) DEFINE openssl "{- sourcedir('include/openssl') -}
429 $(NODEBUG) ! Figure out the architecture
431 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
433 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
434 $(NODEBUG) ! running programs can use them.
436 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
439 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
440 $(NODEBUG) DEASSIGN ossl_dataroot
441 $(NODEBUG) DEASSIGN ossl_installroot
442 $(NODEBUG) DEASSIGN openssl
444 @ ! MMS cannot handle no actions...
446 # The main targets ###################################################
448 {- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep copy-utils
449 {- dependmagic('build_libs'); -} : build_libs_nodep
450 {- dependmagic('build_modules'); -} : build_modules_nodep
451 {- dependmagic('build_programs'); -} : build_programs_nodep
453 build_generated_pods : $(GENERATED_PODS)
454 build_docs : build_html_docs
455 build_html_docs : $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
457 build_generated : $(GENERATED_MANDATORY)
458 build_libs_nodep : $(LIBS), $(SHLIBS)
459 build_modules_nodep : $(MODULES)
460 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
462 # Kept around for backward compatibility
463 build_apps build_tests : build_programs
465 # Convenience target to prebuild all generated files, not just the mandatory
467 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
468 @ ! {- output_off() if $disabled{makedepend}; "" -}
469 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
470 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
471 @ WRITE SYS$OUTPUT " then make will fail..."
472 @ ! {- output_on() if $disabled{makedepend}; "" -}
474 all : build_sw build_docs
477 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep copy-utils run_tests
479 @ ! {- output_off() if $disabled{tests}; "" -}
480 DEFINE SRCTOP "$(SRCDIR)"
481 DEFINE BLDTOP "$(BLDDIR)"
482 DEFINE FIPSKEY "$(FIPSKEY)"
483 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
484 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
488 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
489 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
490 @ ! {- output_on() if !$disabled{tests}; "" -}
493 @ ! {- output_off() if $disabled{tests}; "" -}
494 @ DEFINE SRCTOP "$(SRCDIR)"
495 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
497 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
498 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
499 @ ! {- output_on() if !$disabled{tests}; "" -}
501 install : install_sw install_ssldirs install_docs install_msg
504 @ WRITE SYS$OUTPUT ""
505 @ WRITE SYS$OUTPUT "######################################################################"
506 @ WRITE SYS$OUTPUT ""
507 @ IF "$(DESTDIR)" .EQS. "" THEN -
508 @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}"
509 @ IF "$(DESTDIR)" .NES. "" THEN -
510 @{- sourcefile("VMS", "msg_staging.com") -} -
511 "''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" -
512 "$(SYSTARTUP)" "{- $osslver -}"
515 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
517 uninstall : uninstall_docs uninstall_sw
519 # Because VMS wants the generation number (or *) to delete files, we can't
520 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
522 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
523 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
526 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
527 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
528 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
529 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
530 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
531 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
532 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
533 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
534 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
535 - DELETE [...]*.MAP;*
537 - DELETE [...]*.OBJ;*,*.LIS;*
538 - DELETE []CXX$DEMANGLER_DB.;*
539 - DELETE [.VMS]openssl_startup.com;*
540 - DELETE [.VMS]openssl_shutdown.com;*
541 - DELETE []vmsconfig.pm;*
544 - DELETE configdata.pm;*
545 - DELETE descrip.mms;*
549 @ ! {- output_off() if $disabled{makedepend}; "" -}
550 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "{- $config{makedep_scheme} -}"
551 @ ! {- output_on() if $disabled{makedepend}; "" -}
553 # Install helper targets #############################################
555 install_sw : install_dev install_engines install_modules -
556 install_runtime install_startup install_ivp
558 uninstall_sw : uninstall_dev uninstall_modules uninstall_engines -
559 uninstall_runtime uninstall_startup uninstall_ivp
561 install_docs : install_html_docs
563 uninstall_docs : uninstall_html_docs
565 install_fips : install_sw
566 @ WRITE SYS$OUTPUT "*** Installing FIPS module configuration"
567 @ WRITE SYS$OUTPUT "fipsinstall $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
568 openssl fipsinstall -
569 -module ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME) -
570 -out ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf -
571 -macopt "hexkey:$(FIPSKEY)"
573 uninstall_fips : uninstall_sw
574 @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module configuration"
575 DELETE ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf;*
577 install_ssldirs : check_INSTALLTOP
578 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
579 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
580 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
581 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
582 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
583 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
584 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
585 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
586 @ ! Install configuration file
587 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
588 ossl_dataroot:[000000]openssl.cnf-dist
589 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
590 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
591 ossl_dataroot:[000000]openssl.cnf
592 @ ! Install CTLOG configuration file
593 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
594 ossl_dataroot:[000000]ct_log_list.cnf-dist
595 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
596 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
597 ossl_dataroot:[000000]ct_log_list.cnf
599 install_dev : check_INSTALLTOP install_runtime_libs
600 @ WRITE SYS$OUTPUT "*** Installing development files"
601 @ ! Install header files
602 - CREATE/DIR ossl_installroot:[include.openssl]
603 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
604 @ ! Install static (development) libraries
605 - CREATE/DIR ossl_installroot:[LIB.'arch']
607 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
610 install_engines : check_INSTALLTOP install_runtime_libs build_modules
611 @ {- output_off() unless scalar @install_engines; "" -} !
612 @ WRITE SYS$OUTPUT "*** Installing engines"
613 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
615 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
617 @ {- output_on() unless scalar @install_engines; "" -} !
619 install_modules : check_INSTALLTOP install_runtime_libs build_modules
620 @ {- output_off() unless scalar @install_modules; "" -} !
621 @ WRITE SYS$OUTPUT "*** Installing modules"
622 - CREATE/DIR ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']
624 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$sover_dirname$target{pointer_size}.'arch']" }
626 @ {- output_on() unless scalar @install_modules; "" -} !
628 install_runtime : install_programs
630 install_runtime_libs : check_INSTALLTOP build_libs
631 @ {- output_off() if $disabled{shared}; "" -} !
632 @ WRITE SYS$OUTPUT "*** Installing shareable images"
633 @ ! Install shared (runtime) libraries
634 - CREATE/DIR ossl_installroot:[LIB.'arch']
636 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
638 @ {- output_on() if $disabled{shared}; "" -} !
640 install_programs : check_INSTALLTOP install_runtime_libs build_programs
641 @ {- output_off() if $disabled{apps}; "" -} !
642 @ ! Install the main program
643 - CREATE/DIR ossl_installroot:[EXE.'arch']
644 COPY/PROT=W:RE [.APPS]openssl.EXE -
645 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
647 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
648 @ ! {- output_on() if $disabled{apps}; "" -}
650 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
651 [.VMS]openssl_utils.com, check_INSTALLTOP
652 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
653 COPY/PROT=W:RE [.VMS]openssl_startup.com -
654 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
655 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
656 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
657 COPY/PROT=W:RE [.VMS]openssl_utils.com -
658 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
660 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
661 - CREATE/DIR ossl_installroot:[SYSTEST]
662 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
663 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
665 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
667 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
668 {- sourcefile("VMS", "openssl_startup.com.in") -} -
669 > [.VMS]openssl_startup.com
671 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
673 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
674 {- sourcefile("VMS", "openssl_utils.com.in") -} -
675 > [.VMS]openssl_utils.com
677 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
679 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
680 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
681 > [.VMS]openssl_shutdown.com
683 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
685 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
686 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
687 > [.VMS]openssl_ivp.com
689 vmsconfig.pm : configdata.pm
690 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
691 WRITE CONFIG "package vmsconfig;"
692 WRITE CONFIG "use strict; use warnings;"
693 WRITE CONFIG "use Exporter;"
694 WRITE CONFIG "our @ISA = qw(Exporter);"
695 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
696 WRITE CONFIG "our %config = ("
697 WRITE CONFIG " target => '","{- $config{target} -}","',"
698 WRITE CONFIG " version => '","{- $config{version} -}","',"
699 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
700 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
701 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
702 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
703 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
704 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
705 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
707 WRITE CONFIG "our %target = ();"
708 WRITE CONFIG "our %disabled = ();"
709 WRITE CONFIG "our %withargs = ();"
710 WRITE CONFIG "our %unified_info = ();"
714 install_html_docs : check_INSTALLTOP build_html_docs
715 @ WRITE SYS$OUTPUT "*** Installing HTML docs"
716 - CREATE/DIR ossl_installroot:[HTML.MAN1]
717 - CREATE/DIR ossl_installroot:[HTML.MAN3]
718 - CREATE/DIR ossl_installroot:[HTML.MAN5]
719 - CREATE/DIR ossl_installroot:[HTML.MAN7]
721 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
722 @{$unified_info{htmldocs}->{man1}} ),
723 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
724 @{$unified_info{htmldocs}->{man3}} ),
725 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
726 @{$unified_info{htmldocs}->{man5}} ),
727 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
728 @{$unified_info{htmldocs}->{man7}} )) -}
731 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
732 WRITE SYS$ERROR "INSTALLTOP should not be empty"
733 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
736 # Helper targets #####################################################
738 copy-utils : [.util]wrap.pl
740 [.util]wrap.pl : configdata.pm
741 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
742 CREATE/DIR/LOG [.util]
743 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
744 COPY/LOG ossl_sourceroot:[util]wrap.pl [.util]
746 # Developer targets ##################################################
749 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
751 # Building targets ###################################################
753 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
754 perl configdata.pm -r
755 @ WRITE SYS$OUTPUT "*************************************************"
756 @ WRITE SYS$OUTPUT "*** ***"
757 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
758 @ WRITE SYS$OUTPUT "*** ***"
759 @ WRITE SYS$OUTPUT "*************************************************"
760 @ PIPE ( EXIT %X10000000 )
763 perl configdata.pm -r
767 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
768 use File::Spec::Unix;
770 # Helper function to figure out dependencies on libraries
771 # It takes a list of library names and outputs a list of dependencies
772 sub compute_lib_depends {
773 # Depending on shared libraries:
774 # On Windows POSIX layers, we depend on {libname}.dll.a
775 # On Unix platforms, we depend on {shlibname}.so
777 { lib => platform->sharedlib($_) // platform->staticlib($_),
778 attrs => $unified_info{attributes}->{libraries}->{$_} }
782 # Helper function to deal with inclusion directory specs.
783 # We're dealing with two issues:
784 # 1. A lot of include directory specs take up a lot of command line real
785 # estate, and the DCL command line is very limited (2KiB).
786 # 2. For optimal usage, include directory paths must be in Unix form,
787 # that's the only way the C compiler can merge multiple include paths
788 # in a sane way (we can stop worrying about 1.h including foo/2.h
791 # To resolve 1, we need to create a file with include directory pragmas,
792 # and let the compiler use it with /FIRST_INCLUDE=.
793 # To resolve 2, we convert all include directory specs we get to Unix,
794 # with available File::Spec functions.
796 # We use CRC-24 from https://tools.ietf.org/html/rfc4880#section-6,
797 # reimplemented in Perl to get a workable and constant file name for each
798 # combination of include directory specs. It is assumed that the order of
799 # these directories don't matter.
801 # This function takes as input a list of include directories
802 # This function returns a list two things:
803 # 1. The file name to use with /FIRST_INCLUDE=
804 # 2. Text to insert into descrip.mms (may be the empty string)
808 my $init_value = 0x00B704CE;
809 my $poly_value = 0x01864CFB;
811 my $crc = $init_value;
813 foreach my $x (unpack ('C*', $input)) {
816 for (my $i; $i < 8; $i++) {
818 if ($crc & 0x01000000) {
827 my %includefile_cache;
828 sub make_includefile {
830 my $udir = make_unix_path(rel2abs($_));
834 my @dirs = sort keys %dirs;
835 my $filename = sprintf 'incdirs_%x.h', crc24(join(',', @dirs));
837 if ($includefile_cache{$filename}) {
838 return ($filename, "");
841 my $scripture = <<"EOF";
843 open/write inc_output $filename
846 $scripture .= <<"EOF";
847 write inc_output "#pragma include_directory ""$_"""
850 $scripture .= <<"EOF";
853 $includefile_cache{$filename} = $scripture;
855 return ($filename, $scripture);
860 my $deps = join(" ", @{$args{deps}});
862 $args{target} : $deps
868 my $gen0 = $args{generator}->[0];
869 my $gen_args = join('', map { " $_" }
870 @{$args{generator}}[1..$#{$args{generator}}]);
871 my $gen_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
872 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
874 if ($args{src} =~ /\.html$/) {
878 my $title = basename($args{src}, ".html");
880 my $mkpod2html = sourcefile('util', 'mkpod2html.pl');
883 \$(PERL) $mkpod2html -i $pod -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
885 } elsif ($args{src} =~ /\.(\d)$/) {
887 # Man-page generator, on VMS we simply ignore man-pages
890 } elsif (platform->isdef($args{src})) {
892 # Linker script-ish generator
894 my $target = platform->def($args{src});
895 my $mkdef = sourcefile('util', 'mkdef.pl');
896 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
898 $args{generator}->[1] || basename($args{product}, '.EXE');
899 my $case_insensitive =
900 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
901 ? '' : ' --case-insensitive';
903 $target : $gen0 $deps $mkdef
904 \$(PERL) $mkdef$ord_ver --ordinals $gen0 --name $ord_name "--OS" "VMS"$case_insensitive > $target
906 } elsif (platform->isasm($args{src})) {
908 # Assembler generator
911 { shlib => "$lib_cflags $lib_cppflags",
912 lib => "$lib_cflags $lib_cppflags",
913 dso => "$dso_cflags $dso_cppflags",
914 bin => "$bin_cflags $bin_cppflags" } -> {$args{intent}};
915 my $defs = join("", map { ",".$_ } @{$args{defs}});
916 my $target = platform->asm($args{src});
919 if ($gen0 =~ /\.pl$/) {
920 $generator = '$(PERL)'.$gen_incs.' '.$gen0.$gen_args
922 } elsif ($gen0 =~ /\.S$/) {
925 die "Generator type for $src unknown: $gen0.$gen_args\n";
928 if (defined($generator)) {
929 # If the target is named foo.S in build.info, we want to
930 # end up generating foo.s in two steps.
931 if ($args{src} =~ /\.S$/) {
933 $target : $gen0 $deps
935 \@ extradefines = "$defs"
936 PIPE \$(CPP) $cppflags \$\@-S | -
937 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
938 \@ DELETE/SYMBOL/LOCAL extradefines
945 $target : $gen0 $deps
946 \@ extradefines = "$defs"
948 \@ DELETE/SYMBOL/LOCAL extradefines
952 $target : $gen0 $deps
953 \@ extradefines = "$defs"
954 PIPE \$(CPP) $cppflags $gen0 | -
955 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
956 \@ DELETE/SYMBOL/LOCAL extradefines
958 } elsif ($gen0 =~ m|^.*\.in$|) {
960 # "dofile" generator (file.in -> file)
962 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
963 "util", "dofile.pl")),
964 rel2abs($config{builddir}));
965 my @modules = ( 'configdata.pm',
966 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
967 my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
968 $deps = join(' ', $deps, @modules);
969 @modules = map { '"-M'.basename($_, '.pm').'"' } @modules;
970 my $modules = join(' ', '', sort keys %moduleincs, @modules);
972 $args{src} : $gen0 $deps
973 \$(PERL)$modules $dofile "-o$target{build_file}" $gen0$gen_args > \$\@
975 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
977 # Generic generator using OpenSSL programs
980 # Redo $deps, because programs aren't expected to have deps of their
981 # own. This is a little more tricky, though, because running programs
982 # may have dependencies on all sorts of files, so we search through
983 # our database of programs and modules to see if our dependencies
985 $deps = join(' ', map { my $x = $_;
986 if (grep { $x eq $_ }
987 @{$unified_info{programs}}) {
989 } elsif (grep { $x eq $_ }
990 @{$unified_info{modules}}) {
996 # Also redo $gen0, to ensure that we have the proper extension
997 $gen0 = platform->bin($gen0);
999 $args{src} : $gen0 $deps
1000 PIPE $gen0$gen_args > \$@
1004 # Generic generator using Perl
1007 $args{src} : $gen0 $deps
1008 \$(PERL)$gen_incs $gen0$gen_args > \$\@
1014 my $asmext = platform->asmext();
1018 (platform->isasm($x) && grep { $x eq $_ } @generated)
1019 ? platform->asm($x) : $x }
1021 my $obj = platform->obj($args{obj});
1022 my $dep = platform->dep($args{obj});
1023 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
1025 # Because VMS C isn't very good at combining a /INCLUDE path with
1026 # #includes having a relative directory (like '#include "../foo.h"),
1027 # the best choice is to move to the first source file's intended
1028 # directory before compiling, and make sure to write the object file
1029 # in the correct position (important when the object tree is other
1030 # than the source tree).
1031 my $forward = dirname($args{srcs}->[0]);
1032 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
1033 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
1034 my $objn = basename($obj);
1035 my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
1036 my $depn = basename($dep);
1038 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
1039 my $before = $unified_info{before}->{$obj} || "\@ !";
1040 my $after = $unified_info{after}->{$obj} || "\@ !";
1043 if ($args{attrs}->{noinst}) {
1044 $cflags .= { shlib => $lib_cflags_no_inst,
1045 lib => $lib_cflags_no_inst,
1046 dso => $dso_cflags_no_inst,
1047 bin => $bin_cflags_no_inst } -> {$args{intent}};
1049 $cflags .= { shlib => $lib_cflags,
1052 bin => $bin_cflags } -> {$args{intent}};
1054 $cflags .= { shlib => $lib_cppflags,
1055 lib => $lib_cppflags,
1056 dso => $dso_cppflags,
1057 bin => $bin_cppflags } -> {$args{intent}};
1058 my $defs = join("", map { ",".$_ } @{$args{defs}});
1059 my $asflags = { shlib => $lib_asflags,
1060 lib => $lib_asflags,
1061 dso => $dso_asflags,
1062 bin => $bin_asflags } -> {$args{intent}};
1064 if ($srcs[0] =~ /\Q${asmext}\E$/) {
1068 SET DEFAULT $forward
1069 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn} $srcs
1070 SET DEFAULT $backward
1074 } elsif ($srcs[0] =~ /.S$/) {
1078 SET DEFAULT $forward
1080 \@ extradefines = "$defs"
1081 PIPE \$(CPP) ${cflags} $srcs | -
1082 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
1083 > ${objd}${objn}-asm
1084 \@ DELETE/SYMBOL/LOCAL extradefines
1086 SET DEFAULT $backward
1088 \$(AS) $asflags \$(ASOUTFLAG)$obj $obj-asm
1093 my ($incdir_filename, $incdir_scripture) =
1094 make_includefile(@{ { shlib => [ @lib_cppincludes ],
1095 lib => [ @lib_cppincludes ],
1096 dso => [ @dso_cppincludes ],
1097 bin => [ @bin_cppincludes ] } -> {$args{intent}} },
1099 $deps .= ", -\n\t\t$incdir_filename";
1101 $target{cflag_incfirst}
1102 . '"'.make_unix_path(rel2abs($incdir_filename)).'"'
1105 my $depbuild = $disabled{makedepend} ? ""
1106 : " /MMS=(FILE=${depd}${depn},TARGET=$obj)";
1111 SET DEFAULT $forward
1113 \@ extradefines = "$defs"
1114 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn} /REPOSITORY=$backward $srcs
1115 \@ DELETE/SYMBOL/LOCAL extradefines
1117 SET DEFAULT $backward
1125 my $shlibname = platform->sharedname($args{lib});
1126 my $shlib = platform->sharedlib($args{lib});
1127 my @objs = map { platform->convertext($_) }
1128 grep { platform->isobj($_) }
1130 my @defs = map { platform->convertext($_) }
1131 grep { platform->isdef($_) }
1133 my @deps = compute_lib_depends(@{$args{deps}});
1134 die "More than one symbol vector" if scalar @defs > 1;
1135 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1136 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1137 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
1138 "VMS", "translatesyms.pl")),
1139 rel2abs($config{builddir}));
1140 # The "[]" hack is because in .OPT files, each line inherits the
1141 # previous line's file spec as default, so if no directory spec
1142 # is present in the current line and the previous line has one that
1143 # doesn't apply, you're in for a surprise.
1145 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1146 "WRITE OPT_FILE \"$x" } @objs).
1149 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1150 ? $_->{lib} : "[]".$_->{lib};
1151 $x =~ s|(\.EXE)|$1/SHARE|;
1152 $x =~ s|(\.OLB)|$1/LIB|;
1153 "WRITE OPT_FILE \"$x\"" } @deps)
1157 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
1158 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
1162 LINK ${lib_ldflags}/SHARE=\$\@ $defs[0]-translated/OPT,-
1163 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1164 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1165 PURGE $shlibname.EXE,$shlibname.MAP
1167 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1168 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1174 my $dsoname = platform->dsoname($args{module});
1175 my $dso = platform->dso($args{module});
1176 my @objs = map { platform->convertext($_) }
1177 grep { platform->isobj($_) }
1179 my @defs = map { platform->convertext($_) }
1180 grep { platform->isdef($_) }
1182 my @deps = compute_lib_depends(@{$args{deps}});
1183 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1184 die "More than one symbol vector" if scalar @defs > 1;
1185 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1186 # The "[]" hack is because in .OPT files, each line inherits the
1187 # previous line's file spec as default, so if no directory spec
1188 # is present in the current line and the previous line has one that
1189 # doesn't apply, you're in for a surprise.
1191 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1192 "WRITE OPT_FILE \"$x" } @objs).
1195 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1196 ? $_->{lib} : "[]".$_->{lib};
1197 $x =~ s|(\.EXE)|$1/SHARE|;
1198 $x =~ s|(\.OLB)|$1/LIB|;
1199 "WRITE OPT_FILE \"$x\"" } @deps)
1203 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1207 LINK ${dso_ldflags}/SHARE=\$\@ $defs[0]/OPT,-
1208 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1209 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1211 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1212 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1218 my $lib = platform->staticlib($args{lib});
1219 my @objs = map { platform->convertext($_) }
1220 grep { platform->isobj($_) }
1222 my $objs = join(", -\n\t\t", @objs);
1223 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1226 LIBRARY/CREATE/OBJECT $lib
1233 my $bin = platform->bin($args{bin});
1234 my $binname = platform->binname($args{bin});
1235 my @objs = map { platform->convertext($_) }
1236 grep { platform->isobj($_) }
1238 my $objs = join(",", @objs);
1239 my @deps = compute_lib_depends(@{$args{deps}});
1240 my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1242 my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1243 my $analyse_objs = "@ !";
1244 if ($olb_count > 0) {
1246 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1247 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1249 # The "[]" hack is because in .OPT files, each line inherits the
1250 # previous line's file spec as default, so if no directory spec
1251 # is present in the current line and the previous line has one that
1252 # doesn't apply, you're in for a surprise.
1254 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1255 "\@ WRITE OPT_FILE \"$x" } @objs).
1258 join("\n\t", "WRITE OPT_FILE \"CASE_SENSITIVE=YES\"",
1259 map { my @lines = ();
1261 my $x = $_->{lib} =~ /\[/
1262 ? $_->{lib} : "[]".$_->{lib};
1263 if ($x =~ m|\.EXE$|) {
1264 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1265 } elsif ($x =~ m|\.OLB$|) {
1266 # Special hack to include the MAIN object
1267 # module explicitly. This will only be done
1268 # if there isn't a 'main' in the program's
1269 # object modules already.
1270 my $main = $_->{attrs}->{has_main}
1271 ? '/INCLUDE=main' : '';
1273 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB$main\"",
1274 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1279 # The linking commands looks a bit complex, but it's for good reason.
1280 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1281 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1282 # the linker will warn about it, loudly, and will then choose to pick
1283 # the first copy encountered (the one in bar.obj in this example).
1284 # On Unix and on Windows, the corresponding maneuver goes through
1285 # silently with the same effect.
1286 # With some test programs, made for checking the internals of OpenSSL,
1287 # we do this kind of linking deliberately, picking a few specific object
1288 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1289 # otherwise unreachable (since the shareable images only exports the
1290 # symbols listed in [.util]*.num), and then with the shared libraries
1291 # themselves. So we need to silence the warning about multiply defined
1292 # symbols, to mimic the way linking work on Unix and Windows, and so
1293 # the build isn't interrupted (MMS stops when warnings are signaled,
1294 # by default), and so someone building doesn't have to worry where it
1295 # isn't necessary. If there are other warnings, however, we show them
1296 # and let it break the build.
1300 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1304 TYPE $binname.OPT ! For debugging
1305 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1306 LINK ${bin_ldflags}/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1307 link_status = \$status ; link_severity = link_status .AND. 7
1308 @ search_severity = 1
1309 -@ IF link_severity .EQ. 0 THEN -
1310 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1311 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1312 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1313 search_severity = \$severity
1314 @ ! search_severity is 3 when the last search didn't find any matching
1315 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1316 @ ! If that was the result, we pretend linking got through without
1317 @ ! fault or warning.
1318 @ IF search_severity .EQ. 3 THEN link_severity = 1
1319 @ ! At this point, if link_severity shows that there was a fault
1320 @ ! or warning, make sure to restore the linking status.
1321 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1322 -@ DELETE $binname.LINKLOG;*
1323 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1324 - PURGE $bin,$binname.OPT
1326 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1327 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1333 my $script = $args{script};
1334 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1335 my $sources = join(" ", @{$args{sources}});
1336 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1337 "util", "dofile.pl")),
1338 rel2abs($config{builddir}));
1341 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1342 "-o$target{build_file}" $sources > $script
1343 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1347 "" # Important! This becomes part of the template result.