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 VMS C. We try to help by
209 # specifying extra relative directories. They must always be in Unix format,
210 # relative to the directory where the .c file is located. The logic is that
211 # any inclusion, merged with one of these relative directories, will find the
212 # requested inclusion file.
213 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
214 my $obj = platform->obj($_);
215 push @{$unified_info{includes_extra}->{$obj}}, qw(../);
217 foreach (grep /\[\.crypto\.ec\.curve448\].*?\.o$/, keys %{$unified_info{sources}}) {
218 my $obj = platform->obj($_);
219 push @{$unified_info{includes_extra}->{$obj}}, qw(./arch_32 ./arch64);
221 foreach (grep /\[\.crypto\.ec\.curve448.arch_(?:32|64)\].*?\.o$/, keys %{$unified_info{sources}}) {
222 my $obj = platform->obj($_);
223 push @{$unified_info{includes_extra}->{$obj}}, qw(../);
225 foreach (grep /\[\.ssl\.(?:record|statem)\].*?\.o$/, keys %{$unified_info{sources}}) {
226 my $obj = platform->obj($_);
227 # Most of the files in [.ssl.record] and [.ssl.statem] include
228 # "../ssl_local.h", which includes things like "record/record.h".
229 # Adding "../" as an inclusion directory helps making this sort of header
230 # from these directories.
231 push @{$unified_info{includes_extra}->{$obj}}, qw(../);
234 foreach (grep /\[\.test\].*?\.o$/, keys %{$unified_info{sources}}) {
235 my $obj = platform->obj($_);
236 push @{$unified_info{includes_extra}->{$obj}}, qw(../ssl ./helpers);
238 foreach (grep /\[\.test\.helpers\].*?\.o$/, keys %{$unified_info{sources}}) {
239 my $obj = platform->obj($_);
240 push @{$unified_info{includes_extra}->{$obj}}, qw(../../ssl);
243 # This makes sure things get built in the order they need
244 # to. You're welcome.
248 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
252 PLATFORM={- $config{target} -}
253 OPTIONS={- $config{options} -}
254 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
255 SRCDIR={- $config{sourcedir} -}
256 BLDDIR={- $config{builddir} -}
257 FIPSKEY={- $config{FIPSKEY} -}
259 # Allow both V and VERBOSE to indicate verbosity. This only applies
262 VERBOSE_FAILURE=$(VF)
264 VERSION={- "$config{full_version}" -}
265 MAJOR={- $config{major} -}
266 MINOR={- $config{minor} -}
267 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
268 SHLIB_TARGET={- $target{shared_target} -}
270 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
271 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
272 MODULES={- join(", ", map { "-\n\t".$_.".EXE" }
273 # Drop all modules that are dependencies, they will
274 # be processed through their dependents
276 !grep { grep { $_ eq $x } @$_ }
277 values %{$unified_info{depends}} }
278 @{$unified_info{modules}}) -}
279 FIPSMODULE={- # We do some extra checking here, as there should be only one
282 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
283 && $unified_info{attributes}->{modules}->{$_}->{fips} }
284 @{$unified_info{modules}};
285 die "More that one FIPS module" if scalar @fipsmodules > 1;
286 join(" ", map { platform->dso($_) } @fipsmodules) -}
287 FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1;
288 join(", ", map { basename(platform->dso($_)) } @fipsmodules) -}
289 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
290 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
291 {- output_off() if $disabled{makedepend}; "" -}
292 DEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ }
293 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
294 keys %{$unified_info{sources}};
295 join(", ", map { "-\n\t".$_ } @deps); -}
296 {- output_on() if $disabled{makedepend}; "" -}
297 GENERATED_MANDATORY={- join(", ",
298 map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
299 GENERATED_PODS={- # common0.tmpl provides @generated
304 $unified_info{attributes}->{depends}
305 ->{$x}->{$_}->{pod} // 0
307 keys %{$unified_info{attributes}->{depends}->{$x}}
311 GENERATED={- # common0.tmpl provides @generated
312 join(", ", map { platform->convertext($_) } @generated) -}
314 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
315 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
316 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
317 INSTALL_MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @install_modules) -}
318 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
319 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
320 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
321 HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
322 HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
323 HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
324 HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
326 APPS_OPENSSL="{- use File::Spec::Functions;
327 catfile("apps","openssl") -}"
329 # DESTDIR is for package builders so that they can configure for, say,
330 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
331 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
332 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
333 # STAGING:[USER.OPENSSL].
334 # Normally it is left empty.
337 # Do not edit this manually. Use Configure --prefix=DIR to change this!
338 INSTALLTOP={- our $installtop =
339 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
341 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
342 # This is the standard central area to store certificates, private keys...
343 OPENSSLDIR={- catdir($config{openssldir}) or
344 $config{prefix} ? catdir($config{prefix},"COMMON")
345 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
346 # The same, but for C
347 OPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000]
348 # Where installed ENGINE modules reside, for C
349 ENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
350 # Where modules reside, for C
351 MODULESDIR_C={- platform->osslprefix() -}MODULES{- $sover_dirname.$target{pointer_size} -}:
353 ##### User defined commands and flags ################################
356 CPP={- $config{CPP} -}
357 DEFINES={- our $defines = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
358 #INCLUDES={- our $includes = join(',', @{$config{CPPINCLUDES}}) -}
359 CPPFLAGS={- our $cppflags = join('', @{$config{CPPFLAGS}}) -}
360 CFLAGS={- join('', @{$config{CFLAGS}}) -}
361 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
362 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
364 PERL={- $config{PERL} -}
367 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
369 ##### Special command flags ##########################################
371 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
373 PERLASM_SCHEME={- $target{perlasm_scheme} -}
375 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
376 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags) =~ s|"|""|g;
377 (my $d = $lib_cppdefines) =~ s|"|""|g;
378 my $i = join(',', @lib_cppincludes || (), '$(INCLUDES)');
380 $x .= "/INCLUDE=($i)" if $i;
381 $x .= "/DEFINE=($d)" if $d;
384 # .FIRST and .LAST are special targets with MMS and MMK.
387 $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
388 $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop'
390 $(NODEBUG) staging_dir = "$(DESTDIR)"
391 $(NODEBUG) staging_instdir = ""
392 $(NODEBUG) staging_datadir = ""
393 $(NODEBUG) IF staging_dir .NES. "" THEN -
394 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
395 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
396 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
397 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
398 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
399 $(NODEBUG) IF staging_dir .NES. "" THEN -
400 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
401 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
402 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
403 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
404 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
406 $(NODEBUG) ! Installation logical names
408 $(NODEBUG) ! This also creates a few DCL variables that are used for
409 $(NODEBUG) ! the "install_msg" target.
411 $(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
412 $(NODEBUG) installtop = installroot + ".]"
413 $(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
414 $(NODEBUG) datatop = dataroot + ".]"
415 $(NODEBUG) DEFINE ossl_installroot 'installtop'
416 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
418 $(NODEBUG) ! Override disturbing system logicals. We can't deassign
419 $(NODEBUG) ! them, so we create it instead. This is an unfortunate
420 $(NODEBUG) ! necessity.
422 $(NODEBUG) DEFINE openssl "{- sourcedir('include/openssl') -}
424 $(NODEBUG) ! Figure out the architecture
426 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
428 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
429 $(NODEBUG) ! running programs can use them.
431 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
434 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
435 $(NODEBUG) DEASSIGN ossl_dataroot
436 $(NODEBUG) DEASSIGN ossl_installroot
437 $(NODEBUG) DEASSIGN openssl
439 @ ! MMS cannot handle no actions...
441 # The main targets ###################################################
443 {- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep copy-utils
444 {- dependmagic('build_libs'); -} : build_libs_nodep
445 {- dependmagic('build_modules'); -} : build_modules_nodep
446 {- dependmagic('build_programs'); -} : build_programs_nodep
448 build_generated_pods : $(GENERATED_PODS)
449 build_docs : build_html_docs
450 build_html_docs : $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
452 build_generated : $(GENERATED_MANDATORY)
453 build_libs_nodep : $(LIBS), $(SHLIBS)
454 build_modules_nodep : $(MODULES)
455 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
457 # Kept around for backward compatibility
458 build_apps build_tests : build_programs
460 # Convenience target to prebuild all generated files, not just the mandatory
462 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
463 @ ! {- output_off() if $disabled{makedepend}; "" -}
464 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
465 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
466 @ WRITE SYS$OUTPUT " then make will fail..."
467 @ ! {- output_on() if $disabled{makedepend}; "" -}
469 all : build_sw build_docs
472 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep copy-utils run_tests
474 @ ! {- output_off() if $disabled{tests}; "" -}
475 DEFINE SRCTOP "$(SRCDIR)"
476 DEFINE BLDTOP "$(BLDDIR)"
477 DEFINE FIPSKEY "$(FIPSKEY)"
478 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
479 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
483 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
484 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
485 @ ! {- output_on() if !$disabled{tests}; "" -}
488 @ ! {- output_off() if $disabled{tests}; "" -}
489 @ DEFINE SRCTOP "$(SRCDIR)"
490 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
492 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
493 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
494 @ ! {- output_on() if !$disabled{tests}; "" -}
496 install : install_sw install_ssldirs install_docs install_msg
499 @ WRITE SYS$OUTPUT ""
500 @ WRITE SYS$OUTPUT "######################################################################"
501 @ WRITE SYS$OUTPUT ""
502 @ IF "$(DESTDIR)" .EQS. "" THEN -
503 @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}"
504 @ IF "$(DESTDIR)" .NES. "" THEN -
505 @{- sourcefile("VMS", "msg_staging.com") -} -
506 "''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" -
507 "$(SYSTARTUP)" "{- $osslver -}"
510 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
512 uninstall : uninstall_docs uninstall_sw
514 # Because VMS wants the generation number (or *) to delete files, we can't
515 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
517 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
518 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
521 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
522 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
523 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
524 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
525 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
526 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
527 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
528 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
529 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
530 - DELETE [...]*.MAP;*
532 - DELETE [...]*.OBJ;*,*.LIS;*
533 - DELETE []CXX$DEMANGLER_DB.;*
534 - DELETE [.VMS]openssl_startup.com;*
535 - DELETE [.VMS]openssl_shutdown.com;*
536 - DELETE []vmsconfig.pm;*
539 - DELETE configdata.pm;*
540 - DELETE descrip.mms;*
544 @ ! {- output_off() if $disabled{makedepend}; "" -}
545 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "{- $config{makedep_scheme} -}"
546 @ ! {- output_on() if $disabled{makedepend}; "" -}
548 # Install helper targets #############################################
550 install_sw : install_dev install_engines install_modules -
551 install_runtime install_startup install_ivp
553 uninstall_sw : uninstall_dev uninstall_modules uninstall_engines -
554 uninstall_runtime uninstall_startup uninstall_ivp
556 install_docs : install_html_docs
558 uninstall_docs : uninstall_html_docs
560 install_fips : install_sw
561 @ WRITE SYS$OUTPUT "*** Installing FIPS module configuration"
562 @ WRITE SYS$OUTPUT "fipsinstall $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
563 openssl fipsinstall -
564 -module ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME) -
565 -out ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf -
566 -macopt "hexkey:$(FIPSKEY)"
568 uninstall_fips : uninstall_sw
569 @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module configuration"
570 DELETE ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf;*
572 install_ssldirs : check_INSTALLTOP
573 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
574 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
575 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
576 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
577 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
578 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
579 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
580 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
581 @ ! Install configuration file
582 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
583 ossl_dataroot:[000000]openssl.cnf-dist
584 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
585 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
586 ossl_dataroot:[000000]openssl.cnf
587 @ ! Install CTLOG configuration file
588 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
589 ossl_dataroot:[000000]ct_log_list.cnf-dist
590 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
591 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
592 ossl_dataroot:[000000]ct_log_list.cnf
594 install_dev : check_INSTALLTOP install_runtime_libs
595 @ WRITE SYS$OUTPUT "*** Installing development files"
596 @ ! Install header files
597 - CREATE/DIR ossl_installroot:[include.openssl]
598 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
599 @ ! Install static (development) libraries
600 - CREATE/DIR ossl_installroot:[LIB.'arch']
602 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
605 install_engines : check_INSTALLTOP install_runtime_libs build_modules
606 @ {- output_off() unless scalar @install_engines; "" -} !
607 @ WRITE SYS$OUTPUT "*** Installing engines"
608 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
610 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
612 @ {- output_on() unless scalar @install_engines; "" -} !
614 install_modules : check_INSTALLTOP install_runtime_libs build_modules
615 @ {- output_off() unless scalar @install_modules; "" -} !
616 @ WRITE SYS$OUTPUT "*** Installing modules"
617 - CREATE/DIR ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']
619 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$sover_dirname$target{pointer_size}.'arch']" }
621 @ {- output_on() unless scalar @install_modules; "" -} !
623 install_runtime : install_programs
625 install_runtime_libs : check_INSTALLTOP build_libs
626 @ {- output_off() if $disabled{shared}; "" -} !
627 @ WRITE SYS$OUTPUT "*** Installing shareable images"
628 @ ! Install shared (runtime) libraries
629 - CREATE/DIR ossl_installroot:[LIB.'arch']
631 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
633 @ {- output_on() if $disabled{shared}; "" -} !
635 install_programs : check_INSTALLTOP install_runtime_libs build_programs
636 @ {- output_off() if $disabled{apps}; "" -} !
637 @ ! Install the main program
638 - CREATE/DIR ossl_installroot:[EXE.'arch']
639 COPY/PROT=W:RE [.APPS]openssl.EXE -
640 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
642 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
643 @ ! {- output_on() if $disabled{apps}; "" -}
645 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
646 [.VMS]openssl_utils.com, check_INSTALLTOP
647 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
648 COPY/PROT=W:RE [.VMS]openssl_startup.com -
649 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
650 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
651 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
652 COPY/PROT=W:RE [.VMS]openssl_utils.com -
653 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
655 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
656 - CREATE/DIR ossl_installroot:[SYSTEST]
657 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
658 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
660 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
662 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
663 {- sourcefile("VMS", "openssl_startup.com.in") -} -
664 > [.VMS]openssl_startup.com
666 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
668 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
669 {- sourcefile("VMS", "openssl_utils.com.in") -} -
670 > [.VMS]openssl_utils.com
672 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
674 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
675 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
676 > [.VMS]openssl_shutdown.com
678 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
680 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
681 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
682 > [.VMS]openssl_ivp.com
684 vmsconfig.pm : configdata.pm
685 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
686 WRITE CONFIG "package vmsconfig;"
687 WRITE CONFIG "use strict; use warnings;"
688 WRITE CONFIG "use Exporter;"
689 WRITE CONFIG "our @ISA = qw(Exporter);"
690 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
691 WRITE CONFIG "our %config = ("
692 WRITE CONFIG " target => '","{- $config{target} -}","',"
693 WRITE CONFIG " version => '","{- $config{version} -}","',"
694 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
695 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
696 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
697 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
698 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
699 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
700 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
702 WRITE CONFIG "our %target = ();"
703 WRITE CONFIG "our %disabled = ();"
704 WRITE CONFIG "our %withargs = ();"
705 WRITE CONFIG "our %unified_info = ();"
709 install_html_docs : check_INSTALLTOP build_html_docs
710 @ WRITE SYS$OUTPUT "*** Installing HTML docs"
711 - CREATE/DIR ossl_installroot:[HTML.MAN1]
712 - CREATE/DIR ossl_installroot:[HTML.MAN3]
713 - CREATE/DIR ossl_installroot:[HTML.MAN5]
714 - CREATE/DIR ossl_installroot:[HTML.MAN7]
716 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
717 @{$unified_info{htmldocs}->{man1}} ),
718 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
719 @{$unified_info{htmldocs}->{man3}} ),
720 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
721 @{$unified_info{htmldocs}->{man5}} ),
722 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
723 @{$unified_info{htmldocs}->{man7}} )) -}
726 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
727 WRITE SYS$ERROR "INSTALLTOP should not be empty"
728 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
731 # Helper targets #####################################################
733 copy-utils : [.util]wrap.pl
735 [.util]wrap.pl : configdata.pm
736 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
737 CREATE/DIR/LOG [.util]
738 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
739 COPY/LOG ossl_sourceroot:[util]wrap.pl [.util]
741 # Developer targets ##################################################
744 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
746 # Building targets ###################################################
748 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
749 perl configdata.pm -r
750 @ WRITE SYS$OUTPUT "*************************************************"
751 @ WRITE SYS$OUTPUT "*** ***"
752 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
753 @ WRITE SYS$OUTPUT "*** ***"
754 @ WRITE SYS$OUTPUT "*************************************************"
755 @ PIPE ( EXIT %X10000000 )
758 perl configdata.pm -r
762 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
763 use File::Spec::Unix;
765 # Helper function to convert dependencies in platform agnostic form to
766 # dependencies in platform form.
767 sub compute_platform_depends {
770 grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
771 or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
772 or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
773 or platform->convertext($x); } @_;
776 # Helper function to figure out dependencies on libraries
777 # It takes a list of library names and outputs a list of dependencies
778 sub compute_lib_depends {
779 # Depending on shared libraries:
780 # On Windows POSIX layers, we depend on {libname}.dll.a
781 # On Unix platforms, we depend on {shlibname}.so
783 { lib => platform->sharedlib($_) // platform->staticlib($_),
784 attrs => $unified_info{attributes}->{libraries}->{$_} }
788 # Helper function to deal with inclusion directory specs.
789 # We're dealing with two issues:
790 # 1. A lot of include directory specs take up a lot of command line real
791 # estate, and the DCL command line is very limited (2KiB).
792 # 2. For optimal usage, include directory paths must be in Unix form,
793 # that's the only way the C compiler can merge multiple include paths
794 # in a sane way (we can stop worrying about 1.h including foo/2.h
797 # To resolve 1, we need to create a file with include directory pragmas,
798 # and let the compiler use it with /FIRST_INCLUDE=.
799 # To resolve 2, we convert all include directory specs we get to Unix,
800 # with available File::Spec functions.
802 # We use CRC-24 from https://tools.ietf.org/html/rfc4880#section-6,
803 # reimplemented in Perl to get a workable and constant file name for each
804 # combination of include directory specs. It is assumed that the order of
805 # these directories don't matter.
807 # This function takes as input a list of include directories
808 # This function returns a list two things:
809 # 1. The file name to use with /FIRST_INCLUDE=
810 # 2. Text to insert into descrip.mms (may be the empty string)
814 my $init_value = 0x00B704CE;
815 my $poly_value = 0x01864CFB;
817 my $crc = $init_value;
819 foreach my $x (unpack ('C*', $input)) {
822 for (my $i; $i < 8; $i++) {
824 if ($crc & 0x01000000) {
833 my %includefile_cache;
834 sub make_includefile {
836 my $udir = make_unix_path(rel2abs($_));
840 my @dirs = sort keys %dirs;
841 my $filename = sprintf 'incdirs_%x.h', crc24(join(',', @dirs));
843 if ($includefile_cache{$filename}) {
844 return ($filename, "");
847 my $scripture = <<"EOF";
849 open/write inc_output $filename
852 $scripture .= <<"EOF";
853 write inc_output "#pragma include_directory ""$_"""
856 $scripture .= <<"EOF";
859 $includefile_cache{$filename} = $scripture;
861 return ($filename, $scripture);
866 my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
868 $args{target} : $deps
874 my $gen0 = $args{generator}->[0];
875 my $gen_args = join('', map { " $_" }
876 @{$args{generator}}[1..$#{$args{generator}}]);
877 my $gen_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
878 my $deps = join(", -\n\t\t",
879 compute_platform_depends(@{$args{generator_deps}},
882 if ($args{src} =~ /\.html$/) {
886 my $title = basename($args{src}, ".html");
888 my $mkpod2html = sourcefile('util', 'mkpod2html.pl');
891 \$(PERL) $mkpod2html -i $pod -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
893 } elsif ($args{src} =~ /\.(\d)$/) {
895 # Man-page generator, on VMS we simply ignore man-pages
898 } elsif (platform->isdef($args{src})) {
900 # Linker script-ish generator
902 my $target = platform->def($args{src});
903 my $mkdef = sourcefile('util', 'mkdef.pl');
904 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
906 $args{generator}->[1] || basename($args{product}, '.EXE');
907 my $case_insensitive =
908 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
909 ? '' : ' --case-insensitive';
911 $target : $gen0 $deps $mkdef
912 \$(PERL) $mkdef$ord_ver --ordinals $gen0 --name $ord_name "--OS" "VMS"$case_insensitive > $target
914 } elsif (platform->isasm($args{src})) {
916 # Assembler generator
919 { shlib => "$lib_cflags $lib_cppflags",
920 lib => "$lib_cflags $lib_cppflags",
921 dso => "$dso_cflags $dso_cppflags",
922 bin => "$bin_cflags $bin_cppflags" } -> {$args{intent}};
923 my $defs = join("", map { ",".$_ } @{$args{defs}});
924 my $target = platform->asm($args{src});
927 if ($gen0 =~ /\.pl$/) {
928 $generator = '$(PERL)'.$gen_incs.' '.$gen0.$gen_args
930 } elsif ($gen0 =~ /\.S$/) {
933 die "Generator type for $src unknown: $gen0.$gen_args\n";
936 if (defined($generator)) {
937 # If the target is named foo.S in build.info, we want to
938 # end up generating foo.s in two steps.
939 if ($args{src} =~ /\.S$/) {
941 $target : $gen0 $deps
943 \@ extradefines = "$defs"
944 PIPE \$(CPP) $cppflags \$\@-S | -
945 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
946 \@ DELETE/SYMBOL/LOCAL extradefines
953 $target : $gen0 $deps
954 \@ extradefines = "$defs"
956 \@ DELETE/SYMBOL/LOCAL extradefines
960 $target : $gen0 $deps
961 \@ extradefines = "$defs"
962 PIPE \$(CPP) $cppflags $gen0 | -
963 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
964 \@ DELETE/SYMBOL/LOCAL extradefines
966 } elsif ($gen0 =~ m|^.*\.in$|) {
968 # "dofile" generator (file.in -> file)
970 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
971 "util", "dofile.pl")),
972 rel2abs($config{builddir}));
973 my @perlmodules = ( 'configdata.pm',
974 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
975 my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules;
976 $deps = join(' ', $deps, compute_platform_depends(@perlmodules));
977 @perlmodules = map { '"-M'.basename($_, '.pm').'"' } @perlmodules;
978 my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @perlmodules);
980 $args{src} : $gen0 $deps
981 \$(PERL)$perlmodules $dofile "-o$target{build_file}" $gen0$gen_args > \$\@
983 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
985 # Generic generator using OpenSSL programs
988 # Redo $gen0, to ensure that we have the proper extension
989 $gen0 = platform->bin($gen0);
991 $args{src} : $gen0 $deps
992 PIPE MCR $gen0$gen_args > \$@
996 # Generic generator using Perl
999 $args{src} : $gen0 $deps
1000 \$(PERL)$gen_incs $gen0$gen_args > \$\@
1006 my $asmext = platform->asmext();
1010 (platform->isasm($x) && grep { $x eq $_ } @generated)
1011 ? platform->asm($x) : $x }
1013 my $obj = platform->obj($args{obj});
1014 my $dep = platform->dep($args{obj});
1015 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
1017 # Because VMS C isn't very good at combining a /INCLUDE path with
1018 # #includes having a relative directory (like '#include "../foo.h"),
1019 # the best choice is to move to the first source file's intended
1020 # directory before compiling, and make sure to write the object file
1021 # in the correct position (important when the object tree is other
1022 # than the source tree).
1023 my $forward = dirname($args{srcs}->[0]);
1024 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
1025 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
1026 my $objn = basename($obj);
1027 my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
1028 my $depn = basename($dep);
1030 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
1031 my $incextra = join(',', map { "\"$_\"" }
1032 @{$unified_info{includes_extra}->{$obj}});
1033 $incextra = "/INCLUDE=($incextra)" if $incextra;
1034 print STDERR "DEBUG: Looking for extra include directories for $obj, found this: $incextra\n"
1038 if ($args{attrs}->{noinst}) {
1039 $cflags .= { shlib => $lib_cflags_no_inst,
1040 lib => $lib_cflags_no_inst,
1041 dso => $dso_cflags_no_inst,
1042 bin => $bin_cflags_no_inst } -> {$args{intent}};
1044 $cflags .= { shlib => $lib_cflags,
1047 bin => $bin_cflags } -> {$args{intent}};
1049 $cflags .= { shlib => $lib_cppflags,
1050 lib => $lib_cppflags,
1051 dso => $dso_cppflags,
1052 bin => $bin_cppflags } -> {$args{intent}};
1053 $cflags .= $incextra;
1054 my $defs = join("", map { ",".$_ } @{$args{defs}});
1055 my $asflags = { shlib => $lib_asflags,
1056 lib => $lib_asflags,
1057 dso => $dso_asflags,
1058 bin => $bin_asflags } -> {$args{intent}};
1060 if ($srcs[0] =~ /\Q${asmext}\E$/) {
1063 SET DEFAULT $forward
1064 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn} $srcs
1065 SET DEFAULT $backward
1068 } elsif ($srcs[0] =~ /.S$/) {
1071 SET DEFAULT $forward
1073 \@ extradefines = "$defs"
1074 PIPE \$(CPP) ${cflags} $srcs | -
1075 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
1076 > ${objd}${objn}-asm
1077 \@ DELETE/SYMBOL/LOCAL extradefines
1079 SET DEFAULT $backward
1080 \$(AS) $asflags \$(ASOUTFLAG)$obj $obj-asm
1085 my ($incdir_filename, $incdir_scripture) =
1086 make_includefile(@{ { shlib => [ @lib_cppincludes ],
1087 lib => [ @lib_cppincludes ],
1088 dso => [ @dso_cppincludes ],
1089 bin => [ @bin_cppincludes ] } -> {$args{intent}} },
1091 $deps .= ", -\n\t\t$incdir_filename";
1093 $target{cflag_incfirst}
1094 . '"'.make_unix_path(rel2abs($incdir_filename)).'"'
1097 my $depbuild = $disabled{makedepend} ? ""
1098 : " /MMS=(FILE=${depd}${depn},TARGET=$obj)";
1102 SET DEFAULT $forward
1104 \@ extradefines = "$defs"
1105 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn} /REPOSITORY=$backward $srcs
1106 \@ DELETE/SYMBOL/LOCAL extradefines
1108 SET DEFAULT $backward
1115 my $shlibname = platform->sharedname($args{lib});
1116 my $shlib = platform->sharedlib($args{lib});
1117 my @objs = map { platform->convertext($_) }
1118 grep { platform->isobj($_) }
1120 my @defs = map { platform->convertext($_) }
1121 grep { platform->isdef($_) }
1123 my @deps = compute_lib_depends(@{$args{deps}});
1124 die "More than one symbol vector" if scalar @defs > 1;
1125 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1126 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1127 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
1128 "VMS", "translatesyms.pl")),
1129 rel2abs($config{builddir}));
1130 # The "[]" hack is because in .OPT files, each line inherits the
1131 # previous line's file spec as default, so if no directory spec
1132 # is present in the current line and the previous line has one that
1133 # doesn't apply, you're in for a surprise.
1135 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1136 "WRITE OPT_FILE \"$x" } @objs).
1139 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1140 ? $_->{lib} : "[]".$_->{lib};
1141 $x =~ s|(\.EXE)|$1/SHARE|;
1142 $x =~ s|(\.OLB)|$1/LIB|;
1143 "WRITE OPT_FILE \"$x\"" } @deps)
1147 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
1148 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
1152 LINK ${lib_ldflags}/SHARE=\$\@ $defs[0]-translated/OPT,-
1153 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1154 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1155 PURGE $shlibname.EXE,$shlibname.MAP
1157 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1158 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1164 my $dsoname = platform->dsoname($args{module});
1165 my $dso = platform->dso($args{module});
1166 my @objs = map { platform->convertext($_) }
1167 grep { platform->isobj($_) }
1169 my @defs = map { platform->convertext($_) }
1170 grep { platform->isdef($_) }
1172 my @deps = compute_lib_depends(@{$args{deps}});
1173 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1174 die "More than one symbol vector" if scalar @defs > 1;
1175 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1176 # The "[]" hack is because in .OPT files, each line inherits the
1177 # previous line's file spec as default, so if no directory spec
1178 # is present in the current line and the previous line has one that
1179 # doesn't apply, you're in for a surprise.
1181 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1182 "WRITE OPT_FILE \"$x" } @objs).
1185 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1186 ? $_->{lib} : "[]".$_->{lib};
1187 $x =~ s|(\.EXE)|$1/SHARE|;
1188 $x =~ s|(\.OLB)|$1/LIB|;
1189 "WRITE OPT_FILE \"$x\"" } @deps)
1193 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1197 LINK ${dso_ldflags}/SHARE=\$\@ $defs[0]/OPT,-
1198 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1199 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1201 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1202 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1208 my $lib = platform->staticlib($args{lib});
1209 my @objs = map { platform->convertext($_) }
1210 grep { platform->isobj($_) }
1212 my $objs = join(", -\n\t\t", @objs);
1213 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1216 LIBRARY/CREATE/OBJECT $lib
1223 my $bin = platform->bin($args{bin});
1224 my $binname = platform->binname($args{bin});
1225 my @objs = map { platform->convertext($_) }
1226 grep { platform->isobj($_) }
1228 my $objs = join(",", @objs);
1229 my @deps = compute_lib_depends(@{$args{deps}});
1230 my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1232 my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1233 my $analyse_objs = "@ !";
1234 if ($olb_count > 0) {
1236 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1237 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1239 # The "[]" hack is because in .OPT files, each line inherits the
1240 # previous line's file spec as default, so if no directory spec
1241 # is present in the current line and the previous line has one that
1242 # doesn't apply, you're in for a surprise.
1244 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1245 "\@ WRITE OPT_FILE \"$x" } @objs).
1248 join("\n\t", "WRITE OPT_FILE \"CASE_SENSITIVE=YES\"",
1249 map { my @lines = ();
1251 my $x = $_->{lib} =~ /\[/
1252 ? $_->{lib} : "[]".$_->{lib};
1253 if ($x =~ m|\.EXE$|) {
1254 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1255 } elsif ($x =~ m|\.OLB$|) {
1256 # Special hack to include the MAIN object
1257 # module explicitly. This will only be done
1258 # if there isn't a 'main' in the program's
1259 # object modules already.
1260 my $main = $_->{attrs}->{has_main}
1261 ? '/INCLUDE=main' : '';
1263 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB$main\"",
1264 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1269 # The linking commands looks a bit complex, but it's for good reason.
1270 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1271 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1272 # the linker will warn about it, loudly, and will then choose to pick
1273 # the first copy encountered (the one in bar.obj in this example).
1274 # On Unix and on Windows, the corresponding maneuver goes through
1275 # silently with the same effect.
1276 # With some test programs, made for checking the internals of OpenSSL,
1277 # we do this kind of linking deliberately, picking a few specific object
1278 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1279 # otherwise unreachable (since the shareable images only exports the
1280 # symbols listed in [.util]*.num), and then with the shared libraries
1281 # themselves. So we need to silence the warning about multiply defined
1282 # symbols, to mimic the way linking work on Unix and Windows, and so
1283 # the build isn't interrupted (MMS stops when warnings are signaled,
1284 # by default), and so someone building doesn't have to worry where it
1285 # isn't necessary. If there are other warnings, however, we show them
1286 # and let it break the build.
1290 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1294 TYPE $binname.OPT ! For debugging
1295 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1296 LINK ${bin_ldflags}/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1297 link_status = \$status ; link_severity = link_status .AND. 7
1298 @ search_severity = 1
1299 -@ IF link_severity .EQ. 0 THEN -
1300 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1301 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1302 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1303 search_severity = \$severity
1304 @ ! search_severity is 3 when the last search didn't find any matching
1305 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1306 @ ! If that was the result, we pretend linking got through without
1307 @ ! fault or warning.
1308 @ IF search_severity .EQ. 3 THEN link_severity = 1
1309 @ ! At this point, if link_severity shows that there was a fault
1310 @ ! or warning, make sure to restore the linking status.
1311 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1312 -@ DELETE $binname.LINKLOG;*
1313 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1314 - PURGE $bin,$binname.OPT
1316 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1317 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1323 my $script = $args{script};
1324 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1325 my $sources = join(" ", @{$args{sources}});
1326 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1327 "util", "dofile.pl")),
1328 rel2abs($config{builddir}));
1331 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1332 "-o$target{build_file}" $sources > $script
1333 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1337 "" # Important! This becomes part of the template result.