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{attributes}->{modules}->{$_}->{fips} }
67 @{$unified_info{modules}};
68 our @install_fipsmodules =
69 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
70 && $unified_info{attributes}->{modules}->{$_}->{fips} }
71 @{$unified_info{modules}};
72 our @install_programs =
73 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
74 @{$unified_info{programs}};
75 our @install_bin_scripts =
76 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
77 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
78 @{$unified_info{scripts}};
79 our @install_misc_scripts =
80 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
81 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
82 @{$unified_info{scripts}};
86 our @cnf_asflags = ($target{asflags} || (), @{$config{asflags}});
87 our @cnf_defines = (@{$target{defines}}, @{$config{defines}});
88 our @cnf_includes = (@{$target{includes}}, @{$config{includes}});
89 our @cnf_cppflags = ($target{cppflags} || (), @{$config{cppflags}});
90 our @cnf_cflags = ($target{cflags} || (), @{$config{cflags}});
91 our @cnf_cxxflags = ($target{cxxflags} || (), @{$config{cxxflags}});
92 our @cnf_ldflags = ($target{lflags} || (), @{$config{lflags}});
93 our @cnf_ex_libs = (map{ ",$_" } @{$target{ex_libs}}, @{$config{ex_libs}});
95 # Variables starting with $lib_ are used to build library object files
96 # and shared libraries.
97 # Variables starting with $dso_ are used to build DSOs and their object files.
98 # Variables starting with $bin_ are used to build programs and their object
101 # The following array is special and is treated separately from the rest of
102 # the lib_ variables.
103 our @lib_cppincludes = (@{$target{lib_includes}}, @{$target{shared_includes}},
104 @{$config{lib_includes}}, @{$config{shared_includes}},
107 our $lib_cppdefines =
108 join(',', @{$target{lib_defines}}, @{$target{shared_defines}},
109 @{$config{lib_defines}}, @{$config{shared_defines}},
111 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
112 'ENGINESDIR="""$(ENGINESDIR_C)"""',
113 'MODULESDIR="""$(MODULESDIR_C)"""'
118 join(' ', $target{lib_asflags} || (), @{$config{lib_asflags}},
119 @cnf_asflags, '$(ASFLAGS)');
121 join('', $target{lib_cppflags} || (), $target{shared_cppflags} || (),
122 @{$config{lib_cppflags}}, @{$config{shared_cppflag}},
123 @cnf_cppflags, '/DEFINE=('.$lib_cppdefines.')', '$(CPPFLAGS)');
124 my @lib_cflags = ( $target{lib_cflags} // () );
125 my @lib_cflags_no_inst = ( $target{no_inst_lib_cflags} // @lib_cflags );
126 my @lib_cflags_cont = ( $target{shared_cflag} || (),
127 @{$config{lib_cflags}}, @{$config{shared_cflag}},
128 $cnf_cflags, '$(CFLAGS)');
129 our $lib_cflags = join('', @lib_cflags, @lib_cflags_cont );
130 our $lib_cflags_no_inst = join('', @lib_cflags_no_inst, @lib_cflags_cont );
132 join('', $target{lib_lflags} || (), $target{shared_ldflag} || (),
133 @{$config{lib_lflags}}, @{$config{shared_ldflag}},
134 @cnf_ldflags, '$(LDFLAGS)');
135 our $lib_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
137 # The following array is special and is treated separately from the rest of
138 # the dso_ variables.
139 our @dso_cppincludes = (@{$target{dso_includes}}, @{$target{module_includes}},
140 @{$config{dso_includes}}, @{$config{module_includes}},
143 our $dso_cppdefines =
144 join(',', @{$target{dso_defines}}, @{$target{module_defines}},
145 @{$config{dso_defines}}, @{$config{module_defines}},
151 join(' ', $target{dso_asflags} || (), $target{module_asflags} || (),
152 @{$config{dso_asflags}}, @{$config{module_asflags}},
153 @cnf_asflags, '$(ASFLAGS)');
155 join('', $target{dso_cppflags} || (), $target{module_cppflags} || (),
156 @{$config{dso_cppflags}}, @{$config{module_cppflag}},
158 '/DEFINE=('.$dso_cppdefines.')',
160 my @dso_cflags = ( $target{dso_cflags} // () );
161 my @dso_cflags_no_inst = ( $target{no_inst_dso_cflags} // @dso_cflags );
162 my @dso_cflags_cont = ( $target{module_cflag} || (),
163 @{$config{dso_cflags}}, @{$config{module_cflag}},
164 $cnf_cflags, '$(CFLAGS)');
165 our $dso_cflags = join('', @dso_cflags, @dso_cflags_cont );
166 our $dso_cflags_no_inst = join('', @dso_cflags_no_inst, @dso_cflags_cont );
168 join('', $target{dso_lflags} || (), $target{module_ldflag} || (),
169 @{$config{dso_lflags}}, @{$config{module_ldflag}},
170 @cnf_ldflags, '$(LDFLAGS)');
171 our $dso_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
173 # The following array is special and is treated separately from the rest of
174 # the bin_ variables.
175 our @bin_cppincludes = (@{$target{bin_includes}},
176 @{$config{bin_includes}},
179 our $bin_cppdefines =
180 join(',', @{$target{bin_defines}},
181 @{$config{bin_defines}},
187 join(' ', $target{bin_asflags} || (),
188 @{$config{bin_asflags}},
189 @cnf_asflags, '$(ASFLAGS)');
191 join('', $target{bin_cppflags} || (),
192 @{$config{bin_cppflags}},
194 '/DEFINE=('.$bin_cppdefines.')',
196 my @bin_cflags = ( $target{bin_cflags} // () );
197 my @bin_cflags_no_inst = ( $target{no_inst_bin_cflags} // @bin_cflags );
198 my @bin_cflags_cont = ( @{$config{bin_cflags}},
199 $cnf_cflags, '$(CFLAGS)');
200 our $bin_cflags = join('', @bin_cflags, @bin_cflags_cont );
201 our $bin_cflags_no_inst = join('', @bin_cflags_no_inst, @bin_cflags_cont );
203 join('', $target{bin_cflags} || (),
204 @{$config{bin_cflags}},
205 @cnf_cflags, '$(CFLAGS)');
207 join('', $target{bin_lflags} || (),
208 @{$config{bin_lflags}},
209 @cnf_ldflags, '$(LDFLAGS)');
210 our $bin_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
212 # This is a horrible hack, but is needed because recursive inclusion of files
213 # in different directories does not work well with VMS C. We try to help by
214 # specifying extra relative directories. They must always be in Unix format,
215 # relative to the directory where the .c file is located. The logic is that
216 # any inclusion, merged with one of these relative directories, will find the
217 # requested inclusion file.
218 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
219 my $obj = platform->obj($_);
220 push @{$unified_info{includes_extra}->{$obj}}, qw(../);
222 foreach (grep /\[\.crypto\.ec\.curve448\].*?\.o$/, keys %{$unified_info{sources}}) {
223 my $obj = platform->obj($_);
224 push @{$unified_info{includes_extra}->{$obj}}, qw(./arch_32 ./arch64);
226 foreach (grep /\[\.crypto\.ec\.curve448.arch_(?:32|64)\].*?\.o$/, keys %{$unified_info{sources}}) {
227 my $obj = platform->obj($_);
228 push @{$unified_info{includes_extra}->{$obj}}, qw(../);
230 foreach (grep /\[\.ssl\.(?:record|statem)\].*?\.o$/, keys %{$unified_info{sources}}) {
231 my $obj = platform->obj($_);
232 # Most of the files in [.ssl.record] and [.ssl.statem] include
233 # "../ssl_local.h", which includes things like "record/record.h".
234 # Adding "../" as an inclusion directory helps making this sort of header
235 # from these directories.
236 push @{$unified_info{includes_extra}->{$obj}}, qw(../);
239 foreach (grep /\[\.test\].*?\.o$/, keys %{$unified_info{sources}}) {
240 my $obj = platform->obj($_);
241 push @{$unified_info{includes_extra}->{$obj}}, qw(../ssl ./helpers);
243 foreach (grep /\[\.test\.helpers\].*?\.o$/, keys %{$unified_info{sources}}) {
244 my $obj = platform->obj($_);
245 push @{$unified_info{includes_extra}->{$obj}}, qw(../../ssl);
248 # This makes sure things get built in the order they need
249 # to. You're welcome.
253 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
257 PLATFORM={- $config{target} -}
258 OPTIONS={- $config{options} -}
259 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
260 SRCDIR={- $config{sourcedir} -}
261 BLDDIR={- $config{builddir} -}
262 FIPSKEY={- $config{FIPSKEY} -}
264 # Allow both V and VERBOSE to indicate verbosity. This only applies
267 VERBOSE_FAILURE=$(VF)
269 VERSION={- "$config{full_version}" -}
270 VERSION_NUMBER={- "$config{version}" -}
271 MAJOR={- $config{major} -}
272 MINOR={- $config{minor} -}
273 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
274 SHLIB_TARGET={- $target{shared_target} -}
276 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
277 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
278 MODULES={- join(", ", map { "-\n\t".$_.".EXE" }
279 # Drop all modules that are dependencies, they will
280 # be processed through their dependents
282 !grep { grep { $_ eq $x } @$_ }
283 values %{$unified_info{depends}} }
284 @{$unified_info{modules}}) -}
285 FIPSMODULE={- # We do some extra checking here, as there should be only one
288 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
289 && $unified_info{attributes}->{modules}->{$_}->{fips} }
290 @{$unified_info{modules}};
291 die "More that one FIPS module" if scalar @fipsmodules > 1;
292 join(" ", map { platform->dso($_) } @fipsmodules) -}
293 FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1;
294 join(", ", map { basename(platform->dso($_)) } @fipsmodules) -}
295 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
296 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
297 {- output_off() if $disabled{makedepend}; "" -}
298 DEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ }
299 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
300 keys %{$unified_info{sources}};
301 join(", ", map { "-\n\t".$_ } @deps); -}
302 {- output_on() if $disabled{makedepend}; "" -}
303 GENERATED_MANDATORY={- join(", ",
304 map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
305 GENERATED_PODS={- # common0.tmpl provides @generated
310 $unified_info{attributes}->{depends}
311 ->{$x}->{$_}->{pod} // 0
313 keys %{$unified_info{attributes}->{depends}->{$x}}
317 GENERATED={- # common0.tmpl provides @generated
318 join(", ", map { platform->convertext($_) } @generated) -}
320 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
321 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
322 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
323 INSTALL_MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @install_modules) -}
324 INSTALL_FIPSMODULE={- join(", ", map { "-\n\t".$_.".EXE" } @install_fipsmodules) -}
325 INSTALL_FIPSMODULECONF=[.providers]fipsmodule.cnf
326 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
327 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
328 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
329 HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
330 HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
331 HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
332 HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
334 APPS_OPENSSL="{- use File::Spec::Functions;
335 catfile("apps","openssl") -}"
337 # DESTDIR is for package builders so that they can configure for, say,
338 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
339 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
340 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
341 # STAGING:[USER.OPENSSL].
342 # Normally it is left empty.
345 # Do not edit this manually. Use Configure --prefix=DIR to change this!
346 INSTALLTOP={- our $installtop =
347 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
349 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
350 # This is the standard central area to store certificates, private keys...
351 OPENSSLDIR={- catdir($config{openssldir}) or
352 $config{prefix} ? catdir($config{prefix},"COMMON")
353 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
354 # The same, but for C
355 OPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000]
356 # Where installed ENGINE modules reside, for C
357 ENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
358 # Where modules reside, for C
359 MODULESDIR_C={- platform->osslprefix() -}MODULES{- $sover_dirname.$target{pointer_size} -}:
361 ##### User defined commands and flags ################################
364 CPP={- $config{CPP} -}
365 DEFINES={- our $defines = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
366 #INCLUDES={- our $includes = join(',', @{$config{CPPINCLUDES}}) -}
367 CPPFLAGS={- our $cppflags = join('', @{$config{CPPFLAGS}}) -}
368 CFLAGS={- join('', @{$config{CFLAGS}}) -}
369 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
370 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
372 PERL={- $config{PERL} -}
375 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
377 ##### Special command flags ##########################################
379 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
381 PERLASM_SCHEME={- $target{perlasm_scheme} -}
383 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
384 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags) =~ s|"|""|g;
385 (my $d = $lib_cppdefines) =~ s|"|""|g;
386 my $i = join(',', @lib_cppincludes || (), '$(INCLUDES)');
388 $x .= "/INCLUDE=($i)" if $i;
389 $x .= "/DEFINE=($d)" if $d;
392 # .FIRST and .LAST are special targets with MMS and MMK.
395 {- join( "\n \$(NODEBUG) ", @{ $target{setup_commands} // [] },
397 $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
398 $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop'
400 $(NODEBUG) staging_dir = "$(DESTDIR)"
401 $(NODEBUG) staging_instdir = ""
402 $(NODEBUG) staging_datadir = ""
403 $(NODEBUG) IF staging_dir .NES. "" THEN -
404 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
405 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
406 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
407 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
408 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
409 $(NODEBUG) IF staging_dir .NES. "" THEN -
410 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
411 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
412 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
413 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
414 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
416 $(NODEBUG) ! Installation logical names
418 $(NODEBUG) ! This also creates a few DCL variables that are used for
419 $(NODEBUG) ! the "install_msg" target.
421 $(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
422 $(NODEBUG) installtop = installroot + ".]"
423 $(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
424 $(NODEBUG) datatop = dataroot + ".]"
425 $(NODEBUG) DEFINE ossl_installroot 'installtop'
426 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
428 $(NODEBUG) ! Override disturbing system logicals. We can't deassign
429 $(NODEBUG) ! them, so we create it instead. This is an unfortunate
430 $(NODEBUG) ! necessity.
432 $(NODEBUG) DEFINE openssl "{- sourcedir('include/openssl') -}
434 $(NODEBUG) ! Figure out the architecture
436 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
438 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
439 $(NODEBUG) ! running programs can use them.
441 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
444 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
445 $(NODEBUG) DEASSIGN ossl_dataroot
446 $(NODEBUG) DEASSIGN ossl_installroot
447 $(NODEBUG) DEASSIGN openssl
449 @ ! MMS cannot handle no actions...
451 # The main targets ###################################################
453 {- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
454 {- dependmagic('build_libs'); -} : build_libs_nodep
455 {- dependmagic('build_modules'); -} : build_modules_nodep
456 {- dependmagic('build_programs'); -} : build_programs_nodep
458 build_generated_pods : $(GENERATED_PODS)
459 build_docs : build_html_docs
460 build_html_docs : $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
462 build_generated : $(GENERATED_MANDATORY)
463 build_libs_nodep : $(LIBS), $(SHLIBS)
464 build_modules_nodep : $(MODULES)
465 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
467 # Kept around for backward compatibility
468 build_apps build_tests : build_programs
470 # Convenience target to prebuild all generated files, not just the mandatory
472 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
473 @ ! {- output_off() if $disabled{makedepend}; "" -}
474 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
475 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
476 @ WRITE SYS$OUTPUT " then make will fail..."
477 @ ! {- output_on() if $disabled{makedepend}; "" -}
479 all : build_sw build_docs
482 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep run_tests
484 @ ! {- output_off() if $disabled{tests}; "" -}
485 DEFINE SRCTOP "$(SRCDIR)"
486 DEFINE BLDTOP "$(BLDDIR)"
487 DEFINE FIPSKEY "$(FIPSKEY)"
488 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
489 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
493 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
494 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
495 @ ! {- output_on() if !$disabled{tests}; "" -}
498 @ ! {- output_off() if $disabled{tests}; "" -}
499 @ DEFINE SRCTOP "$(SRCDIR)"
500 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
502 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
503 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
504 @ ! {- output_on() if !$disabled{tests}; "" -}
506 install : install_sw install_ssldirs install_docs {- $disabled{fips} ? "" : "install_fips" -} install_msg
509 @ WRITE SYS$OUTPUT ""
510 @ WRITE SYS$OUTPUT "######################################################################"
511 @ WRITE SYS$OUTPUT ""
512 @ IF "$(DESTDIR)" .EQS. "" THEN -
513 @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}"
514 @ IF "$(DESTDIR)" .NES. "" THEN -
515 @{- sourcefile("VMS", "msg_staging.com") -} -
516 "''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" -
517 "$(SYSTARTUP)" "{- $osslver -}"
520 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
522 uninstall : uninstall_docs uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -}
524 # Because VMS wants the generation number (or *) to delete files, we can't
525 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
527 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
528 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
531 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
532 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
533 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
534 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
535 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
536 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
537 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
538 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
539 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
540 - DELETE [...]*.MAP;*
542 - DELETE [...]*.OBJ;*,*.LIS;*
543 - DELETE []CXX$DEMANGLER_DB.;*
544 - DELETE [.VMS]openssl_startup.com;*
545 - DELETE [.VMS]openssl_shutdown.com;*
546 - DELETE []vmsconfig.pm;*
549 - DELETE configdata.pm;*
550 - DELETE descrip.mms;*
554 @ ! {- output_off() if $disabled{makedepend}; "" -}
555 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "{- $config{makedep_scheme} -}"
556 @ ! {- output_on() if $disabled{makedepend}; "" -}
558 # Install helper targets #############################################
560 install_sw : install_dev install_engines install_modules -
561 install_runtime install_startup install_ivp
563 uninstall_sw : uninstall_dev uninstall_modules uninstall_engines -
564 uninstall_runtime uninstall_startup uninstall_ivp
566 install_docs : install_html_docs
568 uninstall_docs : uninstall_html_docs
570 {- output_off() if $disabled{fips}; "" -}
571 install_fips : build_sw $(INSTALL_FIPSMODULECONF)
572 @ WRITE SYS$OUTPUT "*** Installing FIPS module"
573 COPY/PROT=W:RE $(INSTALL_FIPSMODULES) -
574 ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME)
575 @ WRITE SYS$OUTPUT "*** Installing FIPS module configuration"
576 COPY/PROT=W:RE $(INSTALL_FIPSMODULECONF) OSSL_DATAROOT:[000000]
579 @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module configuration"
580 DELETE OSSL_DATAROOT:[000000]fipsmodule.cnf;*
581 @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module"
582 DELETE ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME);*
583 {- output_on() if $disabled{fips}; "" -}
585 install_ssldirs : check_INSTALLTOP
586 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
587 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
588 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
589 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
590 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
591 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
592 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
593 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
594 @ ! Install configuration file
595 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
596 ossl_dataroot:[000000]openssl.cnf-dist
597 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
598 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
599 ossl_dataroot:[000000]openssl.cnf
600 @ ! Install CTLOG configuration file
601 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
602 ossl_dataroot:[000000]ct_log_list.cnf-dist
603 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
604 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
605 ossl_dataroot:[000000]ct_log_list.cnf
607 install_dev : check_INSTALLTOP install_runtime_libs
608 @ WRITE SYS$OUTPUT "*** Installing development files"
609 @ ! Install header files
610 - CREATE/DIR ossl_installroot:[include.openssl]
611 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
612 @ ! Install static (development) libraries
613 - CREATE/DIR ossl_installroot:[LIB.'arch']
615 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
618 install_engines : check_INSTALLTOP install_runtime_libs build_modules
619 @ {- output_off() unless scalar @install_engines; "" -} !
620 @ WRITE SYS$OUTPUT "*** Installing engines"
621 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
623 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
625 @ {- output_on() unless scalar @install_engines; "" -} !
627 install_modules : check_INSTALLTOP install_runtime_libs build_modules
628 @ {- output_off() unless scalar @install_modules; "" -} !
629 @ WRITE SYS$OUTPUT "*** Installing modules"
630 - CREATE/DIR ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']
632 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$sover_dirname$target{pointer_size}.'arch']" }
634 @ {- output_on() unless scalar @install_modules; "" -} !
636 install_runtime : install_programs
638 install_runtime_libs : check_INSTALLTOP build_libs
639 @ {- output_off() if $disabled{shared}; "" -} !
640 @ WRITE SYS$OUTPUT "*** Installing shareable images"
641 @ ! Install shared (runtime) libraries
642 - CREATE/DIR ossl_installroot:[LIB.'arch']
644 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
646 @ {- output_on() if $disabled{shared}; "" -} !
648 install_programs : check_INSTALLTOP install_runtime_libs build_programs
649 @ {- output_off() if $disabled{apps}; "" -} !
650 @ ! Install the main program
651 - CREATE/DIR ossl_installroot:[EXE.'arch']
652 COPY/PROT=W:RE [.APPS]openssl.EXE -
653 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
655 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
656 @ ! {- output_on() if $disabled{apps}; "" -}
658 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
659 [.VMS]openssl_utils.com, check_INSTALLTOP
660 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
661 COPY/PROT=W:RE [.VMS]openssl_startup.com -
662 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
663 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
664 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
665 COPY/PROT=W:RE [.VMS]openssl_utils.com -
666 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
668 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
669 - CREATE/DIR ossl_installroot:[SYSTEST]
670 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
671 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
673 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
675 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
676 {- sourcefile("VMS", "openssl_startup.com.in") -} -
677 > [.VMS]openssl_startup.com
679 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
681 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
682 {- sourcefile("VMS", "openssl_utils.com.in") -} -
683 > [.VMS]openssl_utils.com
685 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
687 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
688 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
689 > [.VMS]openssl_shutdown.com
691 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
693 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
694 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
695 > [.VMS]openssl_ivp.com
697 vmsconfig.pm : configdata.pm
698 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
699 WRITE CONFIG "package vmsconfig;"
700 WRITE CONFIG "use strict; use warnings;"
701 WRITE CONFIG "use Exporter;"
702 WRITE CONFIG "our @ISA = qw(Exporter);"
703 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
704 WRITE CONFIG "our %config = ("
705 WRITE CONFIG " target => '","{- $config{target} -}","',"
706 WRITE CONFIG " version => '","{- $config{version} -}","',"
707 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
708 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
709 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
710 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
711 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
712 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
713 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
715 WRITE CONFIG "our %target = ();"
716 WRITE CONFIG "our %disabled = ();"
717 WRITE CONFIG "our %withargs = ();"
718 WRITE CONFIG "our %unified_info = ();"
722 install_html_docs : check_INSTALLTOP build_html_docs
723 @ WRITE SYS$OUTPUT "*** Installing HTML docs"
724 - CREATE/DIR ossl_installroot:[HTML.MAN1]
725 - CREATE/DIR ossl_installroot:[HTML.MAN3]
726 - CREATE/DIR ossl_installroot:[HTML.MAN5]
727 - CREATE/DIR ossl_installroot:[HTML.MAN7]
729 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
730 @{$unified_info{htmldocs}->{man1}} ),
731 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
732 @{$unified_info{htmldocs}->{man3}} ),
733 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
734 @{$unified_info{htmldocs}->{man5}} ),
735 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
736 @{$unified_info{htmldocs}->{man7}} )) -}
739 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
740 WRITE SYS$ERROR "INSTALLTOP should not be empty"
741 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
744 # Developer targets ##################################################
747 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
749 # Building targets ###################################################
751 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
752 perl configdata.pm -r
753 @ WRITE SYS$OUTPUT "*************************************************"
754 @ WRITE SYS$OUTPUT "*** ***"
755 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
756 @ WRITE SYS$OUTPUT "*** ***"
757 @ WRITE SYS$OUTPUT "*************************************************"
758 @ PIPE ( EXIT %X10000000 )
761 perl configdata.pm -r
765 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
766 use File::Spec::Unix;
768 # Helper function to convert dependencies in platform agnostic form to
769 # dependencies in platform form.
770 sub compute_platform_depends {
773 grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
774 or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
775 or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
776 or platform->convertext($x); } @_;
779 # Helper function to figure out dependencies on libraries
780 # It takes a list of library names and outputs a list of dependencies
781 sub compute_lib_depends {
782 # Depending on shared libraries:
783 # On Windows POSIX layers, we depend on {libname}.dll.a
784 # On Unix platforms, we depend on {shlibname}.so
786 { lib => platform->sharedlib($_) // platform->staticlib($_),
787 attrs => $unified_info{attributes}->{libraries}->{$_} }
791 # Helper function to deal with inclusion directory specs.
792 # We're dealing with two issues:
793 # 1. A lot of include directory specs take up a lot of command line real
794 # estate, and the DCL command line is very limited (2KiB).
795 # 2. For optimal usage, include directory paths must be in Unix form,
796 # that's the only way the C compiler can merge multiple include paths
797 # in a sane way (we can stop worrying about 1.h including foo/2.h
800 # To resolve 1, we need to create a file with include directory pragmas,
801 # and let the compiler use it with /FIRST_INCLUDE=.
802 # To resolve 2, we convert all include directory specs we get to Unix,
803 # with available File::Spec functions.
805 # We use CRC-24 from https://tools.ietf.org/html/rfc4880#section-6,
806 # reimplemented in Perl to get a workable and constant file name for each
807 # combination of include directory specs. It is assumed that the order of
808 # these directories don't matter.
810 # This function takes as input a list of include directories
811 # This function returns a list two things:
812 # 1. The file name to use with /FIRST_INCLUDE=
813 # 2. Text to insert into descrip.mms (may be the empty string)
817 my $init_value = 0x00B704CE;
818 my $poly_value = 0x01864CFB;
820 my $crc = $init_value;
822 foreach my $x (unpack ('C*', $input)) {
825 for (my $i; $i < 8; $i++) {
827 if ($crc & 0x01000000) {
836 my %includefile_cache;
837 sub make_includefile {
839 my $udir = make_unix_path(rel2abs($_));
843 my @dirs = sort keys %dirs;
844 my $filename = sprintf 'incdirs_%x.h', crc24(join(',', @dirs));
846 if ($includefile_cache{$filename}) {
847 return ($filename, "");
850 my $scripture = <<"EOF";
852 open/write inc_output $filename
855 $scripture .= <<"EOF";
856 write inc_output "#pragma include_directory ""$_"""
859 $scripture .= <<"EOF";
862 $includefile_cache{$filename} = $scripture;
864 return ($filename, $scripture);
869 my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
871 $args{target} : $deps
877 my $gen0 = $args{generator}->[0];
878 my $gen_args = join('', map { " $_" }
879 @{$args{generator}}[1..$#{$args{generator}}]);
880 my $gen_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
881 my $deps = join(", -\n\t\t",
882 compute_platform_depends(@{$args{generator_deps}},
885 if ($args{src} =~ /\.html$/) {
889 my $title = basename($args{src}, ".html");
891 my $mkpod2html = sourcefile('util', 'mkpod2html.pl');
892 my $srcdoc = sourcedir('doc');
895 \$(PERL) $mkpod2html -i $pod -o \$\@ -t "$title" -r "$srcdoc"
897 } elsif ($args{src} =~ /\.(\d)$/) {
899 # Man-page generator, on VMS we simply ignore man-pages
902 } elsif (platform->isdef($args{src})) {
904 # Linker script-ish generator
906 my $target = platform->def($args{src});
907 my $mkdef = sourcefile('util', 'mkdef.pl');
908 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
910 $args{generator}->[1] || basename($args{product}, '.EXE');
911 my $case_insensitive =
912 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
913 ? '' : ' --case-insensitive';
915 $target : $gen0 $deps $mkdef
916 \$(PERL) $mkdef$ord_ver --ordinals $gen0 --name $ord_name "--OS" "VMS"$case_insensitive > $target
918 } elsif (platform->isasm($args{src})) {
920 # Assembler generator
923 { shlib => "$lib_cflags $lib_cppflags",
924 lib => "$lib_cflags $lib_cppflags",
925 dso => "$dso_cflags $dso_cppflags",
926 bin => "$bin_cflags $bin_cppflags" } -> {$args{intent}};
927 my $defs = join("", map { ",".$_ } @{$args{defs}});
928 my $target = platform->asm($args{src});
931 if ($gen0 =~ /\.pl$/) {
932 $generator = '$(PERL)'.$gen_incs.' '.$gen0.$gen_args
934 } elsif ($gen0 =~ /\.S$/) {
937 die "Generator type for $src unknown: $gen0.$gen_args\n";
940 if (defined($generator)) {
941 # If the target is named foo.S in build.info, we want to
942 # end up generating foo.s in two steps.
943 if ($args{src} =~ /\.S$/) {
945 $target : $gen0 $deps
947 \@ extradefines = "$defs"
948 PIPE \$(CPP) $cppflags \$\@-S | -
949 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
950 \@ DELETE/SYMBOL/LOCAL extradefines
957 $target : $gen0 $deps
958 \@ extradefines = "$defs"
960 \@ DELETE/SYMBOL/LOCAL extradefines
964 $target : $gen0 $deps
965 \@ extradefines = "$defs"
966 PIPE \$(CPP) $cppflags $gen0 | -
967 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
968 \@ DELETE/SYMBOL/LOCAL extradefines
970 } elsif ($gen0 =~ m|^.*\.in$|) {
972 # "dofile" generator (file.in -> file)
974 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
975 "util", "dofile.pl")),
976 rel2abs($config{builddir}));
977 my @perlmodules = ( 'configdata.pm',
978 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
979 my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules;
980 $deps = join(' ', $deps, compute_platform_depends(@perlmodules));
981 @perlmodules = map { '"-M'.basename($_, '.pm').'"' } @perlmodules;
982 my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @perlmodules);
984 $args{src} : $gen0 $deps
985 \$(PERL)$perlmodules $dofile "-o$target{build_file}" $gen0$gen_args > \$\@
987 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
989 # Generic generator using OpenSSL programs
992 # Redo $gen0, to ensure that we have the proper extension
993 $gen0 = platform->bin($gen0);
995 $args{src} : $gen0 $deps
996 PIPE MCR $gen0$gen_args > \$@
1000 # Generic generator using Perl
1003 $args{src} : $gen0 $deps
1004 \$(PERL)$gen_incs $gen0$gen_args > \$\@
1010 my $asmext = platform->asmext();
1014 (platform->isasm($x) && grep { $x eq $_ } @generated)
1015 ? platform->asm($x) : $x }
1017 my $obj = platform->obj($args{obj});
1018 my $dep = platform->dep($args{obj});
1019 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
1021 # Because VMS C isn't very good at combining a /INCLUDE path with
1022 # #includes having a relative directory (like '#include "../foo.h"),
1023 # the best choice is to move to the first source file's intended
1024 # directory before compiling, and make sure to write the object file
1025 # in the correct position (important when the object tree is other
1026 # than the source tree).
1027 my $forward = dirname($args{srcs}->[0]);
1028 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
1029 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
1030 my $objn = basename($obj);
1031 my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
1032 my $depn = basename($dep);
1034 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
1035 my $incextra = join(',', map { "\"$_\"" }
1036 @{$unified_info{includes_extra}->{$obj}});
1037 $incextra = "/INCLUDE=($incextra)" if $incextra;
1040 if ($args{attrs}->{noinst}) {
1041 $cflags .= { shlib => $lib_cflags_no_inst,
1042 lib => $lib_cflags_no_inst,
1043 dso => $dso_cflags_no_inst,
1044 bin => $bin_cflags_no_inst } -> {$args{intent}};
1046 $cflags .= { shlib => $lib_cflags,
1049 bin => $bin_cflags } -> {$args{intent}};
1051 $cflags .= { shlib => $lib_cppflags,
1052 lib => $lib_cppflags,
1053 dso => $dso_cppflags,
1054 bin => $bin_cppflags } -> {$args{intent}};
1055 $cflags .= $incextra;
1056 my $defs = join("", map { ",".$_ } @{$args{defs}});
1057 my $asflags = { shlib => $lib_asflags,
1058 lib => $lib_asflags,
1059 dso => $dso_asflags,
1060 bin => $bin_asflags } -> {$args{intent}};
1062 if ($srcs[0] =~ /\Q${asmext}\E$/) {
1065 SET DEFAULT $forward
1066 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn} $srcs
1067 SET DEFAULT $backward
1070 } elsif ($srcs[0] =~ /.S$/) {
1073 SET DEFAULT $forward
1075 \@ extradefines = "$defs"
1076 PIPE \$(CPP) ${cflags} $srcs | -
1077 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
1078 > ${objd}${objn}-asm
1079 \@ DELETE/SYMBOL/LOCAL extradefines
1081 SET DEFAULT $backward
1082 \$(AS) $asflags \$(ASOUTFLAG)$obj $obj-asm
1087 my ($incdir_filename, $incdir_scripture) =
1088 make_includefile(@{ { shlib => [ @lib_cppincludes ],
1089 lib => [ @lib_cppincludes ],
1090 dso => [ @dso_cppincludes ],
1091 bin => [ @bin_cppincludes ] } -> {$args{intent}} },
1093 $deps .= ", -\n\t\t$incdir_filename";
1095 $target{cflag_incfirst}
1096 . '"'.make_unix_path(rel2abs($incdir_filename)).'"'
1099 my $depbuild = $disabled{makedepend} ? ""
1100 : " /MMS=(FILE=${depd}${depn},TARGET=$obj)";
1104 SET DEFAULT $forward
1106 \@ extradefines = "$defs"
1107 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn} /REPOSITORY=$backward $srcs
1108 \@ DELETE/SYMBOL/LOCAL extradefines
1110 SET DEFAULT $backward
1117 my $shlibname = platform->sharedname($args{lib});
1118 my $shlib = platform->sharedlib($args{lib});
1119 my @objs = map { platform->convertext($_) }
1120 grep { platform->isobj($_) }
1122 my @defs = map { platform->convertext($_) }
1123 grep { platform->isdef($_) }
1125 my @deps = compute_lib_depends(@{$args{deps}});
1126 die "More than one symbol vector" if scalar @defs > 1;
1127 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1128 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1129 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
1130 "VMS", "translatesyms.pl")),
1131 rel2abs($config{builddir}));
1132 # The "[]" hack is because in .OPT files, each line inherits the
1133 # previous line's file spec as default, so if no directory spec
1134 # is present in the current line and the previous line has one that
1135 # doesn't apply, you're in for a surprise.
1137 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1138 "WRITE OPT_FILE \"$x" } @objs).
1141 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1142 ? $_->{lib} : "[]".$_->{lib};
1143 $x =~ s|(\.EXE)|$1/SHARE|;
1144 $x =~ s|(\.OLB)|$1/LIB|;
1145 "WRITE OPT_FILE \"$x\"" } @deps)
1149 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
1150 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
1154 LINK ${lib_ldflags}/SHARE=\$\@ $defs[0]-translated/OPT,-
1155 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1156 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1157 PURGE $shlibname.EXE,$shlibname.MAP
1159 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1160 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1166 my $dsoname = platform->dsoname($args{module});
1167 my $dso = platform->dso($args{module});
1168 my @objs = map { platform->convertext($_) }
1169 grep { platform->isobj($_) }
1171 my @defs = map { platform->convertext($_) }
1172 grep { platform->isdef($_) }
1174 my @deps = compute_lib_depends(@{$args{deps}});
1175 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1176 die "More than one symbol vector" if scalar @defs > 1;
1177 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1178 # The "[]" hack is because in .OPT files, each line inherits the
1179 # previous line's file spec as default, so if no directory spec
1180 # is present in the current line and the previous line has one that
1181 # doesn't apply, you're in for a surprise.
1183 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1184 "WRITE OPT_FILE \"$x" } @objs).
1187 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1188 ? $_->{lib} : "[]".$_->{lib};
1189 $x =~ s|(\.EXE)|$1/SHARE|;
1190 $x =~ s|(\.OLB)|$1/LIB|;
1191 "WRITE OPT_FILE \"$x\"" } @deps)
1195 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1199 LINK ${dso_ldflags}/SHARE=\$\@ $defs[0]/OPT,-
1200 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1201 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1203 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1204 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1210 my $lib = platform->staticlib($args{lib});
1211 my @objs = map { platform->convertext($_) }
1212 grep { platform->isobj($_) }
1214 my $objs = join(", -\n\t\t", @objs);
1215 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1218 LIBRARY/CREATE/OBJECT $lib
1225 my $bin = platform->bin($args{bin});
1226 my $binname = platform->binname($args{bin});
1227 my @objs = map { platform->convertext($_) }
1228 grep { platform->isobj($_) }
1230 my $objs = join(",", @objs);
1231 my @deps = compute_lib_depends(@{$args{deps}});
1232 my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1234 my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1235 my $analyse_objs = "@ !";
1236 if ($olb_count > 0) {
1238 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1239 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1241 # The "[]" hack is because in .OPT files, each line inherits the
1242 # previous line's file spec as default, so if no directory spec
1243 # is present in the current line and the previous line has one that
1244 # doesn't apply, you're in for a surprise.
1246 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1247 "\@ WRITE OPT_FILE \"$x" } @objs).
1250 join("\n\t", "WRITE OPT_FILE \"CASE_SENSITIVE=YES\"",
1251 map { my @lines = ();
1253 my $x = $_->{lib} =~ /\[/
1254 ? $_->{lib} : "[]".$_->{lib};
1255 if ($x =~ m|\.EXE$|) {
1256 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1257 } elsif ($x =~ m|\.OLB$|) {
1258 # Special hack to include the MAIN object
1259 # module explicitly. This will only be done
1260 # if there isn't a 'main' in the program's
1261 # object modules already.
1262 my $main = $_->{attrs}->{has_main}
1263 ? '/INCLUDE=main' : '';
1265 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB$main\"",
1266 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1271 # The linking commands looks a bit complex, but it's for good reason.
1272 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1273 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1274 # the linker will warn about it, loudly, and will then choose to pick
1275 # the first copy encountered (the one in bar.obj in this example).
1276 # On Unix and on Windows, the corresponding maneuver goes through
1277 # silently with the same effect.
1278 # With some test programs, made for checking the internals of OpenSSL,
1279 # we do this kind of linking deliberately, picking a few specific object
1280 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1281 # otherwise unreachable (since the shareable images only exports the
1282 # symbols listed in [.util]*.num), and then with the shared libraries
1283 # themselves. So we need to silence the warning about multiply defined
1284 # symbols, to mimic the way linking work on Unix and Windows, and so
1285 # the build isn't interrupted (MMS stops when warnings are signaled,
1286 # by default), and so someone building doesn't have to worry where it
1287 # isn't necessary. If there are other warnings, however, we show them
1288 # and let it break the build.
1292 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1296 TYPE $binname.OPT ! For debugging
1297 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1298 LINK ${bin_ldflags}/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1299 link_status = \$status ; link_severity = link_status .AND. 7
1300 @ search_severity = 1
1301 -@ IF link_severity .EQ. 0 THEN -
1302 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1303 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1304 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1305 search_severity = \$severity
1306 @ ! search_severity is 3 when the last search didn't find any matching
1307 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1308 @ ! If that was the result, we pretend linking got through without
1309 @ ! fault or warning.
1310 @ IF search_severity .EQ. 3 THEN link_severity = 1
1311 @ ! At this point, if link_severity shows that there was a fault
1312 @ ! or warning, make sure to restore the linking status.
1313 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1314 -@ DELETE $binname.LINKLOG;*
1315 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1316 - PURGE $bin,$binname.OPT
1318 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1319 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1325 my $script = $args{script};
1326 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1327 my $sources = join(" ", @{$args{sources}});
1328 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1329 "util", "dofile.pl")),
1330 rel2abs($config{builddir}));
1332 $script : $sources configdata.pm
1333 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1334 "-o$target{build_file}" $sources > $script
1335 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1339 "" # Important! This becomes part of the template result.