1 ## descrip.mms to build OpenSSL on OpenVMS
3 ## {- join("\n## ", @autowarntext) -}
5 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
8 (our $osslprefix_q = platform->osslprefix()) =~ s/\$/\\\$/;
10 our $sover_dirname = platform->shlib_version_as_filename();
11 our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
13 our $sourcedir = $config{sourcedir};
14 our $builddir = $config{builddir};
16 catfile($sourcedir, @_);
19 catfile($builddir, @_);
22 catdir($sourcedir, @_);
25 catdir($builddir, @_);
28 (my $x = shift) =~ s|\]$|...]|;
33 # Because we need to make two computations of these data,
34 # we store them in arrays for reuse
36 map { platform->staticname($_) }
37 @{$unified_info{libraries}};
39 map { platform->sharedname($_) // () }
40 @{$unified_info{libraries}};
42 map { platform->staticname($_) }
43 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
44 @{$unified_info{libraries}};
46 map { platform->sharedname($_) // () }
47 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
48 @{$unified_info{libraries}};
49 our @install_engines =
50 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
51 && $unified_info{attributes}->{modules}->{$_}->{engine} }
52 @{$unified_info{modules}};
53 our @install_modules =
54 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
55 && !$unified_info{attributes}->{modules}->{$_}->{engine} }
56 @{$unified_info{modules}};
57 our @install_programs =
58 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
59 @{$unified_info{programs}};
60 our @install_bin_scripts =
61 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
62 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
63 @{$unified_info{scripts}};
64 our @install_misc_scripts =
65 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
66 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
67 @{$unified_info{scripts}};
69 # This is a horrible hack, but is needed because recursive inclusion of files
70 # in different directories does not work well with HP C.
71 my $sd = sourcedir("crypto", "async", "arch");
72 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
73 my $obj = platform->obj($_);
74 $unified_info{before}->{$obj}
75 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
76 define arch 'arch_include');
77 $unified_info{after}->{$obj}
80 my $sd1 = sourcedir("ssl","record");
81 my $sd2 = sourcedir("ssl","statem");
82 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
83 keys %{$unified_info{sources}});
84 foreach (@ssl_locl_users) {
85 my $obj = platform->obj($_);
86 $unified_info{before}->{$obj}
87 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
88 define record 'record_include'
89 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
90 define statem 'statem_include');
91 $unified_info{after}->{$obj}
95 # This makes sure things get built in the order they need
100 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
104 PLATFORM={- $config{target} -}
105 OPTIONS={- $config{options} -}
106 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
107 SRCDIR={- $config{sourcedir} -}
108 BLDDIR={- $config{builddir} -}
109 FIPSKEY={- $config{FIPSKEY} -}
111 # Allow both V and VERBOSE to indicate verbosity. This only applies
114 VERBOSE_FAILURE=$(VF)
116 VERSION={- "$config{full_version}" -}
117 MAJOR={- $config{major} -}
118 MINOR={- $config{minor} -}
119 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
120 SHLIB_TARGET={- $target{shared_target} -}
122 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
123 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
124 FIPSMODULENAME={- # We do some extra checking here, as there should be only one
126 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
127 && $unified_info{attributes}->{modules}->{$_}->{fips} }
128 @{$unified_info{modules}};
129 die "More that one FIPS module" if scalar @fipsmodules > 1;
130 join(", ", map { basename platform->dso($_) } @fipsmodules) -}
131 MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{modules}}) -}
132 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
133 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
134 {- output_off() if $disabled{makedepend}; "" -}
135 DEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ }
136 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
137 keys %{$unified_info{sources}};
138 join(", ", map { "-\n\t".$_ } @deps); -}
139 {- output_on() if $disabled{makedepend}; "" -}
140 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
141 GENERATED={- # common0.tmpl provides @generated
142 join(", ", map { platform->convertext($_) } @generated) -}
144 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
145 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
146 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
147 INSTALL_MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @install_modules) -}
148 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
149 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
150 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
151 HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
152 HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
153 HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
154 HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
156 APPS_OPENSSL="{- use File::Spec::Functions;
157 catfile("apps","openssl") -}"
159 # DESTDIR is for package builders so that they can configure for, say,
160 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
161 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
162 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
163 # STAGING:[USER.OPENSSL].
164 # Normally it is left empty.
167 # Do not edit this manually. Use Configure --prefix=DIR to change this!
168 INSTALLTOP={- our $installtop =
169 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
171 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
172 # This is the standard central area to store certificates, private keys...
173 OPENSSLDIR={- catdir($config{openssldir}) or
174 $config{prefix} ? catdir($config{prefix},"COMMON")
175 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
176 # The same, but for C
177 OPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000]
178 # Where installed ENGINE modules reside, for C
179 ENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
180 # Where modules reside, for C
181 MODULESDIR_C={- platform->osslprefix() -}MODULES{- $sover_dirname.$target{pointer_size} -}:
183 ##### User defined commands and flags ################################
186 CPP={- $config{CPP} -}
187 DEFINES={- our $defines1 = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
188 INCLUDES={- our $includes1 = join(',', @{$config{CPPINCLUDES}}) -}
189 CPPFLAGS={- our $cppflags1 = join('', @{$config{CPPFLAGS}}) -}
190 CFLAGS={- join('', @{$config{CFLAGS}}) -}
191 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
192 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
194 PERL={- $config{PERL} -}
197 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
199 ##### Special command flags ##########################################
201 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
203 ##### Project flags ##################################################
205 # Variables starting with CNF_ are common variables for all product types
207 CNF_ASFLAGS={- join('', $target{asflags} || (),
208 @{$config{asflags}}) -}
209 CNF_DEFINES={- our $defines2 = join('', (map { ",$_" } @{$target{defines}},
210 @{$config{defines}}),
212 CNF_INCLUDES={- our $includes2 = join(',', @{$target{includes}},
213 @{$config{includes}}) -}
214 CNF_CPPFLAGS={- our $cppflags2 = join('', $target{cppflags} || (),
215 @{$config{cppflags}}) -}
216 CNF_CFLAGS={- join('', $target{cflags} || (),
217 @{$config{cflags}}) -}
218 CNF_CXXFLAGS={- join('', $target{cxxflags} || (),
219 @{$config{cxxflags}}) -}
220 CNF_LDFLAGS={- join('', $target{lflags} || (),
221 @{$config{lflags}}) -}
222 CNF_EX_LIBS={- join('', map{ ",$_" } @{$target{ex_libs}},
223 @{$config{ex_libs}}) -}
225 # Variables starting with LIB_ are used to build library object files
226 # and shared libraries.
227 # Variables starting with DSO_ are used to build DSOs and their object files.
228 # Variables starting with BIN_ are used to build programs and their object
231 LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (),
232 @{$config{lib_asflags}},
233 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
234 LIB_DEFINES={- our $lib_defines =
235 join('', (map { ",$_" } @{$target{lib_defines}},
236 @{$target{shared_defines}},
237 @{$config{lib_defines}},
238 @{$config{shared_defines}}));
239 join('', $lib_defines,
240 (map { ",$_" } 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
241 'ENGINESDIR="""$(ENGINESDIR_C)"""',
242 'MODULESDIR="""$(MODULESDIR_C)"""'),
243 '$(CNF_DEFINES)', '$(DEFINES)') -}
244 LIB_INCLUDES={- our $lib_includes =
245 join(',', @{$target{lib_includes}},
246 @{$target{shared_includes}},
247 @{$config{lib_includes}},
248 @{$config{shared_includes}}) -}
249 LIB_CPPFLAGS={- our $lib_cppflags =
250 join('', $target{lib_cppflags} || (),
251 $target{shared_cppflags} || (),
252 @{$config{lib_cppflags}},
253 @{$config{shared_cppflag}});
254 join('', "'qual_includes'",
255 '/DEFINE=(__dummy$(LIB_DEFINES))',
257 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
258 LIB_CFLAGS={- join('', $target{lib_cflags} || (),
259 $target{shared_cflag} || (),
260 @{$config{lib_cflags}},
261 @{$config{shared_cflag}},
262 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
263 LIB_LDFLAGS={- join('', $target{lib_lflags} || (),
264 $target{shared_ldflag} || (),
265 @{$config{lib_lflags}},
266 @{$config{shared_ldflag}},
267 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
268 LIB_EX_LIBS=$(CNF_EX_LIBS)$(EX_LIBS)
269 DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (),
270 $target{module_asflags} || (),
271 @{$config{dso_asflags}},
272 @{$config{module_asflags}},
273 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
274 DSO_DEFINES={- join('', (map { ",$_" } @{$target{dso_defines}},
275 @{$target{module_defines}},
276 @{$config{dso_defines}},
277 @{$config{module_defines}}),
278 '$(CNF_DEFINES)', '$(DEFINES)') -}
279 DSO_INCLUDES={- join(',', @{$target{dso_includes}},
280 @{$target{module_includes}},
281 @{$config{dso_includes}},
282 @{$config{module_includes}}) -}
283 DSO_CPPFLAGS={- join('', "'qual_includes'",
284 '/DEFINE=(__dummy$(DSO_DEFINES))',
285 $target{dso_cppflags} || (),
286 $target{module_cppflags} || (),
287 @{$config{dso_cppflags}},
288 @{$config{module_cppflags}},
289 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
290 DSO_CFLAGS={- join('', $target{dso_cflags} || (),
291 $target{module_cflags} || (),
292 @{$config{dso_cflags}},
293 @{$config{module_cflags}},
294 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
295 DSO_LDFLAGS={- join('', $target{dso_lflags} || (),
296 $target{module_ldflags} || (),
297 @{$config{dso_lflags}},
298 @{$config{module_ldflags}},
299 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
300 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
301 BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
302 @{$config{bin_asflags}},
303 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
304 BIN_DEFINES={- join('', (map { ",$_" } @{$target{bin_defines}},
305 @{$config{bin_defines}}),
306 '$(CNF_DEFINES)', '$(DEFINES)') -}
307 BIN_INCLUDES={- join(',', @{$target{bin_includes}},
308 @{$config{bin_includes}}) -}
309 BIN_CPPFLAGS={- join('', "'qual_includes'",
310 '/DEFINE=(__dummy$(DSO_DEFINES))',
311 $target{bin_cppflags} || (),
312 @{$config{bin_cppflag}},
313 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
314 BIN_CFLAGS={- join('', $target{bin_cflags} || (),
315 @{$config{bin_cflags}},
316 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
317 BIN_LDFLAGS={- join('', $target{bin_lflags} || (),
318 @{$config{bin_lflags}} || (),
319 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
320 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
321 NO_INST_LIB_CFLAGS={- join('', $target{no_inst_lib_cflags}
322 // $target{lib_cflags}
324 $target{shared_cflag} || (),
325 @{$config{lib_cflags}},
326 @{$config{shared_cflag}},
327 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
328 NO_INST_DSO_CFLAGS={- join('', $target{no_inst_dso_cflags}
329 // $target{dso_cflags}
331 $target{no_inst_module_cflags}
332 // $target{module_cflags}
334 @{$config{dso_cflags}},
335 @{$config{module_cflags}},
336 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
337 NO_INST_BIN_CFLAGS={- join('', $target{no_inst_bin_cflags}
338 // $target{bin_cflags}
340 @{$config{bin_cflags}},
341 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
343 PERLASM_SCHEME={- $target{perlasm_scheme} -}
345 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
346 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags2.$cppflags1) =~ s|"|""|g;
347 (my $d = $lib_defines.$defines2.$defines1) =~ s|"|""|g;
348 my $i = join(',', $lib_includes || (), $includes2 || (),
351 $x .= "/INCLUDE=($i)" if $i;
352 $x .= "/DEFINE=($d)" if $d;
355 # .FIRST and .LAST are special targets with MMS and MMK.
356 # The defines in there are for C. includes that look like
359 # #include <openssl/foo.h>
360 # #include "internal/bar.h"
362 # will use the logical names to find the files. Expecting
363 # DECompHP C to find files in subdirectories of whatever was
364 # given with /INCLUDE is a fantasy, unfortunately.
367 $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
368 $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop'
370 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
371 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
372 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
373 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
374 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
375 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
376 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
377 $(NODEBUG) staging_dir = "$(DESTDIR)"
378 $(NODEBUG) staging_instdir = ""
379 $(NODEBUG) staging_datadir = ""
380 $(NODEBUG) IF staging_dir .NES. "" THEN -
381 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
382 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
383 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
384 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
385 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
386 $(NODEBUG) IF staging_dir .NES. "" THEN -
387 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
388 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
389 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
390 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
391 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
393 $(NODEBUG) ! Installation logical names
395 $(NODEBUG) ! This also creates a few DCL variables that are used for
396 $(NODEBUG) ! the "install_msg" target.
398 $(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
399 $(NODEBUG) installtop = installroot + ".]"
400 $(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
401 $(NODEBUG) datatop = dataroot + ".]"
402 $(NODEBUG) DEFINE ossl_installroot 'installtop'
403 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
405 $(NODEBUG) ! Figure out the architecture
407 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
409 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
410 $(NODEBUG) ! running programs can use them.
412 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
415 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
416 $(NODEBUG) DEASSIGN ossl_dataroot
417 $(NODEBUG) DEASSIGN ossl_installroot
418 $(NODEBUG) DEASSIGN internal
419 $(NODEBUG) DEASSIGN openssl
421 @ ! MMS cannot handle no actions...
423 # The main targets ###################################################
425 {- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep copy-utils
426 {- dependmagic('build_libs'); -} : build_libs_nodep
427 {- dependmagic('build_modules'); -} : build_modules_nodep
428 {- dependmagic('build_programs'); -} : build_programs_nodep
430 build_generated : $(GENERATED_MANDATORY)
431 build_libs_nodep : $(LIBS), $(SHLIBS)
432 build_modules_nodep : $(MODULES)
433 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
435 build_docs: build_html_docs
436 build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
438 # Kept around for backward compatibility
439 build_apps build_tests : build_programs
441 # Convenience target to prebuild all generated files, not just the mandatory
443 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
444 @ ! {- output_off() if $disabled{makedepend}; "" -}
445 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
446 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
447 @ WRITE SYS$OUTPUT " then make will fail..."
448 @ ! {- output_on() if $disabled{makedepend}; "" -}
450 all : build_sw build_docs
453 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep copy-utils
454 @ ! {- output_off() if $disabled{tests}; "" -}
455 DEFINE SRCTOP "$(SRCDIR)"
456 DEFINE BLDTOP "$(BLDDIR)"
457 DEFINE FIPSKEY "$(FIPSKEY)"
458 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
459 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
463 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
464 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
465 @ ! {- output_on() if !$disabled{tests}; "" -}
468 @ ! {- output_off() if $disabled{tests}; "" -}
469 @ DEFINE SRCTOP "$(SRCDIR)"
470 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
472 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
473 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
474 @ ! {- output_on() if !$disabled{tests}; "" -}
476 install : install_sw install_ssldirs install_docs install_msg
479 @ WRITE SYS$OUTPUT ""
480 @ WRITE SYS$OUTPUT "######################################################################"
481 @ WRITE SYS$OUTPUT ""
482 @ IF "$(DESTDIR)" .EQS. "" THEN -
483 @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}"
484 @ IF "$(DESTDIR)" .NES. "" THEN -
485 @{- sourcefile("VMS", "msg_staging.com") -} -
486 "''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" -
487 "$(SYSTARTUP)" "{- $osslver -}"
490 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
492 uninstall : uninstall_docs uninstall_sw
494 # Because VMS wants the generation number (or *) to delete files, we can't
495 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
497 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
498 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
501 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
502 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
503 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
504 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
505 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
506 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
507 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
508 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
509 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
510 - DELETE [...]*.MAP;*
512 - DELETE [...]*.OBJ;*,*.LIS;*
513 - DELETE []CXX$DEMANGLER_DB.;*
514 - DELETE [.VMS]openssl_startup.com;*
515 - DELETE [.VMS]openssl_shutdown.com;*
516 - DELETE []vmsconfig.pm;*
519 - DELETE configdata.pm;*
520 - DELETE descrip.mms;*
524 @ ! {- output_off() if $disabled{makedepend}; "" -}
525 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "VMS C"
526 @ ! {- output_on() if $disabled{makedepend}; "" -}
528 # Install helper targets #############################################
530 install_sw : install_dev install_engines install_modules -
531 install_runtime install_startup install_ivp
533 uninstall_sw : uninstall_dev uninstall_modules uninstall_engines -
534 uninstall_runtime uninstall_startup uninstall_ivp
536 install_docs : install_html_docs
538 uninstall_docs : uninstall_html_docs
540 install_fips: install_sw
541 @ WRITE SYS$OUTPUT "*** Installing FIPS module configuration"
542 @ WRITE SYS$OUTPUT "fipsinstall $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
543 openssl fipsinstall -
544 -module ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME) -
545 -out ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf -
546 -macopt "key:$(FIPSKEY)"
548 uninstall_fips: uninstall_sw
549 @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module configuration"
550 DELETE ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf;*
552 install_ssldirs : check_INSTALLTOP
553 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
554 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
555 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
556 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
557 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
558 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
559 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
560 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
561 @ ! Install configuration file
562 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
563 ossl_dataroot:[000000]openssl.cnf-dist
564 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
565 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
566 ossl_dataroot:[000000]openssl.cnf
567 @ ! Install CTLOG configuration file
568 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
569 ossl_dataroot:[000000]ct_log_list.cnf-dist
570 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
571 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
572 ossl_dataroot:[000000]ct_log_list.cnf
574 install_dev : check_INSTALLTOP install_runtime_libs
575 @ WRITE SYS$OUTPUT "*** Installing development files"
576 @ ! Install header files
577 - CREATE/DIR ossl_installroot:[include.openssl]
578 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
579 @ ! Install static (development) libraries
580 - CREATE/DIR ossl_installroot:[LIB.'arch']
582 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
585 install_engines : check_INSTALLTOP install_runtime_libs build_modules
586 @ {- output_off() unless scalar @install_engines; "" -} !
587 @ WRITE SYS$OUTPUT "*** Installing engines"
588 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
590 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
592 @ {- output_on() unless scalar @install_engines; "" -} !
594 install_modules : check_INSTALLTOP install_runtime_libs build_modules
595 @ {- output_off() unless scalar @install_modules; "" -} !
596 @ WRITE SYS$OUTPUT "*** Installing modules"
597 - CREATE/DIR ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']
599 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$sover_dirname$target{pointer_size}.'arch']" }
601 @ {- output_on() unless scalar @install_modules; "" -} !
603 install_runtime : install_programs
605 install_runtime_libs : check_INSTALLTOP build_libs
606 @ {- output_off() if $disabled{shared}; "" -} !
607 @ WRITE SYS$OUTPUT "*** Installing shareable images"
608 @ ! Install shared (runtime) libraries
609 - CREATE/DIR ossl_installroot:[LIB.'arch']
611 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
613 @ {- output_on() if $disabled{shared}; "" -} !
615 install_programs : check_INSTALLTOP install_runtime_libs build_programs
616 @ {- output_off() if $disabled{apps}; "" -} !
617 @ ! Install the main program
618 - CREATE/DIR ossl_installroot:[EXE.'arch']
619 COPY/PROT=W:RE [.APPS]openssl.EXE -
620 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
622 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
623 @ ! {- output_on() if $disabled{apps}; "" -}
625 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
626 [.VMS]openssl_utils.com, check_INSTALLTOP
627 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
628 COPY/PROT=W:RE [.VMS]openssl_startup.com -
629 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
630 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
631 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
632 COPY/PROT=W:RE [.VMS]openssl_utils.com -
633 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
635 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
636 - CREATE/DIR ossl_installroot:[SYSTEST]
637 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
638 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
640 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
642 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
643 {- sourcefile("VMS", "openssl_startup.com.in") -} -
644 > [.VMS]openssl_startup.com
646 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
648 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
649 {- sourcefile("VMS", "openssl_utils.com.in") -} -
650 > [.VMS]openssl_utils.com
652 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
654 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
655 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
656 > [.VMS]openssl_shutdown.com
658 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
660 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
661 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
662 > [.VMS]openssl_ivp.com
664 vmsconfig.pm : configdata.pm
665 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
666 WRITE CONFIG "package vmsconfig;"
667 WRITE CONFIG "use strict; use warnings;"
668 WRITE CONFIG "use Exporter;"
669 WRITE CONFIG "our @ISA = qw(Exporter);"
670 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
671 WRITE CONFIG "our %config = ("
672 WRITE CONFIG " target => '","{- $config{target} -}","',"
673 WRITE CONFIG " version => '","{- $config{version} -}","',"
674 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
675 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
676 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
677 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
678 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
679 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
680 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
682 WRITE CONFIG "our %target = ();"
683 WRITE CONFIG "our %disabled = ();"
684 WRITE CONFIG "our %withargs = ();"
685 WRITE CONFIG "our %unified_info = ();"
689 install_html_docs : check_INSTALLTOP build_html_docs
690 @ WRITE SYS$OUTPUT "*** Installing HTML docs"
691 - CREATE/DIR ossl_installroot:[HTML.MAN1]
692 - CREATE/DIR ossl_installroot:[HTML.MAN3]
693 - CREATE/DIR ossl_installroot:[HTML.MAN5]
694 - CREATE/DIR ossl_installroot:[HTML.MAN7]
696 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
697 @{$unified_info{htmldocs}->{man1}} ),
698 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
699 @{$unified_info{htmldocs}->{man3}} ),
700 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
701 @{$unified_info{htmldocs}->{man5}} ),
702 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
703 @{$unified_info{htmldocs}->{man7}} )) -}
706 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
707 WRITE SYS$ERROR "INSTALLTOP should not be empty"
708 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
711 # Helper targets #####################################################
713 copy-utils : [.util]wrap.pl
715 [.util]wrap.pl : configdata.pm
716 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
717 CREATE/DIR/LOG [.util]
718 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
719 COPY/LOG ossl_sourceroot:[util]wrap.pl [.util]
721 # Developer targets ##################################################
724 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
726 # Building targets ###################################################
728 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
729 perl configdata.pm -r
730 @ WRITE SYS$OUTPUT "*************************************************"
731 @ WRITE SYS$OUTPUT "*** ***"
732 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
733 @ WRITE SYS$OUTPUT "*** ***"
734 @ WRITE SYS$OUTPUT "*************************************************"
735 @ PIPE ( EXIT %X10000000 )
738 perl configdata.pm -r
742 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
744 # Helper function to figure out dependencies on libraries
745 # It takes a list of library names and outputs a list of dependencies
746 sub compute_lib_depends {
747 # Depending on shared libraries:
748 # On Windows POSIX layers, we depend on {libname}.dll.a
749 # On Unix platforms, we depend on {shlibname}.so
751 { lib => platform->sharedlib($_) // platform->staticlib($_),
752 attrs => $unified_info{attributes}->{libraries}->{$_} }
756 # Helper function to deal with inclusion directory specs.
757 # We have to deal with two things:
758 # 1. comma separation and no possibility of trailing comma
759 # 2. no inclusion directories given at all
760 # 3. long compiler command lines
761 # To resolve 1, we need to iterate through the sources of inclusion
762 # directories, and only add a comma when needed.
763 # To resolve 2, we need to have a variable that will hold the whole
764 # inclusion qualifier, or be the empty string if there are no inclusion
765 # directories. That's the symbol 'qual_includes' that's used in CPPFLAGS
766 # To resolve 3, we creata a logical name TMP_INCLUDES: to hold the list
767 # of inclusion directories.
769 # This function returns a list of two lists, one being the collection of
770 # commands to execute before the compiler is called, and the other being
771 # the collection of commands to execute after. It takes as arguments the
772 # collection of strings to include as directory specs.
779 'DELETE/SYMBOL/LOCAL qual_includes',
782 if (scalar @stuff > 0) {
783 push @before, 'tmp_includes := '.shift(@stuff);
785 push @before, 'tmp_add := '.shift(@stuff);
786 push @before, 'IF tmp_includes .NES. "" .AND. tmp_add .NES. "" THEN tmp_includes = tmp_includes + ","';
787 push @before, 'tmp_includes = tmp_includes + tmp_add';
789 push @before, "IF tmp_includes .NES. \"\" THEN DEFINE tmp_includes 'tmp_includes'";
790 push @before, 'IF tmp_includes .NES. "" THEN qual_includes := /INCLUDE=(tmp_includes:)';
791 push @before, 'DELETE/SYMBOL/LOCAL tmp_includes';
792 push @before, 'DELETE/SYMBOL/LOCAL tmp_add';
793 push @after, 'DEASSIGN tmp_includes:'
795 return ([ @before ], [ @after ]);
800 my $generator = join(" ", @{$args{generator}});
801 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
802 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
804 if ($args{src} =~ /\.html$/) {
805 my $title = basename($args{src}, ".html");
806 my $pod = $args{generator}->[0];
807 my $mkpod2html = sourcefile('util', 'mkpod2html.pl');
810 \$(PERL) $mkpod2html -i $pod -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
812 } elsif (platform->isdef($args{src})) {
813 my $target = platform->def($args{src});
814 my $mkdef = sourcefile('util', 'mkdef.pl');
815 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
817 $args{generator}->[1] || basename($args{product}, '.EXE');
818 my $case_insensitive =
819 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
820 ? '' : ' --case-insensitive';
822 $target : $args{generator}->[0] $deps $mkdef
823 \$(PERL) $mkdef$ord_ver --ordinals $args{generator}->[0] --name $ord_name "--OS" "VMS"$case_insensitive > $target
825 } elsif (!platform->isasm($args{src})) {
826 my $target = $args{src};
827 if ($args{generator}->[0] =~ m|^.*\.in$|) {
828 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
829 "util", "dofile.pl")),
830 rel2abs($config{builddir}));
831 my @modules = ( 'configdata.pm',
832 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
833 my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
834 @modules = map { '"-M'.basename($_, '.pm').'"' } @modules;
835 my $modules = join(' ', '', sort keys %moduleincs, @modules);
837 $target : $args{generator}->[0] $deps
838 \$(PERL)$modules $dofile "-o$target{build_file}" $generator > \$\@
842 $target : $args{generator}->[0] $deps
843 \$(PERL)$generator_incs $generator > \$\@
848 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
849 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
850 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
851 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
852 } -> {$args{intent}};
853 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
854 lib => '$(LIB_INCLUDES)',
855 dso => '$(DSO_INCLUDES)',
856 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
860 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
861 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
862 my $defs = join("", map { ",".$_ } @{$args{defs}});
863 my $target = platform->asm($args{src});
865 if ($args{generator}->[0] =~ /\.pl$/) {
866 $generator = '$(PERL)'.$generator_incs.' '.$generator
868 } elsif ($args{generator}->[0] =~ /\.S$/) {
871 die "Generator type for $src unknown: $generator\n";
874 if (defined($generator)) {
875 # If the target is named foo.S in build.info, we want to
876 # end up generating foo.s in two steps.
877 if ($args{src} =~ /\.S$/) {
879 $target : $args{generator}->[0] $deps
882 \@ extradefines = "$defs"
883 PIPE \$(CPP) $cppflags \$\@-S | -
884 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
885 \@ DELETE/SYMBOL/LOCAL extradefines
893 $target : $args{generator}->[0] $deps
895 \@ extradefines = "$defs"
897 \@ DELETE/SYMBOL/LOCAL extradefines
902 $target : $args{generator}->[0] $deps
904 \@ extradefines = "$defs"
905 SHOW SYMBOL qual_includes
906 PIPE \$(CPP) $cppflags $args{generator}->[0] | -
907 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
908 \@ DELETE/SYMBOL/LOCAL extradefines
915 my $asmext = platform->asmext();
919 (platform->isasm($x) && grep { $x eq $_ } @generated)
920 ? platform->asm($x) : $x }
922 my $obj = platform->obj($args{obj});
923 my $dep = platform->dep($args{obj});
924 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
926 # Because VMS C isn't very good at combining a /INCLUDE path with
927 # #includes having a relative directory (like '#include "../foo.h"),
928 # the best choice is to move to the first source file's intended
929 # directory before compiling, and make sure to write the object file
930 # in the correct position (important when the object tree is other
931 # than the source tree).
932 my $forward = dirname($args{srcs}->[0]);
933 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
934 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
935 my $objn = basename($obj);
936 my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
937 my $depn = basename($dep);
939 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
940 my $before = $unified_info{before}->{$obj} || "\@ !";
941 my $after = $unified_info{after}->{$obj} || "\@ !";
944 if ($args{attrs}->{noinst}) {
945 $cflags = { shlib => '$(NO_INST_LIB_CFLAGS)',
946 lib => '$(NO_INST_LIB_CFLAGS)',
947 dso => '$(NO_INST_DSO_CFLAGS)',
948 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
950 $cflags = { shlib => '$(LIB_CFLAGS)',
951 lib => '$(LIB_CFLAGS)',
952 dso => '$(DSO_CFLAGS)',
953 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
955 $cflags .= { shlib => '$(LIB_CPPFLAGS)',
956 lib => '$(LIB_CPPFLAGS)',
957 dso => '$(DSO_CPPFLAGS)',
958 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
959 my $defs = join("", map { ",".$_ } @{$args{defs}});
960 my $asflags = { shlib => ' $(LIB_ASFLAGS)',
961 lib => ' $(LIB_ASFLAGS)',
962 dso => ' $(DSO_ASFLAGS)',
963 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
965 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
966 lib => '$(LIB_INCLUDES)',
967 dso => '$(DSO_INCLUDES)',
968 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
971 file_name_is_absolute($_)
972 ? $_ : catdir($backward,$_)
974 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
975 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
977 if ($srcs[0] =~ /\Q${asmext}\E$/) {
982 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn} $srcs
983 SET DEFAULT $backward
987 } elsif ($srcs[0] =~ /.S$/) {
993 \@ extradefines = "$defs"
994 PIPE \$(CPP) ${cflags} $srcs | -
995 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
997 \@ DELETE/SYMBOL/LOCAL extradefines
999 SET DEFAULT $backward
1001 \$(AS) $asflags \$(ASOUTFLAG)$obj $obj-asm
1006 my $depbuild = $disabled{makedepend} ? ""
1007 : " /MMS=(FILE=${depd}${depn},TARGET=$obj)";
1012 SET DEFAULT $forward
1014 \@ extradefines = "$defs"
1015 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn} /REPOSITORY=$backward $srcs
1016 \@ DELETE/SYMBOL/LOCAL extradefines
1018 SET DEFAULT $backward
1025 my $shlibname = platform->sharedname($args{lib});
1026 my $shlib = platform->sharedlib($args{lib});
1027 my @objs = map { platform->convertext($_) }
1028 grep { platform->isobj($_) }
1030 my @defs = map { platform->convertext($_) }
1031 grep { platform->isdef($_) }
1033 my @deps = compute_lib_depends(@{$args{deps}});
1034 die "More than one symbol vector" if scalar @defs > 1;
1035 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1036 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1037 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
1038 "VMS", "translatesyms.pl")),
1039 rel2abs($config{builddir}));
1040 # The "[]" hack is because in .OPT files, each line inherits the
1041 # previous line's file spec as default, so if no directory spec
1042 # is present in the current line and the previous line has one that
1043 # doesn't apply, you're in for a surprise.
1045 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1046 "WRITE OPT_FILE \"$x" } @objs).
1049 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1050 ? $_->{lib} : "[]".$_->{lib};
1051 $x =~ s|(\.EXE)|$1/SHARE|;
1052 $x =~ s|(\.OLB)|$1/LIB|;
1053 "WRITE OPT_FILE \"$x\"" } @deps)
1057 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
1058 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
1062 LINK \$(LIB_LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
1063 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1064 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1065 PURGE $shlibname.EXE,$shlibname.MAP
1067 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1068 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1074 my $dsoname = platform->dsoname($args{module});
1075 my $dso = platform->dso($args{module});
1076 my @objs = map { platform->convertext($_) }
1077 grep { platform->isobj($_) }
1079 my @defs = map { platform->convertext($_) }
1080 grep { platform->isdef($_) }
1082 my @deps = compute_lib_depends(@{$args{deps}});
1083 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1084 die "More than one symbol vector" if scalar @defs > 1;
1085 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1086 # The "[]" hack is because in .OPT files, each line inherits the
1087 # previous line's file spec as default, so if no directory spec
1088 # is present in the current line and the previous line has one that
1089 # doesn't apply, you're in for a surprise.
1091 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1092 "WRITE OPT_FILE \"$x" } @objs).
1095 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1096 ? $_->{lib} : "[]".$_->{lib};
1097 $x =~ s|(\.EXE)|$1/SHARE|;
1098 $x =~ s|(\.OLB)|$1/LIB|;
1099 "WRITE OPT_FILE \"$x\"" } @deps)
1103 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1107 LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $defs[0]/OPT,-
1108 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1109 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1111 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1112 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1118 my $lib = platform->staticlib($args{lib});
1119 my @objs = map { platform->convertext($_) }
1120 grep { platform->isobj($_) }
1122 my $objs = join(", -\n\t\t", @objs);
1123 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1126 LIBRARY/CREATE/OBJECT $lib
1133 my $bin = platform->bin($args{bin});
1134 my $binname = platform->binname($args{bin});
1135 my @objs = map { platform->convertext($_) }
1136 grep { platform->isobj($_) }
1138 my $objs = join(",", @objs);
1139 my @deps = compute_lib_depends(@{$args{deps}});
1140 my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1142 my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1143 my $analyse_objs = "@ !";
1144 if ($olb_count > 0) {
1146 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1147 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1149 # The "[]" hack is because in .OPT files, each line inherits the
1150 # previous line's file spec as default, so if no directory spec
1151 # is present in the current line and the previous line has one that
1152 # doesn't apply, you're in for a surprise.
1154 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1155 "\@ WRITE OPT_FILE \"$x" } @objs).
1158 join("\n\t", "WRITE OPT_FILE \"CASE_SENSITIVE=YES\"",
1159 map { my @lines = ();
1161 my $x = $_->{lib} =~ /\[/
1162 ? $_->{lib} : "[]".$_->{lib};
1163 if ($x =~ m|\.EXE$|) {
1164 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1165 } elsif ($x =~ m|\.OLB$|) {
1166 # Special hack to include the MAIN object
1167 # module explicitly. This will only be done
1168 # if there isn't a 'main' in the program's
1169 # object modules already.
1170 my $main = $_->{attrs}->{has_main}
1171 ? '/INCLUDE=main' : '';
1173 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB$main\"",
1174 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1179 # The linking commands looks a bit complex, but it's for good reason.
1180 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1181 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1182 # the linker will warn about it, loudly, and will then choose to pick
1183 # the first copy encountered (the one in bar.obj in this example).
1184 # On Unix and on Windows, the corresponding maneuvre goes through
1185 # silently with the same effect.
1186 # With some test programs, made for checking the internals of OpenSSL,
1187 # we do this kind of linking deliberately, picking a few specific object
1188 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1189 # otherwise unreachable (since the shareable images only exports the
1190 # symbols listed in [.util]*.num), and then with the shared libraries
1191 # themselves. So we need to silence the warning about multiply defined
1192 # symbols, to mimic the way linking work on Unix and Windows, and so
1193 # the build isn't interrupted (MMS stops when warnings are signaled,
1194 # by default), and so someone building doesn't have to worry where it
1195 # isn't necessary. If there are other warnings, however, we show them
1196 # and let it break the build.
1200 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1204 TYPE $binname.OPT ! For debugging
1205 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1206 LINK \$(BIN_LDFLAGS)/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1207 link_status = \$status ; link_severity = link_status .AND. 7
1208 @ search_severity = 1
1209 -@ IF link_severity .EQ. 0 THEN -
1210 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1211 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1212 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1213 search_severity = \$severity
1214 @ ! search_severity is 3 when the last search didn't find any matching
1215 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1216 @ ! If that was the result, we pretend linking got through without
1217 @ ! fault or warning.
1218 @ IF search_severity .EQ. 3 THEN link_severity = 1
1219 @ ! At this point, if link_severity shows that there was a fault
1220 @ ! or warning, make sure to restore the linking status.
1221 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1222 -@ DELETE $binname.LINKLOG;*
1223 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1224 - PURGE $bin,$binname.OPT
1226 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1227 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1233 my $script = $args{script};
1234 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1235 my $sources = join(" ", @{$args{sources}});
1236 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1237 "util", "dofile.pl")),
1238 rel2abs($config{builddir}));
1241 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1242 "-o$target{build_file}" $sources > $script
1243 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1247 "" # Important! This becomes part of the template result.