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 catfile($sourcedir, @_);
20 catfile($builddir, @_);
23 catdir($sourcedir, @_);
26 catdir($builddir, @_);
29 (my $x = shift) =~ s|\]$|...]|;
33 # Because we need to make two computations of these data,
34 # we store them in arrays for reuse
36 map { platform->staticname($_) }
37 @{$unified_info{libraries}};
39 map { platform->sharedname($_) // () }
40 @{$unified_info{libraries}};
42 map { platform->staticname($_) }
43 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
44 @{$unified_info{libraries}};
46 map { platform->sharedname($_) // () }
47 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
48 @{$unified_info{libraries}};
49 our @install_engines =
50 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
51 && $unified_info{attributes}->{modules}->{$_}->{engine} }
52 @{$unified_info{modules}};
53 our @install_modules =
54 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
55 && !$unified_info{attributes}->{modules}->{$_}->{engine} }
56 @{$unified_info{modules}};
57 our @install_programs =
58 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
59 @{$unified_info{programs}};
60 our @install_bin_scripts =
61 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
62 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
63 @{$unified_info{scripts}};
64 our @install_misc_scripts =
65 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
66 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
67 @{$unified_info{scripts}};
71 our @cnf_asflags = ($target{asflags} || (), @{$config{asflags}});
72 our @cnf_defines = (@{$target{defines}}, @{$config{defines}});
73 our @cnf_includes = (@{$target{includes}}, @{$config{includes}});
74 our @cnf_cppflags = ($target{cppflags} || (), @{$config{cppflags}});
75 our @cnf_cflags = ($target{cflags} || (), @{$config{cflags}});
76 our @cnf_cxxflags = ($target{cxxflags} || (), @{$config{cxxflags}});
77 our @cnf_ldflags = ($target{lflags} || (), @{$config{lflags}});
78 our @cnf_ex_libs = (map{ ",$_" } @{$target{ex_libs}}, @{$config{ex_libs}});
80 # Variables starting with $lib_ are used to build library object files
81 # and shared libraries.
82 # Variables starting with $dso_ are used to build DSOs and their object files.
83 # Variables starting with $bin_ are used to build programs and their object
86 # The following array is special and is treated separately from the rest of
88 our @lib_cppincludes = (@{$target{lib_includes}}, @{$target{shared_includes}},
89 @{$config{lib_includes}}, @{$config{shared_includes}},
93 join(',', @{$target{lib_defines}}, @{$target{shared_defines}},
94 @{$config{lib_defines}}, @{$config{shared_defines}},
96 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
97 'ENGINESDIR="""$(ENGINESDIR_C)"""',
98 'MODULESDIR="""$(MODULESDIR_C)"""',
103 join(' ', $target{lib_asflags} || (), @{$config{lib_asflags}},
104 @cnf_asflags, '$(ASFLAGS)');
106 join('', $target{lib_cppflags} || (), $target{shared_cppflags} || (),
107 @{$config{lib_cppflags}}, @{$config{shared_cppflag}},
108 @cnf_cppflags, '/DEFINE=('.$lib_cppdefines.')', '$(CPPFLAGS)');
109 my @lib_cflags = ( $target{lib_cflags} // () );
110 my @lib_cflags_no_inst = ( $target{no_inst_lib_cflags} // @lib_cflags );
111 my @lib_cflags_cont = ( $target{shared_cflag} || (),
112 @{$config{lib_cflags}}, @{$config{shared_cflag}},
113 $cnf_cflags, '$(CFLAGS)');
114 our $lib_cflags = join('', @lib_cflags, @lib_cflags_cont );
115 our $lib_cflags_no_inst = join('', @lib_cflags_no_inst, @lib_cflags_cont );
117 join('', $target{lib_lflags} || (), $target{shared_ldflag} || (),
118 @{$config{lib_lflags}}, @{$config{shared_ldflag}},
119 @cnf_ldflags, '$(LDFLAGS)');
120 our $lib_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
122 # The following array is special and is treated separately from the rest of
123 # the dso_ variables.
124 our @dso_cppincludes = (@{$target{dso_includes}}, @{$target{module_includes}},
125 @{$config{dso_includes}}, @{$config{module_includes}},
128 our $dso_cppdefines =
129 join(',', @{$target{dso_defines}}, @{$target{module_defines}},
130 @{$config{dso_defines}}, @{$config{module_defines}},
136 join(' ', $target{dso_asflags} || (), $target{module_asflags} || (),
137 @{$config{dso_asflags}}, @{$config{module_asflags}},
138 @cnf_asflags, '$(ASFLAGS)');
140 join('', $target{dso_cppflags} || (), $target{module_cppflags} || (),
141 @{$config{dso_cppflags}}, @{$config{module_cppflag}},
143 '/DEFINE=('.$dso_cppdefines.')',
145 my @dso_cflags = ( $target{dso_cflags} // () );
146 my @dso_cflags_no_inst = ( $target{no_inst_dso_cflags} // @dso_cflags );
147 my @dso_cflags_cont = ( $target{module_cflag} || (),
148 @{$config{dso_cflags}}, @{$config{module_cflag}},
149 $cnf_cflags, '$(CFLAGS)');
150 our $dso_cflags = join('', @dso_cflags, @dso_cflags_cont );
151 our $dso_cflags_no_inst = join('', @dso_cflags_no_inst, @dso_cflags_cont );
153 join('', $target{dso_lflags} || (), $target{module_ldflag} || (),
154 @{$config{dso_lflags}}, @{$config{module_ldflag}},
155 @cnf_ldflags, '$(LDFLAGS)');
156 our $dso_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
158 # The following array is special and is treated separately from the rest of
159 # the bin_ variables.
160 our @bin_cppincludes = (@{$target{bin_includes}},
161 @{$config{bin_includes}},
164 our $bin_cppdefines =
165 join(',', @{$target{bin_defines}},
166 @{$config{bin_defines}},
172 join(' ', $target{bin_asflags} || (),
173 @{$config{bin_asflags}},
174 @cnf_asflags, '$(ASFLAGS)');
176 join('', $target{bin_cppflags} || (),
177 @{$config{bin_cppflags}},
179 '/DEFINE=('.$bin_cppdefines.')',
181 my @bin_cflags = ( $target{bin_cflags} // () );
182 my @bin_cflags_no_inst = ( $target{no_inst_bin_cflags} // @bin_cflags );
183 my @bin_cflags_cont = ( @{$config{bin_cflags}},
184 $cnf_cflags, '$(CFLAGS)');
185 our $bin_cflags = join('', @bin_cflags, @bin_cflags_cont );
186 our $bin_cflags_no_inst = join('', @bin_cflags_no_inst, @bin_cflags_cont );
188 join('', $target{bin_cflags} || (),
189 @{$config{bin_cflags}},
190 @cnf_cflags, '$(CFLAGS)');
192 join('', $target{bin_lflags} || (),
193 @{$config{bin_lflags}},
194 @cnf_ldflags, '$(LDFLAGS)');
195 our $bin_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
197 # This is a horrible hack, but is needed because recursive inclusion of files
198 # in different directories does not work well with HP C.
199 my $sd = sourcedir("crypto", "async", "arch");
200 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
201 my $obj = platform->obj($_);
202 $unified_info{before}->{$obj}
203 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
204 define arch 'arch_include');
205 $unified_info{after}->{$obj}
208 my $sd1 = sourcedir("ssl","record");
209 my $sd2 = sourcedir("ssl","statem");
210 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
211 keys %{$unified_info{sources}});
212 foreach (@ssl_locl_users) {
213 my $obj = platform->obj($_);
214 $unified_info{before}->{$obj}
215 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
216 define record 'record_include'
217 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
218 define statem 'statem_include');
219 $unified_info{after}->{$obj}
224 # This makes sure things get built in the order they need
225 # to. You're welcome.
229 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
233 PLATFORM={- $config{target} -}
234 OPTIONS={- $config{options} -}
235 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
236 SRCDIR={- $config{sourcedir} -}
237 BLDDIR={- $config{builddir} -}
238 FIPSKEY={- $config{FIPSKEY} -}
240 # Allow both V and VERBOSE to indicate verbosity. This only applies
243 VERBOSE_FAILURE=$(VF)
245 VERSION={- "$config{full_version}" -}
246 MAJOR={- $config{major} -}
247 MINOR={- $config{minor} -}
248 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
249 SHLIB_TARGET={- $target{shared_target} -}
251 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
252 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
253 FIPSMODULENAME={- # We do some extra checking here, as there should be only one
256 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
257 && $unified_info{attributes}->{modules}->{$_}->{fips} }
258 @{$unified_info{modules}};
259 die "More that one FIPS module" if scalar @fipsmodules > 1;
260 join(", ", map { basename(platform->dso($_)) } @fipsmodules) -}
261 MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{modules}}) -}
262 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
263 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
264 {- output_off() if $disabled{makedepend}; "" -}
265 DEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ }
266 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
267 keys %{$unified_info{sources}};
268 join(", ", map { "-\n\t".$_ } @deps); -}
269 {- output_on() if $disabled{makedepend}; "" -}
270 GENERATED_MANDATORY={- join(", ",
271 map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
272 GENERATED_PODS={- # common0.tmpl provides @generated
277 $unified_info{attributes}->{depends}
278 ->{$x}->{$_}->{pod} // 0
280 keys %{$unified_info{attributes}->{depends}->{$x}}
284 GENERATED={- # common0.tmpl provides @generated
285 join(", ", map { platform->convertext($_) } @generated) -}
287 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
288 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
289 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
290 INSTALL_MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @install_modules) -}
291 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
292 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
293 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
294 HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
295 HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
296 HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
297 HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
299 APPS_OPENSSL="{- use File::Spec::Functions;
300 catfile("apps","openssl") -}"
302 # DESTDIR is for package builders so that they can configure for, say,
303 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
304 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
305 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
306 # STAGING:[USER.OPENSSL].
307 # Normally it is left empty.
310 # Do not edit this manually. Use Configure --prefix=DIR to change this!
311 INSTALLTOP={- our $installtop =
312 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
314 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
315 # This is the standard central area to store certificates, private keys...
316 OPENSSLDIR={- catdir($config{openssldir}) or
317 $config{prefix} ? catdir($config{prefix},"COMMON")
318 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
319 # The same, but for C
320 OPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000]
321 # Where installed ENGINE modules reside, for C
322 ENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
323 # Where modules reside, for C
324 MODULESDIR_C={- platform->osslprefix() -}MODULES{- $sover_dirname.$target{pointer_size} -}:
326 ##### User defined commands and flags ################################
329 CPP={- $config{CPP} -}
330 DEFINES={- our $defines = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
331 INCLUDES={- our $includes = join(',', @{$config{CPPINCLUDES}}) -}
332 CPPFLAGS={- our $cppflags = join('', @{$config{CPPFLAGS}}) -}
333 CFLAGS={- join('', @{$config{CFLAGS}}) -}
334 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
335 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
337 PERL={- $config{PERL} -}
340 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
342 ##### Special command flags ##########################################
344 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
346 PERLASM_SCHEME={- $target{perlasm_scheme} -}
348 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
349 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags) =~ s|"|""|g;
350 (my $d = $lib_cppdefines) =~ s|"|""|g;
351 my $i = join(',', @lib_cppincludes || (), '$(INCLUDES)');
353 $x .= "/INCLUDE=($i)" if $i;
354 $x .= "/DEFINE=($d)" if $d;
357 # .FIRST and .LAST are special targets with MMS and MMK.
358 # The defines in there are for C. includes that look like
361 # #include <openssl/foo.h>
362 # #include "internal/bar.h"
364 # will use the logical names to find the files. Expecting
365 # DECompHP C to find files in subdirectories of whatever was
366 # given with /INCLUDE is a fantasy, unfortunately.
369 $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
370 $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop'
372 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
373 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
374 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
375 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
376 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
377 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
378 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
379 $(NODEBUG) staging_dir = "$(DESTDIR)"
380 $(NODEBUG) staging_instdir = ""
381 $(NODEBUG) staging_datadir = ""
382 $(NODEBUG) IF staging_dir .NES. "" THEN -
383 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
384 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
385 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
386 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
387 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
388 $(NODEBUG) IF staging_dir .NES. "" THEN -
389 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
390 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
391 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
392 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
393 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
395 $(NODEBUG) ! Installation logical names
397 $(NODEBUG) ! This also creates a few DCL variables that are used for
398 $(NODEBUG) ! the "install_msg" target.
400 $(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
401 $(NODEBUG) installtop = installroot + ".]"
402 $(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
403 $(NODEBUG) datatop = dataroot + ".]"
404 $(NODEBUG) DEFINE ossl_installroot 'installtop'
405 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
407 $(NODEBUG) ! Figure out the architecture
409 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
411 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
412 $(NODEBUG) ! running programs can use them.
414 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
417 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
418 $(NODEBUG) DEASSIGN ossl_dataroot
419 $(NODEBUG) DEASSIGN ossl_installroot
420 $(NODEBUG) DEASSIGN internal
421 $(NODEBUG) DEASSIGN openssl
423 @ ! MMS cannot handle no actions...
425 # The main targets ###################################################
427 {- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep copy-utils
428 {- dependmagic('build_libs'); -} : build_libs_nodep
429 {- dependmagic('build_modules'); -} : build_modules_nodep
430 {- dependmagic('build_programs'); -} : build_programs_nodep
432 build_generated_pods : $(GENERATED_PODS)
433 build_docs : build_html_docs
434 build_html_docs : $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
436 build_generated : $(GENERATED_MANDATORY)
437 build_libs_nodep : $(LIBS), $(SHLIBS)
438 build_modules_nodep : $(MODULES)
439 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
441 # Kept around for backward compatibility
442 build_apps build_tests : build_programs
444 # Convenience target to prebuild all generated files, not just the mandatory
446 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
447 @ ! {- output_off() if $disabled{makedepend}; "" -}
448 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
449 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
450 @ WRITE SYS$OUTPUT " then make will fail..."
451 @ ! {- output_on() if $disabled{makedepend}; "" -}
453 all : build_sw build_docs
456 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep copy-utils run_tests
458 @ ! {- output_off() if $disabled{tests}; "" -}
459 DEFINE SRCTOP "$(SRCDIR)"
460 DEFINE BLDTOP "$(BLDDIR)"
461 DEFINE FIPSKEY "$(FIPSKEY)"
462 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
463 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
467 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
468 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
469 @ ! {- output_on() if !$disabled{tests}; "" -}
472 @ ! {- output_off() if $disabled{tests}; "" -}
473 @ DEFINE SRCTOP "$(SRCDIR)"
474 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
476 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
477 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
478 @ ! {- output_on() if !$disabled{tests}; "" -}
480 install : install_sw install_ssldirs install_docs install_msg
483 @ WRITE SYS$OUTPUT ""
484 @ WRITE SYS$OUTPUT "######################################################################"
485 @ WRITE SYS$OUTPUT ""
486 @ IF "$(DESTDIR)" .EQS. "" THEN -
487 @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}"
488 @ IF "$(DESTDIR)" .NES. "" THEN -
489 @{- sourcefile("VMS", "msg_staging.com") -} -
490 "''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" -
491 "$(SYSTARTUP)" "{- $osslver -}"
494 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
496 uninstall : uninstall_docs uninstall_sw
498 # Because VMS wants the generation number (or *) to delete files, we can't
499 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
501 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
502 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
505 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
506 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
507 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
508 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
509 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
510 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
511 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
512 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
513 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
514 - DELETE [...]*.MAP;*
516 - DELETE [...]*.OBJ;*,*.LIS;*
517 - DELETE []CXX$DEMANGLER_DB.;*
518 - DELETE [.VMS]openssl_startup.com;*
519 - DELETE [.VMS]openssl_shutdown.com;*
520 - DELETE []vmsconfig.pm;*
523 - DELETE configdata.pm;*
524 - DELETE descrip.mms;*
528 @ ! {- output_off() if $disabled{makedepend}; "" -}
529 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "{- $config{makedep_scheme} -}"
530 @ ! {- output_on() if $disabled{makedepend}; "" -}
532 # Install helper targets #############################################
534 install_sw : install_dev install_engines install_modules -
535 install_runtime install_startup install_ivp
537 uninstall_sw : uninstall_dev uninstall_modules uninstall_engines -
538 uninstall_runtime uninstall_startup uninstall_ivp
540 install_docs : install_html_docs
542 uninstall_docs : uninstall_html_docs
544 install_fips : install_sw
545 @ WRITE SYS$OUTPUT "*** Installing FIPS module configuration"
546 @ WRITE SYS$OUTPUT "fipsinstall $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
547 openssl fipsinstall -
548 -module ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME) -
549 -out ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf -
550 -macopt "hexkey:$(FIPSKEY)"
552 uninstall_fips : uninstall_sw
553 @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module configuration"
554 DELETE ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf;*
556 install_ssldirs : check_INSTALLTOP
557 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
558 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
559 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
560 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
561 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
562 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
563 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
564 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
565 @ ! Install configuration file
566 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
567 ossl_dataroot:[000000]openssl.cnf-dist
568 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
569 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
570 ossl_dataroot:[000000]openssl.cnf
571 @ ! Install CTLOG configuration file
572 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
573 ossl_dataroot:[000000]ct_log_list.cnf-dist
574 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
575 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
576 ossl_dataroot:[000000]ct_log_list.cnf
578 install_dev : check_INSTALLTOP install_runtime_libs
579 @ WRITE SYS$OUTPUT "*** Installing development files"
580 @ ! Install header files
581 - CREATE/DIR ossl_installroot:[include.openssl]
582 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
583 @ ! Install static (development) libraries
584 - CREATE/DIR ossl_installroot:[LIB.'arch']
586 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
589 install_engines : check_INSTALLTOP install_runtime_libs build_modules
590 @ {- output_off() unless scalar @install_engines; "" -} !
591 @ WRITE SYS$OUTPUT "*** Installing engines"
592 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
594 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
596 @ {- output_on() unless scalar @install_engines; "" -} !
598 install_modules : check_INSTALLTOP install_runtime_libs build_modules
599 @ {- output_off() unless scalar @install_modules; "" -} !
600 @ WRITE SYS$OUTPUT "*** Installing modules"
601 - CREATE/DIR ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']
603 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$sover_dirname$target{pointer_size}.'arch']" }
605 @ {- output_on() unless scalar @install_modules; "" -} !
607 install_runtime : install_programs
609 install_runtime_libs : check_INSTALLTOP build_libs
610 @ {- output_off() if $disabled{shared}; "" -} !
611 @ WRITE SYS$OUTPUT "*** Installing shareable images"
612 @ ! Install shared (runtime) libraries
613 - CREATE/DIR ossl_installroot:[LIB.'arch']
615 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
617 @ {- output_on() if $disabled{shared}; "" -} !
619 install_programs : check_INSTALLTOP install_runtime_libs build_programs
620 @ {- output_off() if $disabled{apps}; "" -} !
621 @ ! Install the main program
622 - CREATE/DIR ossl_installroot:[EXE.'arch']
623 COPY/PROT=W:RE [.APPS]openssl.EXE -
624 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
626 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
627 @ ! {- output_on() if $disabled{apps}; "" -}
629 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
630 [.VMS]openssl_utils.com, check_INSTALLTOP
631 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
632 COPY/PROT=W:RE [.VMS]openssl_startup.com -
633 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
634 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
635 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
636 COPY/PROT=W:RE [.VMS]openssl_utils.com -
637 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
639 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
640 - CREATE/DIR ossl_installroot:[SYSTEST]
641 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
642 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
644 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
646 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
647 {- sourcefile("VMS", "openssl_startup.com.in") -} -
648 > [.VMS]openssl_startup.com
650 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
652 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
653 {- sourcefile("VMS", "openssl_utils.com.in") -} -
654 > [.VMS]openssl_utils.com
656 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
658 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
659 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
660 > [.VMS]openssl_shutdown.com
662 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
664 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
665 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
666 > [.VMS]openssl_ivp.com
668 vmsconfig.pm : configdata.pm
669 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
670 WRITE CONFIG "package vmsconfig;"
671 WRITE CONFIG "use strict; use warnings;"
672 WRITE CONFIG "use Exporter;"
673 WRITE CONFIG "our @ISA = qw(Exporter);"
674 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
675 WRITE CONFIG "our %config = ("
676 WRITE CONFIG " target => '","{- $config{target} -}","',"
677 WRITE CONFIG " version => '","{- $config{version} -}","',"
678 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
679 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
680 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
681 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
682 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
683 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
684 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
686 WRITE CONFIG "our %target = ();"
687 WRITE CONFIG "our %disabled = ();"
688 WRITE CONFIG "our %withargs = ();"
689 WRITE CONFIG "our %unified_info = ();"
693 install_html_docs : check_INSTALLTOP build_html_docs
694 @ WRITE SYS$OUTPUT "*** Installing HTML docs"
695 - CREATE/DIR ossl_installroot:[HTML.MAN1]
696 - CREATE/DIR ossl_installroot:[HTML.MAN3]
697 - CREATE/DIR ossl_installroot:[HTML.MAN5]
698 - CREATE/DIR ossl_installroot:[HTML.MAN7]
700 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
701 @{$unified_info{htmldocs}->{man1}} ),
702 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
703 @{$unified_info{htmldocs}->{man3}} ),
704 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
705 @{$unified_info{htmldocs}->{man5}} ),
706 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
707 @{$unified_info{htmldocs}->{man7}} )) -}
710 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
711 WRITE SYS$ERROR "INSTALLTOP should not be empty"
712 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
715 # Helper targets #####################################################
717 copy-utils : [.util]wrap.pl
719 [.util]wrap.pl : configdata.pm
720 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
721 CREATE/DIR/LOG [.util]
722 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
723 COPY/LOG ossl_sourceroot:[util]wrap.pl [.util]
725 # Developer targets ##################################################
728 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
730 # Building targets ###################################################
732 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
733 perl configdata.pm -r
734 @ WRITE SYS$OUTPUT "*************************************************"
735 @ WRITE SYS$OUTPUT "*** ***"
736 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
737 @ WRITE SYS$OUTPUT "*** ***"
738 @ WRITE SYS$OUTPUT "*************************************************"
739 @ PIPE ( EXIT %X10000000 )
742 perl configdata.pm -r
746 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
748 # Helper function to figure out dependencies on libraries
749 # It takes a list of library names and outputs a list of dependencies
750 sub compute_lib_depends {
751 # Depending on shared libraries:
752 # On Windows POSIX layers, we depend on {libname}.dll.a
753 # On Unix platforms, we depend on {shlibname}.so
755 { lib => platform->sharedlib($_) // platform->staticlib($_),
756 attrs => $unified_info{attributes}->{libraries}->{$_} }
760 # Helper function to deal with inclusion directory specs.
761 # We have to deal with two things:
762 # 1. comma separation and no possibility of trailing comma
763 # 2. no inclusion directories given at all
764 # 3. long compiler command lines
765 # To resolve 1, we need to iterate through the sources of inclusion
766 # directories, and only add a comma when needed.
767 # To resolve 2, we need to have a variable that will hold the whole
768 # inclusion qualifier, or be the empty string if there are no inclusion
769 # directories. That's the symbol 'qual_includes' that's used in CPPFLAGS
770 # To resolve 3, we create a logical name TMP_INCLUDES: to hold the list
771 # of inclusion directories.
773 # This function returns a list of two lists, one being the collection of
774 # commands to execute before the compiler is called, and the other being
775 # the collection of commands to execute after. It takes as arguments the
776 # collection of strings to include as directory specs.
783 'DELETE/SYMBOL/LOCAL qual_includes',
786 if (scalar @stuff > 0) {
787 push @before, 'tmp_includes := '.shift(@stuff);
789 push @before, 'tmp_add := '.shift(@stuff);
790 push @before, 'IF tmp_includes .NES. "" .AND. tmp_add .NES. "" THEN tmp_includes = tmp_includes + ","';
791 push @before, 'tmp_includes = tmp_includes + tmp_add';
793 push @before, "IF tmp_includes .NES. \"\" THEN DEFINE tmp_includes 'tmp_includes'";
794 push @before, 'IF tmp_includes .NES. "" THEN qual_includes := /INCLUDE=(tmp_includes:)';
795 push @before, 'DELETE/SYMBOL/LOCAL tmp_includes';
796 push @before, 'DELETE/SYMBOL/LOCAL tmp_add';
797 push @after, 'DEASSIGN tmp_includes:'
799 return ([ @before ], [ @after ]);
804 my $deps = join(" ", @{$args{deps}});
806 $args{target} : $deps
812 my $gen0 = $args{generator}->[0];
813 my $gen_args = join('', map { " $_" }
814 @{$args{generator}}[1..$#{$args{generator}}]);
815 my $gen_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
816 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
818 if ($args{src} =~ /\.html$/) {
822 my $title = basename($args{src}, ".html");
824 my $mkpod2html = sourcefile('util', 'mkpod2html.pl');
827 \$(PERL) $mkpod2html -i $pod -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
829 } elsif ($args{src} =~ /\.(\d)$/) {
831 # Man-page generator, on VMS we simply ignore man-pages
834 } elsif (platform->isdef($args{src})) {
836 # Linker script-ish generator
838 my $target = platform->def($args{src});
839 my $mkdef = sourcefile('util', 'mkdef.pl');
840 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
842 $args{generator}->[1] || basename($args{product}, '.EXE');
843 my $case_insensitive =
844 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
845 ? '' : ' --case-insensitive';
847 $target : $gen0 $deps $mkdef
848 \$(PERL) $mkdef$ord_ver --ordinals $gen0 --name $ord_name "--OS" "VMS"$case_insensitive > $target
850 } elsif (platform->isasm($args{src})) {
852 # Assembler generator
855 { shlib => "$lib_cflags $lib_cppflags",
856 lib => "$lib_cflags $lib_cppflags",
857 dso => "$dso_cflags $dso_cppflags",
858 bin => "$bin_cflags $bin_cppflags" } -> {$args{intent}};
859 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
860 lib => '$(LIB_INCLUDES)',
861 dso => '$(DSO_INCLUDES)',
862 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
866 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
867 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
868 my $defs = join("", map { ",".$_ } @{$args{defs}});
869 my $target = platform->asm($args{src});
872 if ($gen0 =~ /\.pl$/) {
873 $generator = '$(PERL)'.$gen_incs.' '.$gen0.$gen_args
875 } elsif ($gen0 =~ /\.S$/) {
878 die "Generator type for $src unknown: $gen0.$gen_args\n";
881 if (defined($generator)) {
882 # If the target is named foo.S in build.info, we want to
883 # end up generating foo.s in two steps.
884 if ($args{src} =~ /\.S$/) {
886 $target : $gen0 $deps
889 \@ extradefines = "$defs"
890 PIPE \$(CPP) $cppflags \$\@-S | -
891 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
892 \@ DELETE/SYMBOL/LOCAL extradefines
900 $target : $gen0 $deps
902 \@ extradefines = "$defs"
904 \@ DELETE/SYMBOL/LOCAL extradefines
909 $target : $gen0 $deps
911 \@ extradefines = "$defs"
912 SHOW SYMBOL qual_includes
913 PIPE \$(CPP) $cppflags $gen0 | -
914 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
915 \@ DELETE/SYMBOL/LOCAL extradefines
918 } elsif ($gen0 =~ m|^.*\.in$|) {
920 # "dofile" generator (file.in -> file)
922 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
923 "util", "dofile.pl")),
924 rel2abs($config{builddir}));
925 my @modules = ( 'configdata.pm',
926 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
927 my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
928 $deps = join(' ', $deps, @modules);
929 @modules = map { '"-M'.basename($_, '.pm').'"' } @modules;
930 my $modules = join(' ', '', sort keys %moduleincs, @modules);
932 $args{src} : $gen0 $deps
933 \$(PERL)$modules $dofile "-o$target{build_file}" $gen0$gen_args > \$\@
935 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
937 # Generic generator using OpenSSL programs
940 # Redo $deps, because programs aren't expected to have deps of their
941 # own. This is a little more tricky, though, because running programs
942 # may have dependencies on all sorts of files, so we search through
943 # our database of programs and modules to see if our dependencies
945 $deps = join(' ', map { my $x = $_;
946 if (grep { $x eq $_ }
947 @{$unified_info{programs}}) {
949 } elsif (grep { $x eq $_ }
950 @{$unified_info{modules}}) {
956 # Also redo $gen0, to ensure that we have the proper extension
957 $gen0 = platform->bin($gen0);
959 $args{src} : $gen0 $deps
960 PIPE $gen0$gen_args > \$@
964 # Generic generator using Perl
967 $args{src} : $gen0 $deps
968 \$(PERL)$gen_incs $gen0$gen_args > \$\@
974 my $asmext = platform->asmext();
978 (platform->isasm($x) && grep { $x eq $_ } @generated)
979 ? platform->asm($x) : $x }
981 my $obj = platform->obj($args{obj});
982 my $dep = platform->dep($args{obj});
983 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
985 # Because VMS C isn't very good at combining a /INCLUDE path with
986 # #includes having a relative directory (like '#include "../foo.h"),
987 # the best choice is to move to the first source file's intended
988 # directory before compiling, and make sure to write the object file
989 # in the correct position (important when the object tree is other
990 # than the source tree).
991 my $forward = dirname($args{srcs}->[0]);
992 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
993 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
994 my $objn = basename($obj);
995 my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
996 my $depn = basename($dep);
998 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
999 my $before = $unified_info{before}->{$obj} || "\@ !";
1000 my $after = $unified_info{after}->{$obj} || "\@ !";
1003 if ($args{attrs}->{noinst}) {
1004 $cflags .= { shlib => $lib_cflags_no_inst,
1005 lib => $lib_cflags_no_inst,
1006 dso => $dso_cflags_no_inst,
1007 bin => $bin_cflags_no_inst } -> {$args{intent}};
1009 $cflags .= { shlib => $lib_cflags,
1012 bin => $bin_cflags } -> {$args{intent}};
1014 $cflags .= { shlib => $lib_cppflags,
1015 lib => $lib_cppflags,
1016 dso => $dso_cppflags,
1017 bin => $bin_cppflags } -> {$args{intent}};
1018 my $defs = join("", map { ",".$_ } @{$args{defs}});
1019 my $asflags = { shlib => $lib_asflags,
1020 lib => $lib_asflags,
1021 dso => $dso_asflags,
1022 bin => $bin_asflags } -> {$args{intent}};
1024 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
1025 lib => '$(LIB_INCLUDES)',
1026 dso => '$(DSO_INCLUDES)',
1027 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
1030 file_name_is_absolute($_)
1031 ? $_ : catdir($backward,$_)
1033 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
1034 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
1036 if ($srcs[0] =~ /\Q${asmext}\E$/) {
1040 SET DEFAULT $forward
1041 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn} $srcs
1042 SET DEFAULT $backward
1046 } elsif ($srcs[0] =~ /.S$/) {
1050 SET DEFAULT $forward
1052 \@ extradefines = "$defs"
1053 PIPE \$(CPP) ${cflags} $srcs | -
1054 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
1055 > ${objd}${objn}-asm
1056 \@ DELETE/SYMBOL/LOCAL extradefines
1058 SET DEFAULT $backward
1060 \$(AS) $asflags \$(ASOUTFLAG)$obj $obj-asm
1065 my $depbuild = $disabled{makedepend} ? ""
1066 : " /MMS=(FILE=${depd}${depn},TARGET=$obj)";
1071 SET DEFAULT $forward
1073 \@ extradefines = "$defs"
1074 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn} /REPOSITORY=$backward $srcs
1075 \@ DELETE/SYMBOL/LOCAL extradefines
1077 SET DEFAULT $backward
1084 my $shlibname = platform->sharedname($args{lib});
1085 my $shlib = platform->sharedlib($args{lib});
1086 my @objs = map { platform->convertext($_) }
1087 grep { platform->isobj($_) }
1089 my @defs = map { platform->convertext($_) }
1090 grep { platform->isdef($_) }
1092 my @deps = compute_lib_depends(@{$args{deps}});
1093 die "More than one symbol vector" if scalar @defs > 1;
1094 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1095 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1096 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
1097 "VMS", "translatesyms.pl")),
1098 rel2abs($config{builddir}));
1099 # The "[]" hack is because in .OPT files, each line inherits the
1100 # previous line's file spec as default, so if no directory spec
1101 # is present in the current line and the previous line has one that
1102 # doesn't apply, you're in for a surprise.
1104 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1105 "WRITE OPT_FILE \"$x" } @objs).
1108 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1109 ? $_->{lib} : "[]".$_->{lib};
1110 $x =~ s|(\.EXE)|$1/SHARE|;
1111 $x =~ s|(\.OLB)|$1/LIB|;
1112 "WRITE OPT_FILE \"$x\"" } @deps)
1116 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
1117 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
1121 LINK ${lib_ldflags}/SHARE=\$\@ $defs[0]-translated/OPT,-
1122 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1123 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1124 PURGE $shlibname.EXE,$shlibname.MAP
1126 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1127 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1133 my $dsoname = platform->dsoname($args{module});
1134 my $dso = platform->dso($args{module});
1135 my @objs = map { platform->convertext($_) }
1136 grep { platform->isobj($_) }
1138 my @defs = map { platform->convertext($_) }
1139 grep { platform->isdef($_) }
1141 my @deps = compute_lib_depends(@{$args{deps}});
1142 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1143 die "More than one symbol vector" if scalar @defs > 1;
1144 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1145 # The "[]" hack is because in .OPT files, each line inherits the
1146 # previous line's file spec as default, so if no directory spec
1147 # is present in the current line and the previous line has one that
1148 # doesn't apply, you're in for a surprise.
1150 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1151 "WRITE OPT_FILE \"$x" } @objs).
1154 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1155 ? $_->{lib} : "[]".$_->{lib};
1156 $x =~ s|(\.EXE)|$1/SHARE|;
1157 $x =~ s|(\.OLB)|$1/LIB|;
1158 "WRITE OPT_FILE \"$x\"" } @deps)
1162 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1166 LINK ${dso_ldflags}/SHARE=\$\@ $defs[0]/OPT,-
1167 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1168 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1170 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1171 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1177 my $lib = platform->staticlib($args{lib});
1178 my @objs = map { platform->convertext($_) }
1179 grep { platform->isobj($_) }
1181 my $objs = join(", -\n\t\t", @objs);
1182 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1185 LIBRARY/CREATE/OBJECT $lib
1192 my $bin = platform->bin($args{bin});
1193 my $binname = platform->binname($args{bin});
1194 my @objs = map { platform->convertext($_) }
1195 grep { platform->isobj($_) }
1197 my $objs = join(",", @objs);
1198 my @deps = compute_lib_depends(@{$args{deps}});
1199 my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1201 my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1202 my $analyse_objs = "@ !";
1203 if ($olb_count > 0) {
1205 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1206 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1208 # The "[]" hack is because in .OPT files, each line inherits the
1209 # previous line's file spec as default, so if no directory spec
1210 # is present in the current line and the previous line has one that
1211 # doesn't apply, you're in for a surprise.
1213 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1214 "\@ WRITE OPT_FILE \"$x" } @objs).
1217 join("\n\t", "WRITE OPT_FILE \"CASE_SENSITIVE=YES\"",
1218 map { my @lines = ();
1220 my $x = $_->{lib} =~ /\[/
1221 ? $_->{lib} : "[]".$_->{lib};
1222 if ($x =~ m|\.EXE$|) {
1223 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1224 } elsif ($x =~ m|\.OLB$|) {
1225 # Special hack to include the MAIN object
1226 # module explicitly. This will only be done
1227 # if there isn't a 'main' in the program's
1228 # object modules already.
1229 my $main = $_->{attrs}->{has_main}
1230 ? '/INCLUDE=main' : '';
1232 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB$main\"",
1233 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1238 # The linking commands looks a bit complex, but it's for good reason.
1239 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1240 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1241 # the linker will warn about it, loudly, and will then choose to pick
1242 # the first copy encountered (the one in bar.obj in this example).
1243 # On Unix and on Windows, the corresponding maneuver goes through
1244 # silently with the same effect.
1245 # With some test programs, made for checking the internals of OpenSSL,
1246 # we do this kind of linking deliberately, picking a few specific object
1247 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1248 # otherwise unreachable (since the shareable images only exports the
1249 # symbols listed in [.util]*.num), and then with the shared libraries
1250 # themselves. So we need to silence the warning about multiply defined
1251 # symbols, to mimic the way linking work on Unix and Windows, and so
1252 # the build isn't interrupted (MMS stops when warnings are signaled,
1253 # by default), and so someone building doesn't have to worry where it
1254 # isn't necessary. If there are other warnings, however, we show them
1255 # and let it break the build.
1259 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1263 TYPE $binname.OPT ! For debugging
1264 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1265 LINK ${bin_ldflags}/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1266 link_status = \$status ; link_severity = link_status .AND. 7
1267 @ search_severity = 1
1268 -@ IF link_severity .EQ. 0 THEN -
1269 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1270 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1271 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1272 search_severity = \$severity
1273 @ ! search_severity is 3 when the last search didn't find any matching
1274 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1275 @ ! If that was the result, we pretend linking got through without
1276 @ ! fault or warning.
1277 @ IF search_severity .EQ. 3 THEN link_severity = 1
1278 @ ! At this point, if link_severity shows that there was a fault
1279 @ ! or warning, make sure to restore the linking status.
1280 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1281 -@ DELETE $binname.LINKLOG;*
1282 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1283 - PURGE $bin,$binname.OPT
1285 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1286 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1292 my $script = $args{script};
1293 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1294 my $sources = join(" ", @{$args{sources}});
1295 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1296 "util", "dofile.pl")),
1297 rel2abs($config{builddir}));
1300 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1301 "-o$target{build_file}" $sources > $script
1302 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1306 "" # Important! This becomes part of the template result.