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 my $b = abs2rel(rel2abs("."),rel2abs($f));
34 $sourcedir = catdir($b,$sourcedir)
35 if !file_name_is_absolute($sourcedir);
36 $builddir = catdir($b,$builddir)
37 if !file_name_is_absolute($builddir);
41 # Because we need to make two computations of these data,
42 # we store them in arrays for reuse
44 map { platform->staticname($_) }
45 @{$unified_info{libraries}};
47 map { platform->sharedname($_) // () }
48 @{$unified_info{libraries}};
50 map { platform->staticname($_) }
51 grep { !$unified_info{attributes}->{$_}->{noinst} }
52 @{$unified_info{libraries}};
54 map { platform->sharedname($_) // () }
55 grep { !$unified_info{attributes}->{$_}->{noinst} }
56 @{$unified_info{libraries}};
57 our @install_engines =
58 grep { !$unified_info{attributes}->{$_}->{noinst}
59 && $unified_info{attributes}->{$_}->{engine} }
60 @{$unified_info{modules}};
61 our @install_programs =
62 grep { !$unified_info{attributes}->{$_}->{noinst} }
63 @{$unified_info{programs}};
64 our @install_bin_scripts =
65 grep { !$unified_info{attributes}->{$_}->{noinst}
66 && !$unified_info{attributes}->{$_}->{misc} }
67 @{$unified_info{scripts}};
68 our @install_misc_scripts =
69 grep { !$unified_info{attributes}->{$_}->{noinst}
70 && $unified_info{attributes}->{$_}->{misc} }
71 @{$unified_info{scripts}};
73 # This is a horrible hack, but is needed because recursive inclusion of files
74 # in different directories does not work well with HP C.
75 my $sd = sourcedir("crypto", "async", "arch");
76 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
77 my $obj = platform->obj($_);
78 $unified_info{before}->{$obj}
79 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
80 define arch 'arch_include');
81 $unified_info{after}->{$obj}
84 my $sd1 = sourcedir("ssl","record");
85 my $sd2 = sourcedir("ssl","statem");
86 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
87 keys %{$unified_info{sources}});
88 foreach (@ssl_locl_users) {
89 my $obj = platform->obj($_);
90 $unified_info{before}->{$obj}
91 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
92 define record 'record_include'
93 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
94 define statem 'statem_include');
95 $unified_info{after}->{$obj}
99 # This makes sure things get built in the order they need
100 # to. You're welcome.
104 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
108 PLATFORM={- $config{target} -}
109 OPTIONS={- $config{options} -}
110 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
111 SRCDIR={- $config{sourcedir} -}
112 BLDDIR={- $config{builddir} -}
114 # Allow both V and VERBOSE to indicate verbosity. This only applies
118 VERSION={- "$config{full_version}" -}
119 MAJOR={- $config{major} -}
120 MINOR={- $config{minor} -}
121 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
122 SHLIB_TARGET={- $target{shared_target} -}
124 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
125 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
126 MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{modules}}) -}
127 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
128 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
129 {- output_off() if $disabled{makedepend}; "" -}
130 DEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ }
131 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
132 keys %{$unified_info{sources}};
133 join(", ", map { "-\n\t".$_ } @deps); -}
134 {- output_on() if $disabled{makedepend}; "" -}
135 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
136 GENERATED={- # common0.tmpl provides @generated
137 join(", ", map { platform->convertext($_) } @generated) -}
139 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
140 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
141 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
142 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
143 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
144 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
146 APPS_OPENSSL={- use File::Spec::Functions;
147 catfile("apps","openssl") -}
149 # DESTDIR is for package builders so that they can configure for, say,
150 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
151 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
152 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
153 # STAGING:[USER.OPENSSL].
154 # Normally it is left empty.
157 # Do not edit this manually. Use Configure --prefix=DIR to change this!
158 INSTALLTOP={- our $installtop =
159 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
161 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
162 # This is the standard central area to store certificates, private keys...
163 OPENSSLDIR={- catdir($config{openssldir}) or
164 $config{prefix} ? catdir($config{prefix},"COMMON")
165 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
166 # The same, but for C
167 OPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000]
168 # Where installed ENGINE modules reside, for C
169 ENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
171 ##### User defined commands and flags ################################
174 CPP={- $config{CPP} -}
175 DEFINES={- our $defines1 = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
176 INCLUDES={- our $includes1 = join(',', @{$config{CPPINCLUDES}}) -}
177 CPPFLAGS={- our $cppflags1 = join('', @{$config{CPPFLAGS}}) -}
178 CFLAGS={- join('', @{$config{CFLAGS}}) -}
179 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
180 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
182 PERL={- $config{PERL} -}
185 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
187 ##### Special command flags ##########################################
189 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
191 ##### Project flags ##################################################
193 # Variables starting with CNF_ are common variables for all product types
195 CNF_ASFLAGS={- join('', $target{asflags} || (),
196 @{$config{asflags}}) -}
197 CNF_DEFINES={- our $defines2 = join('', (map { ",$_" } @{$target{defines}},
198 @{$config{defines}}),
200 CNF_INCLUDES={- our $includes2 = join(',', @{$target{includes}},
201 @{$config{includes}}) -}
202 CNF_CPPFLAGS={- our $cppflags2 = join('', $target{cppflags} || (),
203 @{$config{cppflags}}) -}
204 CNF_CFLAGS={- join('', $target{cflags} || (),
205 @{$config{cflags}}) -}
206 CNF_CXXFLAGS={- join('', $target{cxxflags} || (),
207 @{$config{cxxflags}}) -}
208 CNF_LDFLAGS={- join('', $target{lflags} || (),
209 @{$config{lflags}}) -}
210 CNF_EX_LIBS={- join('', map{ ",$_" } @{$target{ex_libs}},
211 @{$config{ex_libs}}) -}
213 # Variables starting with LIB_ are used to build library object files
214 # and shared libraries.
215 # Variables starting with DSO_ are used to build DSOs and their object files.
216 # Variables starting with BIN_ are used to build programs and their object
219 LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (),
220 @{$config{lib_asflags}},
221 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
222 LIB_DEFINES={- our $lib_defines =
223 join('', (map { ",$_" } @{$target{lib_defines}},
224 @{$target{shared_defines}},
225 @{$config{lib_defines}},
226 @{$config{shared_defines}}));
227 join('', $lib_defines,
228 (map { ",$_" } 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
229 'ENGINESDIR="""$(ENGINESDIR_C)"""'),
230 '$(CNF_DEFINES)', '$(DEFINES)') -}
231 LIB_INCLUDES={- our $lib_includes =
232 join(',', @{$target{lib_includes}},
233 @{$target{shared_includes}},
234 @{$config{lib_includes}},
235 @{$config{shared_includes}}) -}
236 LIB_CPPFLAGS={- our $lib_cppflags =
237 join('', $target{lib_cppflags} || (),
238 $target{shared_cppflags} || (),
239 @{$config{lib_cppflags}},
240 @{$config{shared_cppflag}});
241 join('', "'qual_includes'",
242 '/DEFINE=(__dummy$(LIB_DEFINES))',
244 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
245 LIB_CFLAGS={- join('', $target{lib_cflags} || (),
246 $target{shared_cflag} || (),
247 @{$config{lib_cflags}},
248 @{$config{shared_cflag}},
249 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
250 LIB_LDFLAGS={- join('', $target{lib_lflags} || (),
251 $target{shared_ldflag} || (),
252 @{$config{lib_lflags}},
253 @{$config{shared_ldflag}},
254 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
255 LIB_EX_LIBS=$(CNF_EX_LIBS)$(EX_LIBS)
256 DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (),
257 $target{module_asflags} || (),
258 @{$config{dso_asflags}},
259 @{$config{module_asflags}},
260 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
261 DSO_DEFINES={- join('', (map { ",$_" } @{$target{dso_defines}},
262 @{$target{module_defines}},
263 @{$config{dso_defines}},
264 @{$config{module_defines}}),
265 '$(CNF_DEFINES)', '$(DEFINES)') -}
266 DSO_INCLUDES={- join(',', @{$target{dso_includes}},
267 @{$target{module_includes}},
268 @{$config{dso_includes}},
269 @{$config{module_includes}}) -}
270 DSO_CPPFLAGS={- join('', "'qual_includes'",
271 '/DEFINE=(__dummy$(DSO_DEFINES))',
272 $target{dso_cppflags} || (),
273 $target{module_cppflags} || (),
274 @{$config{dso_cppflags}},
275 @{$config{module_cppflags}},
276 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
277 DSO_CFLAGS={- join('', $target{dso_cflags} || (),
278 $target{module_cflags} || (),
279 @{$config{dso_cflags}},
280 @{$config{module_cflags}},
281 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
282 DSO_LDFLAGS={- join('', $target{dso_lflags} || (),
283 $target{module_ldflags} || (),
284 @{$config{dso_lflags}},
285 @{$config{module_ldflags}},
286 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
287 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
288 BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
289 @{$config{bin_asflags}},
290 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
291 BIN_DEFINES={- join('', (map { ",$_" } @{$target{bin_defines}},
292 @{$config{bin_defines}}),
293 '$(CNF_DEFINES)', '$(DEFINES)') -}
294 BIN_INCLUDES={- join(',', @{$target{bin_includes}},
295 @{$config{bin_includes}}) -}
296 BIN_CPPFLAGS={- join('', "'qual_includes'",
297 '/DEFINE=(__dummy$(DSO_DEFINES))',
298 $target{bin_cppflags} || (),
299 @{$config{bin_cppflag}},
300 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
301 BIN_CFLAGS={- join('', $target{bin_cflags} || (),
302 @{$config{bin_cflags}},
303 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
304 BIN_LDFLAGS={- join('', $target{bin_lflags} || (),
305 @{$config{bin_lflags}} || (),
306 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
307 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
308 NO_INST_LIB_CFLAGS={- join('', $target{no_inst_lib_cflags}
309 // $target{lib_cflags}
311 $target{shared_cflag} || (),
312 @{$config{lib_cflags}},
313 @{$config{shared_cflag}},
314 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
315 NO_INST_DSO_CFLAGS={- join('', $target{no_inst_dso_cflags}
316 // $target{dso_cflags}
318 $target{no_inst_module_cflags}
319 // $target{module_cflags}
321 @{$config{dso_cflags}},
322 @{$config{module_cflags}},
323 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
324 NO_INST_BIN_CFLAGS={- join('', $target{no_inst_bin_cflags}
325 // $target{bin_cflags}
327 @{$config{bin_cflags}},
328 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
330 PERLASM_SCHEME={- $target{perlasm_scheme} -}
332 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
333 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags2.$cppflags1) =~ s|"|""|g;
334 (my $d = $lib_defines.$defines2.$defines1) =~ s|"|""|g;
335 my $i = join(',', $lib_includes || (), $includes2 || (),
338 $x .= "/INCLUDE=($i)" if $i;
339 $x .= "/DEFINE=($d)" if $d;
342 # .FIRST and .LAST are special targets with MMS and MMK.
343 # The defines in there are for C. includes that look like
346 # #include <openssl/foo.h>
347 # #include "internal/bar.h"
349 # will use the logical names to find the files. Expecting
350 # DECompHP C to find files in subdirectories of whatever was
351 # given with /INCLUDE is a fantasy, unfortunately.
354 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
355 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
356 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
357 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
358 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
359 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
360 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
361 $(NODEBUG) staging_dir = "$(DESTDIR)"
362 $(NODEBUG) staging_instdir = ""
363 $(NODEBUG) staging_datadir = ""
364 $(NODEBUG) IF staging_dir .NES. "" THEN -
365 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
366 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
367 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
368 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
369 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
370 $(NODEBUG) IF staging_dir .NES. "" THEN -
371 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
372 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
373 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
374 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
375 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
377 $(NODEBUG) ! Installation logical names
379 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
380 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
381 $(NODEBUG) DEFINE ossl_installroot 'installtop'
382 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
384 $(NODEBUG) ! Figure out the architecture
386 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
388 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
389 $(NODEBUG) ! running programs can use them.
391 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
394 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
395 $(NODEBUG) DEASSIGN ossl_dataroot
396 $(NODEBUG) DEASSIGN ossl_installroot
397 $(NODEBUG) DEASSIGN internal
398 $(NODEBUG) DEASSIGN openssl
400 @ ! MMS cannot handle no actions...
402 # The main targets ###################################################
404 {- dependmagic('all'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
405 {- dependmagic('build_libs'); -} : build_libs_nodep
406 {- dependmagic('build_modules'); -} : build_modules_nodep
407 {- dependmagic('build_programs'); -} : build_programs_nodep
409 build_generated : $(GENERATED_MANDATORY)
410 build_libs_nodep : $(LIBS), $(SHLIBS)
411 build_modules_nodep : $(MODULES)
412 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
414 # Kept around for backward compatibility
415 build_apps build_tests : build_programs
417 # Convenience target to prebuild all generated files, not just the mandatory
419 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
420 @ ! {- output_off() if $disabled{makedepend}; "" -}
421 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
422 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
423 @ WRITE SYS$OUTPUT " then make will fail..."
424 @ ! {- output_on() if $disabled{makedepend}; "" -}
427 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep
428 @ ! {- output_off() if $disabled{tests}; "" -}
429 SET DEFAULT [.test]{- move("test") -}
430 CREATE/DIR [.test-runs]
431 DEFINE SRCTOP {- sourcedir() -}
432 DEFINE BLDTOP {- builddir() -}
433 DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
434 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
435 DEFINE OPENSSL_DEBUG_MEMORY "on"
436 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
437 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
438 DEASSIGN OPENSSL_DEBUG_MEMORY
439 DEASSIGN OPENSSL_ENGINES
442 SET DEFAULT [-]{- move("..") -}
443 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
444 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
445 @ ! {- output_on() if !$disabled{tests}; "" -}
448 @ ! {- output_off() if $disabled{tests}; "" -}
449 @ DEFINE SRCTOP {- sourcedir() -}
450 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
452 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
453 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
454 @ ! {- output_on() if !$disabled{tests}; "" -}
456 install : install_sw install_ssldirs install_docs
457 @ WRITE SYS$OUTPUT ""
458 @ WRITE SYS$OUTPUT "######################################################################"
459 @ WRITE SYS$OUTPUT ""
460 @ IF "$(DESTDIR)" .EQS. "" THEN -
461 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
462 WRITE SYS$OUTPUT "" ; -
463 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
464 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
465 WRITE SYS$OUTPUT "" )
466 @ IF "$(DESTDIR)" .NES. "" THEN -
467 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
468 WRITE SYS$OUTPUT "" ; -
469 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
470 WRITE SYS$OUTPUT staging_instdir ; -
471 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
472 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
473 WRITE SYS$OUTPUT staging_datadir ; -
474 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
475 WRITE SYS$OUTPUT "" ; -
476 WRITE SYS$OUTPUT "When in its final destination," ; -
477 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
478 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
479 WRITE SYS$OUTPUT "" )
482 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
484 uninstall : uninstall_docs uninstall_sw
486 # Because VMS wants the generation number (or *) to delete files, we can't
487 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
489 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
490 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
493 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
494 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
495 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
496 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
497 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
498 - DELETE [...]*.MAP;*
500 - DELETE [...]*.OBJ;*,*.LIS;*
501 - DELETE []CXX$DEMANGLER_DB.;*
502 - DELETE [.VMS]openssl_startup.com;*
503 - DELETE [.VMS]openssl_shutdown.com;*
504 - DELETE []vmsconfig.pm;*
507 - DELETE configdata.pm;*
508 - DELETE descrip.mms;*
512 @ ! {- output_off() if $disabled{makedepend}; "" -}
513 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "VMS C"
514 @ ! {- output_on() if $disabled{makedepend}; "" -}
516 # Install helper targets #############################################
518 install_sw : install_dev install_engines install_runtime -
519 install_startup install_ivp
521 uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime -
522 uninstall_startup uninstall_ivp
524 install_docs : install_html_docs
526 uninstall_docs : uninstall_html_docs
528 install_ssldirs : check_INSTALLTOP
529 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
530 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
531 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
532 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
533 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
534 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
535 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
536 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
537 @ ! Install configuration file
538 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
539 ossl_dataroot:[000000]openssl.cnf-dist
540 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
541 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
542 ossl_dataroot:[000000]openssl.cnf
543 @ ! Install CTLOG configuration file
544 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
545 ossl_dataroot:[000000]ct_log_list.cnf-dist
546 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
547 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
548 ossl_dataroot:[000000]ct_log_list.cnf
550 install_dev : check_INSTALLTOP install_runtime_libs
551 @ WRITE SYS$OUTPUT "*** Installing development files"
552 @ ! Install header files
553 - CREATE/DIR ossl_installroot:[include.openssl]
554 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
555 @ ! Install static (development) libraries
556 - CREATE/DIR ossl_installroot:[LIB.'arch']
558 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
561 install_engines : check_INSTALLTOP install_runtime_libs build_modules
562 @ {- output_off() unless scalar @install_engines; "" -} !
563 @ WRITE SYS$OUTPUT "*** Installing ENGINE modules"
564 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
566 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
568 @ {- output_on() unless scalar @install_engines; "" -} !
570 install_runtime : install_programs
572 install_runtime_libs : check_INSTALLTOP build_libs
573 @ {- output_off() if $disabled{shared}; "" -} !
574 @ WRITE SYS$OUTPUT "*** Installing shareable images"
575 @ ! Install shared (runtime) libraries
576 - CREATE/DIR ossl_installroot:[LIB.'arch']
578 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
580 @ {- output_on() if $disabled{shared}; "" -} !
582 install_programs : check_INSTALLTOP install_runtime_libs build_programs
583 @ {- output_off() if $disabled{apps}; "" -} !
584 @ ! Install the main program
585 - CREATE/DIR ossl_installroot:[EXE.'arch']
586 COPY/PROT=W:RE [.APPS]openssl.EXE -
587 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
589 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
590 @ ! {- output_on() if $disabled{apps}; "" -}
592 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
593 [.VMS]openssl_utils.com, check_INSTALLTOP
594 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
595 COPY/PROT=W:RE [.VMS]openssl_startup.com -
596 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
597 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
598 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
599 COPY/PROT=W:RE [.VMS]openssl_utils.com -
600 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
602 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
603 - CREATE/DIR ossl_installroot:[SYSTEST]
604 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
605 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
607 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
609 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
610 {- sourcefile("VMS", "openssl_startup.com.in") -} -
611 > [.VMS]openssl_startup.com
613 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
615 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
616 {- sourcefile("VMS", "openssl_utils.com.in") -} -
617 > [.VMS]openssl_utils.com
619 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
621 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
622 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
623 > [.VMS]openssl_shutdown.com
625 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
627 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
628 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
629 > [.VMS]openssl_ivp.com
631 vmsconfig.pm : configdata.pm
632 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
633 WRITE CONFIG "package vmsconfig;"
634 WRITE CONFIG "use strict; use warnings;"
635 WRITE CONFIG "use Exporter;"
636 WRITE CONFIG "our @ISA = qw(Exporter);"
637 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
638 WRITE CONFIG "our %config = ("
639 WRITE CONFIG " target => '","{- $config{target} -}","',"
640 WRITE CONFIG " version => '","{- $config{version} -}","',"
641 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
642 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
643 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
644 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
645 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
646 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
647 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
649 WRITE CONFIG "our %target = ();"
650 WRITE CONFIG "our %disabled = ();"
651 WRITE CONFIG "our %withargs = ();"
652 WRITE CONFIG "our %unified_info = ();"
656 install_html_docs : check_INSTALLTOP
657 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
658 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
659 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
663 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
664 WRITE SYS$ERROR "INSTALLTOP should not be empty"
665 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
668 # Helper targets #####################################################
670 # Developer targets ##################################################
673 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
675 # Building targets ###################################################
677 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
678 perl configdata.pm -r
679 @ WRITE SYS$OUTPUT "*************************************************"
680 @ WRITE SYS$OUTPUT "*** ***"
681 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
682 @ WRITE SYS$OUTPUT "*** ***"
683 @ WRITE SYS$OUTPUT "*************************************************"
684 @ PIPE ( EXIT %X10000000 )
687 perl configdata.pm -r
691 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
693 # Helper function to figure out dependencies on libraries
694 # It takes a list of library names and outputs a list of dependencies
695 sub compute_lib_depends {
696 # Depending on shared libraries:
697 # On Windows POSIX layers, we depend on {libname}.dll.a
698 # On Unix platforms, we depend on {shlibname}.so
700 { lib => platform->sharedlib($_) // platform->staticlib($_),
701 attrs => $unified_info{attributes}->{$_} }
705 # Helper function to deal with inclusion directory specs.
706 # We have to deal with two things:
707 # 1. comma separation and no possibility of trailing comma
708 # 2. no inclusion directories given at all
709 # 3. long compiler command lines
710 # To resolve 1, we need to iterate through the sources of inclusion
711 # directories, and only add a comma when needed.
712 # To resolve 2, we need to have a variable that will hold the whole
713 # inclusion qualifier, or be the empty string if there are no inclusion
714 # directories. That's the symbol 'qual_includes' that's used in CPPFLAGS
715 # To resolve 3, we creata a logical name TMP_INCLUDES: to hold the list
716 # of inclusion directories.
718 # This function returns a list of two lists, one being the collection of
719 # commands to execute before the compiler is called, and the other being
720 # the collection of commands to execute after. It takes as arguments the
721 # collection of strings to include as directory specs.
728 'DELETE/SYMBOL/LOCAL qual_includes',
731 if (scalar @stuff > 0) {
732 push @before, 'tmp_includes := '.shift(@stuff);
734 push @before, 'tmp_add := '.shift(@stuff);
735 push @before, 'IF tmp_includes .NES. "" .AND. tmp_add .NES. "" THEN tmp_includes = tmp_includes + ","';
736 push @before, 'tmp_includes = tmp_includes + tmp_add';
738 push @before, "IF tmp_includes .NES. \"\" THEN DEFINE tmp_includes 'tmp_includes'";
739 push @before, 'IF tmp_includes .NES. "" THEN qual_includes := /INCLUDE=(tmp_includes:)';
740 push @before, 'DELETE/SYMBOL/LOCAL tmp_includes';
741 push @before, 'DELETE/SYMBOL/LOCAL tmp_add';
742 push @after, 'DEASSIGN tmp_includes:'
744 return ([ @before ], [ @after ]);
749 my $generator = join(" ", @{$args{generator}});
750 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
751 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
753 if (platform->isdef($args{src})) {
754 my $target = platform->def($args{src});
755 my $mkdef = sourcefile('util', 'mkdef.pl');
756 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
758 $args{generator}->[1] || basename($args{product}, '.EXE');
759 my $case_insensitive =
760 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
761 ? '' : ' --case-insensitive';
763 $target : $args{generator}->[0] $deps $mkdef
764 \$(PERL) $mkdef$ord_ver --ordinals $args{generator}->[0] --name $ord_name "--OS" "VMS"$case_insensitive > $target
766 } elsif (!platform->isasm($args{src})) {
767 my $target = $args{src};
768 if ($args{generator}->[0] =~ m|^.*\.in$|) {
769 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
770 "util", "dofile.pl")),
771 rel2abs($config{builddir}));
773 $target : $args{generator}->[0] $deps
774 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
775 "-o$target{build_file}" $generator > \$\@
779 $target : $args{generator}->[0] $deps
780 \$(PERL)$generator_incs $generator > \$\@
784 my $target = platform->asm($args{src});
785 if ($args{generator}->[0] =~ /\.pl$/) {
786 $generator = '$(PERL)'.$generator_incs.' '.$generator;
787 } elsif ($args{generator}->[0] =~ /\.S$/) {
790 die "Generator type for $src unknown: $generator\n";
794 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
795 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
796 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
797 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
798 } -> {$args{intent}};
799 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
800 lib => '$(LIB_INCLUDES)',
801 dso => '$(DSO_INCLUDES)',
802 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
806 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
807 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
808 my $defs = join("", map { ",".$_ } @{$args{defs}});
809 if (defined($generator)) {
810 # If the target is named foo.S in build.info, we want to
811 # end up generating foo.s in two steps.
812 if ($args{src} =~ /\.S$/) {
814 $target : $args{generator}->[0] $deps
817 \@ extradefines = "$defs"
818 PIPE \$(CPP) $cppflags \$\@-S | -
819 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
820 \@ DELETE/SYMBOL/LOCAL extradefines
828 $target : $args{generator}->[0] $deps
833 $target : $args{generator}->[0] $deps
835 \@ extradefines = "$defs"
836 SHOW SYMBOL qual_includes
837 PIPE \$(CPP) $cppflags $args{generator}->[0] | -
838 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
839 \@ DELETE/SYMBOL/LOCAL extradefines
847 my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x } ( @{$args{srcs}} );
848 my $obj = platform->obj($args{obj});
849 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
851 # Because VMS C isn't very good at combining a /INCLUDE path with
852 # #includes having a relative directory (like '#include "../foo.h"),
853 # the best choice is to move to the first source file's intended
854 # directory before compiling, and make sure to write the object file
855 # in the correct position (important when the object tree is other
856 # than the source tree).
857 my $forward = dirname($args{srcs}->[0]);
858 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
859 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
860 my $objn = basename($obj, platform->objext());
862 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
863 my $before = $unified_info{before}->{$obj} || "\@ !";
864 my $after = $unified_info{after}->{$obj} || "\@ !";
866 if ($srcs[0] =~ /\.asm$/) {
867 my $asflags = { shlib => ' $(LIB_ASFLAGS)',
868 lib => ' $(LIB_ASFLAGS)',
869 dso => ' $(DSO_ASFLAGS)',
870 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
875 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
876 SET DEFAULT $backward
881 if ($args{attrs}->{noinst}) {
882 $cflags = { shlib => '$(NO_INST_LIB_CFLAGS)',
883 lib => '$(NO_INST_LIB_CFLAGS)',
884 dso => '$(NO_INST_DSO_CFLAGS)',
885 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
887 $cflags = { shlib => '$(LIB_CFLAGS)',
888 lib => '$(LIB_CFLAGS)',
889 dso => '$(DSO_CFLAGS)',
890 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
892 $cflags .= { shlib => '$(LIB_CPPFLAGS)',
893 lib => '$(LIB_CPPFLAGS)',
894 dso => '$(DSO_CPPFLAGS)',
895 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
896 my $defs = join("", map { ",".$_ } @{$args{defs}});
897 my $asflags = { shlib => ' $(LIB_ASFLAGS)',
898 lib => ' $(LIB_ASFLAGS)',
899 dso => ' $(DSO_ASFLAGS)',
900 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
902 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
903 lib => '$(LIB_INCLUDES)',
904 dso => '$(DSO_INCLUDES)',
905 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
908 file_name_is_absolute($_)
909 ? $_ : catdir($backward,$_)
911 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
912 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
914 if ($srcs[0] =~ /\.asm$/) {
919 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
920 SET DEFAULT $backward
924 } elsif ($srcs[0] =~ /.S$/) {
930 \@ extradefines = "$defs"
931 PIPE \$(CPP) ${cflags} $srcs | -
932 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
934 \@ DELETE/SYMBOL/LOCAL extradefines
936 SET DEFAULT $backward
938 \$(AS) $asflags \$(ASOUTFLAG)$obj.OBJ $obj.asm
943 my $depbuild = $disabled{makedepend} ? ""
944 : " /MMS=(FILE=${objd}${objn}.D,TARGET=$obj)";
951 \@ extradefines = "$defs"
952 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
953 \@ DELETE/SYMBOL/LOCAL extradefines
955 SET DEFAULT $backward
962 my $shlibname = platform->sharedname($args{lib});
963 my $shlib = platform->sharedlib($args{lib});
964 my @objs = map { platform->convertext($_) }
965 grep { platform->isobj($_) }
967 my @defs = map { platform->convertext($_) }
968 grep { platform->isdef($_) }
970 my @deps = compute_lib_depends(@{$args{deps}});
971 die "More than one symbol vector" if scalar @defs > 1;
972 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
973 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
974 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
975 "VMS", "translatesyms.pl")),
976 rel2abs($config{builddir}));
977 # The "[]" hack is because in .OPT files, each line inherits the
978 # previous line's file spec as default, so if no directory spec
979 # is present in the current line and the previous line has one that
980 # doesn't apply, you're in for a surprise.
982 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
983 "WRITE OPT_FILE \"$x" } @objs).
986 join("\n\t", map { my $x = $_->{lib} =~ /\[/
987 ? $_->{lib} : "[]".$_->{lib};
988 $x =~ s|(\.EXE)|$1/SHARE|;
989 $x =~ s|(\.OLB)|$1/LIB|;
990 "WRITE OPT_FILE \"$x\"" } @deps)
994 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
995 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
999 LINK \$(LIB_LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
1000 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1001 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1002 PURGE $shlibname.EXE,$shlibname.MAP
1004 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1005 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1011 my $dsoname = platform->dsoname($args{lib});
1012 my $dso = platform->dso($args{lib});
1013 my @objs = map { platform->convertext($_) }
1014 grep { platform->isobj($_) }
1016 my @defs = map { platform->convertext($_) }
1017 grep { platform->isdef($_) }
1019 my @deps = compute_lib_depends(@{$args{deps}});
1020 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1021 die "More than one symbol vector" if scalar @defs > 1;
1022 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1023 # The "[]" hack is because in .OPT files, each line inherits the
1024 # previous line's file spec as default, so if no directory spec
1025 # is present in the current line and the previous line has one that
1026 # doesn't apply, you're in for a surprise.
1028 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1029 "WRITE OPT_FILE \"$x" } @objs).
1032 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1033 ? $_->{lib} : "[]".$_->{lib};
1034 $x =~ s|(\.EXE)|$1/SHARE|;
1035 $x =~ s|(\.OLB)|$1/LIB|;
1036 "WRITE OPT_FILE \"$x\"" } @deps)
1040 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1044 LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $defs[0]/OPT,-
1045 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1046 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1048 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1049 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1055 my $lib = platform->staticlib($args{lib});
1056 my @objs = map { platform->convertext($_) }
1057 grep { platform->isobj($_) }
1059 my $objs = join(", -\n\t\t", @objs);
1060 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1063 LIBRARY/CREATE/OBJECT $lib
1070 my $bin = platform->bin($args{bin});
1071 my $binname = platform->binname($args{bin});
1072 my @objs = map { platform->convertext($_) }
1073 grep { platform->isobj($_) }
1075 my $objs = join(",", @objs);
1076 my @deps = compute_lib_depends(@{$args{deps}});
1077 my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1079 my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1080 my $analyse_objs = "@ !";
1081 if ($olb_count > 0) {
1083 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1084 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
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", "WRITE OPT_FILE \"CASE_SENSITIVE=YES\"",
1096 map { my @lines = ();
1098 my $x = $_->{lib} =~ /\[/
1099 ? $_->{lib} : "[]".$_->{lib};
1100 if ($x =~ m|\.EXE$|) {
1101 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1102 } elsif ($x =~ m|\.OLB$|) {
1103 # Special hack to include the MAIN object
1104 # module explicitly. This will only be done
1105 # if there isn't a 'main' in the program's
1106 # object modules already.
1107 my $main = $_->{attrs}->{has_main}
1108 ? '/INCLUDE=main' : '';
1110 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB$main\"",
1111 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1116 # The linking commands looks a bit complex, but it's for good reason.
1117 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1118 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1119 # the linker will warn about it, loudly, and will then choose to pick
1120 # the first copy encountered (the one in bar.obj in this example).
1121 # On Unix and on Windows, the corresponding maneuvre goes through
1122 # silently with the same effect.
1123 # With some test programs, made for checking the internals of OpenSSL,
1124 # we do this kind of linking deliberately, picking a few specific object
1125 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1126 # otherwise unreachable (since the shareable images only exports the
1127 # symbols listed in [.util]*.num), and then with the shared libraries
1128 # themselves. So we need to silence the warning about multiply defined
1129 # symbols, to mimic the way linking work on Unix and Windows, and so
1130 # the build isn't interrupted (MMS stops when warnings are signaled,
1131 # by default), and so someone building doesn't have to worry where it
1132 # isn't necessary. If there are other warnings, however, we show them
1133 # and let it break the build.
1137 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1141 TYPE $binname.OPT ! For debugging
1142 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1143 LINK \$(BIN_LDFLAGS)/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1144 link_status = \$status ; link_severity = link_status .AND. 7
1145 @ search_severity = 1
1146 -@ IF link_severity .EQ. 0 THEN -
1147 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1148 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1149 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1150 search_severity = \$severity
1151 @ ! search_severity is 3 when the last search didn't find any matching
1152 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1153 @ ! If that was the result, we pretend linking got through without
1154 @ ! fault or warning.
1155 @ IF search_severity .EQ. 3 THEN link_severity = 1
1156 @ ! At this point, if link_severity shows that there was a fault
1157 @ ! or warning, make sure to restore the linking status.
1158 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1159 -@ DELETE $binname.LINKLOG;*
1160 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1161 - PURGE $bin,$binname.OPT
1163 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1164 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1170 my $script = $args{script};
1171 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1172 my $sources = join(" ", @{$args{sources}});
1173 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1174 "util", "dofile.pl")),
1175 rel2abs($config{builddir}));
1178 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1179 "-o$target{build_file}" $sources > $script
1180 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1184 "" # Important! This becomes part of the template result.