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{engines}};
60 our @install_programs =
61 grep { !$unified_info{attributes}->{$_}->{noinst} }
62 @{$unified_info{programs}};
63 our @install_bin_scripts =
64 grep { !$unified_info{attributes}->{$_}->{noinst}
65 && !$unified_info{attributes}->{$_}->{misc} }
66 @{$unified_info{scripts}};
67 our @install_misc_scripts =
68 grep { !$unified_info{attributes}->{$_}->{noinst}
69 && $unified_info{attributes}->{$_}->{misc} }
70 @{$unified_info{scripts}};
72 # This is a horrible hack, but is needed because recursive inclusion of files
73 # in different directories does not work well with HP C.
74 my $sd = sourcedir("crypto", "async", "arch");
75 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
76 my $obj = platform->obj($_);
77 $unified_info{before}->{$obj}
78 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
79 define arch 'arch_include');
80 $unified_info{after}->{$obj}
83 my $sd1 = sourcedir("ssl","record");
84 my $sd2 = sourcedir("ssl","statem");
85 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
86 keys %{$unified_info{sources}});
87 foreach (@ssl_locl_users) {
88 my $obj = platform->obj($_);
89 $unified_info{before}->{$obj}
90 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
91 define record 'record_include'
92 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
93 define statem 'statem_include');
94 $unified_info{after}->{$obj}
98 # This makes sure things get built in the order they need
103 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
106 #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
107 #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
110 PLATFORM={- $config{target} -}
111 OPTIONS={- $config{options} -}
112 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
113 SRCDIR={- $config{sourcedir} -}
114 BLDDIR={- $config{builddir} -}
116 # Allow both V and VERBOSE to indicate verbosity. This only applies
120 VERSION={- "$config{full_version}" -}
121 MAJOR={- $config{major} -}
122 MINOR={- $config{minor} -}
123 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
124 SHLIB_TARGET={- $target{shared_target} -}
126 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
127 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
128 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
129 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
130 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
131 {- output_off() if $disabled{makedepend}; "" -}
132 DEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ }
133 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
134 keys %{$unified_info{sources}};
135 join(", ", map { "-\n\t".$_ } @deps); -}
136 {- output_on() if $disabled{makedepend}; "" -}
137 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
138 GENERATED={- # common0.tmpl provides @generated
139 join(", ", map { platform->convertext($_) } @generated) -}
141 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
142 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
143 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
144 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
145 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
146 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
148 APPS_OPENSSL={- use File::Spec::Functions;
149 catfile("apps","openssl") -}
151 # DESTDIR is for package builders so that they can configure for, say,
152 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
153 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
154 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
155 # STAGING:[USER.OPENSSL].
156 # Normally it is left empty.
159 # Do not edit this manually. Use Configure --prefix=DIR to change this!
160 INSTALLTOP={- our $installtop =
161 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
163 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
164 # This is the standard central area to store certificates, private keys...
165 OPENSSLDIR={- catdir($config{openssldir}) or
166 $config{prefix} ? catdir($config{prefix},"COMMON")
167 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
168 # The same, but for C
169 OPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000]
170 # Where installed engines reside, for C
171 ENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
173 ##### User defined commands and flags ################################
176 CPP={- $config{CPP} -}
177 DEFINES={- our $defines1 = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
178 INCLUDES={- our $includes1 = join(',', @{$config{CPPINCLUDES}}) -}
179 CPPFLAGS={- our $cppflags1 = join('', @{$config{CPPFLAGS}}) -}
180 CFLAGS={- join('', @{$config{CFLAGS}}) -}
181 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
182 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
184 PERL={- $config{PERL} -}
187 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
189 ##### Special command flags ##########################################
191 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
193 ##### Project flags ##################################################
195 # Variables starting with CNF_ are common variables for all product types
197 CNF_ASFLAGS={- join('', $target{asflags} || (),
198 @{$config{asflags}}) -}
199 CNF_DEFINES={- our $defines2 = join('', (map { ",$_" } @{$target{defines}},
200 @{$config{defines}}),
202 CNF_INCLUDES={- our $includes2 = join(',', @{$target{includes}},
203 @{$config{includes}}) -}
204 CNF_CPPFLAGS={- our $cppflags2 = join('', $target{cppflags} || (),
205 @{$config{cppflags}}) -}
206 CNF_CFLAGS={- join('', $target{cflags} || (),
207 @{$config{cflags}}) -}
208 CNF_CXXFLAGS={- join('', $target{cxxflags} || (),
209 @{$config{cxxflags}}) -}
210 CNF_LDFLAGS={- join('', $target{lflags} || (),
211 @{$config{lflags}}) -}
212 CNF_EX_LIBS={- join('', map{ ",$_" } @{$target{ex_libs}},
213 @{$config{ex_libs}}) -}
215 # Variables starting with LIB_ are used to build library object files
216 # and shared libraries.
217 # Variables starting with DSO_ are used to build DSOs and their object files.
218 # Variables starting with BIN_ are used to build programs and their object
221 LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (),
222 @{$config{lib_asflags}},
223 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
224 LIB_DEFINES={- our $lib_defines =
225 join('', (map { ",$_" } @{$target{lib_defines}},
226 @{$target{shared_defines}},
227 @{$config{lib_defines}},
228 @{$config{shared_defines}}));
229 join('', $lib_defines,
230 (map { ",$_" } 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
231 'ENGINESDIR="""$(ENGINESDIR_C)"""'),
232 '$(CNF_DEFINES)', '$(DEFINES)') -}
233 LIB_INCLUDES={- our $lib_includes =
234 join(',', @{$target{lib_includes}},
235 @{$target{shared_includes}},
236 @{$config{lib_includes}},
237 @{$config{shared_includes}}) -}
238 LIB_CPPFLAGS={- our $lib_cppflags =
239 join('', $target{lib_cppflags} || (),
240 $target{shared_cppflags} || (),
241 @{$config{lib_cppflags}},
242 @{$config{shared_cppflag}});
243 join('', "'qual_includes'",
244 '/DEFINE=(__dummy$(LIB_DEFINES))',
246 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
247 LIB_CFLAGS={- join('', $target{lib_cflags} || (),
248 $target{shared_cflag} || (),
249 @{$config{lib_cflags}},
250 @{$config{shared_cflag}},
251 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
252 LIB_LDFLAGS={- join('', $target{lib_lflags} || (),
253 $target{shared_ldflag} || (),
254 @{$config{lib_lflags}},
255 @{$config{shared_ldflag}},
256 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
257 LIB_EX_LIBS=$(CNF_EX_LIBS)$(EX_LIBS)
258 DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (),
259 $target{module_asflags} || (),
260 @{$config{dso_asflags}},
261 @{$config{module_asflags}},
262 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
263 DSO_DEFINES={- join('', (map { ",$_" } @{$target{dso_defines}},
264 @{$target{module_defines}},
265 @{$config{dso_defines}},
266 @{$config{module_defines}}),
267 '$(CNF_DEFINES)', '$(DEFINES)') -}
268 DSO_INCLUDES={- join(',', @{$target{dso_includes}},
269 @{$target{module_includes}},
270 @{$config{dso_includes}},
271 @{$config{module_includes}}) -}
272 DSO_CPPFLAGS={- join('', "'qual_includes'",
273 '/DEFINE=(__dummy$(DSO_DEFINES))',
274 $target{dso_cppflags} || (),
275 $target{module_cppflags} || (),
276 @{$config{dso_cppflags}},
277 @{$config{module_cppflags}},
278 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
279 DSO_CFLAGS={- join('', $target{dso_cflags} || (),
280 $target{module_cflags} || (),
281 @{$config{dso_cflags}},
282 @{$config{module_cflags}},
283 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
284 DSO_LDFLAGS={- join('', $target{dso_lflags} || (),
285 $target{module_ldflags} || (),
286 @{$config{dso_lflags}},
287 @{$config{module_ldflags}},
288 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
289 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
290 BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
291 @{$config{bin_asflags}},
292 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
293 BIN_DEFINES={- join('', (map { ",$_" } @{$target{bin_defines}},
294 @{$config{bin_defines}}),
295 '$(CNF_DEFINES)', '$(DEFINES)') -}
296 BIN_INCLUDES={- join(',', @{$target{bin_includes}},
297 @{$config{bin_includes}}) -}
298 BIN_CPPFLAGS={- join('', "'qual_includes'",
299 '/DEFINE=(__dummy$(DSO_DEFINES))',
300 $target{bin_cppflags} || (),
301 @{$config{bin_cppflag}},
302 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
303 BIN_CFLAGS={- join('', $target{bin_cflags} || (),
304 @{$config{bin_cflags}},
305 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
306 BIN_LDFLAGS={- join('', $target{bin_lflags} || (),
307 @{$config{bin_lflags}} || (),
308 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
309 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
310 NO_INST_LIB_CFLAGS={- join('', $target{no_inst_lib_cflags}
311 // $target{lib_cflags}
313 $target{shared_cflag} || (),
314 @{$config{lib_cflags}},
315 @{$config{shared_cflag}},
316 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
317 NO_INST_DSO_CFLAGS={- join('', $target{no_inst_dso_cflags}
318 // $target{dso_cflags}
320 $target{no_inst_module_cflags}
321 // $target{module_cflags}
323 @{$config{dso_cflags}},
324 @{$config{module_cflags}},
325 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
326 NO_INST_BIN_CFLAGS={- join('', $target{no_inst_bin_cflags}
327 // $target{bin_cflags}
329 @{$config{bin_cflags}},
330 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
332 PERLASM_SCHEME={- $target{perlasm_scheme} -}
334 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
335 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags2.$cppflags1) =~ s|"|""|g;
336 (my $d = $lib_defines.$defines2.$defines1) =~ s|"|""|g;
337 my $i = join(',', $lib_includes || (), $includes2 || (),
340 $x .= "/INCLUDE=($i)" if $i;
341 $x .= "/DEFINE=($d)" if $d;
344 # .FIRST and .LAST are special targets with MMS and MMK.
345 # The defines in there are for C. includes that look like
348 # #include <openssl/foo.h>
349 # #include "internal/bar.h"
351 # will use the logical names to find the files. Expecting
352 # DECompHP C to find files in subdirectories of whatever was
353 # given with /INCLUDE is a fantasy, unfortunately.
356 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
357 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
358 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
359 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
360 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
361 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
362 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
363 $(NODEBUG) staging_dir = "$(DESTDIR)"
364 $(NODEBUG) staging_instdir = ""
365 $(NODEBUG) staging_datadir = ""
366 $(NODEBUG) IF staging_dir .NES. "" THEN -
367 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
368 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
369 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
370 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
371 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
372 $(NODEBUG) IF staging_dir .NES. "" THEN -
373 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
374 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
375 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
376 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
377 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
379 $(NODEBUG) ! Installation logical names
381 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
382 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
383 $(NODEBUG) DEFINE ossl_installroot 'installtop'
384 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
386 $(NODEBUG) ! Figure out the architecture
388 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
390 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
391 $(NODEBUG) ! running programs can use them.
393 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
396 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
397 $(NODEBUG) DEASSIGN ossl_dataroot
398 $(NODEBUG) DEASSIGN ossl_installroot
399 $(NODEBUG) DEASSIGN internal
400 $(NODEBUG) DEASSIGN openssl
402 @ ! MMS cannot handle no actions...
404 # The main targets ###################################################
406 {- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep
407 {- dependmagic('build_libs'); -} : build_libs_nodep
408 {- dependmagic('build_engines'); -} : build_engines_nodep
409 {- dependmagic('build_programs'); -} : build_programs_nodep
411 build_generated : $(GENERATED_MANDATORY)
412 build_libs_nodep : $(LIBS), $(SHLIBS)
413 build_engines_nodep : $(ENGINES)
414 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
416 # Kept around for backward compatibility
417 build_apps build_tests : build_programs
419 # Convenience target to prebuild all generated files, not just the mandatory
421 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
422 @ ! {- output_off() if $disabled{makedepend}; "" -}
423 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
424 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
425 @ WRITE SYS$OUTPUT " then make will fail..."
426 @ ! {- output_on() if $disabled{makedepend}; "" -}
429 {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep
430 @ ! {- output_off() if $disabled{tests}; "" -}
431 SET DEFAULT [.test]{- move("test") -}
432 CREATE/DIR [.test-runs]
433 DEFINE SRCTOP {- sourcedir() -}
434 DEFINE BLDTOP {- builddir() -}
435 DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
436 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
437 DEFINE OPENSSL_DEBUG_MEMORY "on"
438 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
439 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
440 DEASSIGN OPENSSL_DEBUG_MEMORY
441 DEASSIGN OPENSSL_ENGINES
444 SET DEFAULT [-]{- move("..") -}
445 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
446 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
447 @ ! {- output_on() if !$disabled{tests}; "" -}
450 @ ! {- output_off() if $disabled{tests}; "" -}
451 @ DEFINE SRCTOP {- sourcedir() -}
452 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
454 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
455 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
456 @ ! {- output_on() if !$disabled{tests}; "" -}
458 install : install_sw install_ssldirs install_docs
459 @ WRITE SYS$OUTPUT ""
460 @ WRITE SYS$OUTPUT "######################################################################"
461 @ WRITE SYS$OUTPUT ""
462 @ IF "$(DESTDIR)" .EQS. "" THEN -
463 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
464 WRITE SYS$OUTPUT "" ; -
465 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
466 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
467 WRITE SYS$OUTPUT "" )
468 @ IF "$(DESTDIR)" .NES. "" THEN -
469 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
470 WRITE SYS$OUTPUT "" ; -
471 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
472 WRITE SYS$OUTPUT staging_instdir ; -
473 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
474 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
475 WRITE SYS$OUTPUT staging_datadir ; -
476 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
477 WRITE SYS$OUTPUT "" ; -
478 WRITE SYS$OUTPUT "When in its final destination," ; -
479 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
480 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
481 WRITE SYS$OUTPUT "" )
484 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
486 uninstall : uninstall_docs uninstall_sw
488 # Because VMS wants the generation number (or *) to delete files, we can't
489 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
491 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
492 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
495 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
496 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
497 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
498 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
499 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
500 - DELETE [...]*.MAP;*
502 - DELETE [...]*.OBJ;*,*.LIS;*
503 - DELETE []CXX$DEMANGLER_DB.;*
504 - DELETE [.VMS]openssl_startup.com;*
505 - DELETE [.VMS]openssl_shutdown.com;*
506 - DELETE []vmsconfig.pm;*
509 - DELETE configdata.pm;*
510 - DELETE descrip.mms;*
514 @ ! {- output_off() if $disabled{makedepend}; "" -}
515 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "VMS C"
516 @ ! {- output_on() if $disabled{makedepend}; "" -}
518 # Install helper targets #############################################
520 install_sw : install_dev install_engines install_runtime -
521 install_startup install_ivp
523 uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime -
524 uninstall_startup uninstall_ivp
526 install_docs : install_html_docs
528 uninstall_docs : uninstall_html_docs
530 install_ssldirs : check_INSTALLTOP
531 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
532 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
533 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
534 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
535 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
536 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
537 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
538 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
539 @ ! Install configuration file
540 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
541 ossl_dataroot:[000000]openssl.cnf-dist
542 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
543 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
544 ossl_dataroot:[000000]openssl.cnf
545 @ ! Install CTLOG configuration file
546 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
547 ossl_dataroot:[000000]ct_log_list.cnf-dist
548 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
549 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
550 ossl_dataroot:[000000]ct_log_list.cnf
552 install_dev : check_INSTALLTOP install_runtime_libs
553 @ WRITE SYS$OUTPUT "*** Installing development files"
554 @ ! Install header files
555 - CREATE/DIR ossl_installroot:[include.openssl]
556 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
557 @ ! Install static (development) libraries
558 - CREATE/DIR ossl_installroot:[LIB.'arch']
560 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
563 install_engines : check_INSTALLTOP install_runtime_libs build_engines
564 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
565 @ WRITE SYS$OUTPUT "*** Installing engines"
566 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
568 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
570 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
572 install_runtime : install_programs
574 install_runtime_libs : check_INSTALLTOP build_libs
575 @ {- output_off() if $disabled{shared}; "" -} !
576 @ WRITE SYS$OUTPUT "*** Installing shareable images"
577 @ ! Install shared (runtime) libraries
578 - CREATE/DIR ossl_installroot:[LIB.'arch']
580 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
582 @ {- output_on() if $disabled{shared}; "" -} !
584 install_programs : check_INSTALLTOP install_runtime_libs build_programs
585 @ {- output_off() if $disabled{apps}; "" -} !
586 @ ! Install the main program
587 - CREATE/DIR ossl_installroot:[EXE.'arch']
588 COPY/PROT=W:RE [.APPS]openssl.EXE -
589 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
591 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
592 @ ! {- output_on() if $disabled{apps}; "" -}
594 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
595 [.VMS]openssl_utils.com, check_INSTALLTOP
596 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
597 COPY/PROT=W:RE [.VMS]openssl_startup.com -
598 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
599 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
600 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
601 COPY/PROT=W:RE [.VMS]openssl_utils.com -
602 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
604 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
605 - CREATE/DIR ossl_installroot:[SYSTEST]
606 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
607 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
609 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
611 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
612 {- sourcefile("VMS", "openssl_startup.com.in") -} -
613 > [.VMS]openssl_startup.com
615 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
617 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
618 {- sourcefile("VMS", "openssl_utils.com.in") -} -
619 > [.VMS]openssl_utils.com
621 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
623 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
624 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
625 > [.VMS]openssl_shutdown.com
627 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
629 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
630 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
631 > [.VMS]openssl_ivp.com
633 vmsconfig.pm : configdata.pm
634 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
635 WRITE CONFIG "package vmsconfig;"
636 WRITE CONFIG "use strict; use warnings;"
637 WRITE CONFIG "use Exporter;"
638 WRITE CONFIG "our @ISA = qw(Exporter);"
639 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
640 WRITE CONFIG "our %config = ("
641 WRITE CONFIG " target => '","{- $config{target} -}","',"
642 WRITE CONFIG " version => '","{- $config{version} -}","',"
643 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
644 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
645 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
646 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
647 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
648 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
649 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
651 WRITE CONFIG "our %target = ();"
652 WRITE CONFIG "our %disabled = ();"
653 WRITE CONFIG "our %withargs = ();"
654 WRITE CONFIG "our %unified_info = ();"
658 install_html_docs : check_INSTALLTOP
659 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
660 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
661 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
665 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
666 WRITE SYS$ERROR "INSTALLTOP should not be empty"
667 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
670 # Helper targets #####################################################
672 # Developer targets ##################################################
675 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
677 # Building targets ###################################################
679 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
680 perl configdata.pm -r
681 @ WRITE SYS$OUTPUT "*************************************************"
682 @ WRITE SYS$OUTPUT "*** ***"
683 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
684 @ WRITE SYS$OUTPUT "*** ***"
685 @ WRITE SYS$OUTPUT "*************************************************"
686 @ PIPE ( EXIT %X10000000 )
689 perl configdata.pm -r
693 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
695 # Helper function to figure out dependencies on libraries
696 # It takes a list of library names and outputs a list of dependencies
697 sub compute_lib_depends {
698 # Depending on shared libraries:
699 # On Windows POSIX layers, we depend on {libname}.dll.a
700 # On Unix platforms, we depend on {shlibname}.so
701 return map { platform->sharedlib($_) // platform->staticlib($_) } @_;
704 # Helper function to deal with inclusion directory specs.
705 # We have to deal with two things:
706 # 1. comma separation and no possibility of trailing comma
707 # 2. no inclusion directories given at all
708 # 3. long compiler command lines
709 # To resolve 1, we need to iterate through the sources of inclusion
710 # directories, and only add a comma when needed.
711 # To resolve 2, we need to have a variable that will hold the whole
712 # inclusion qualifier, or be the empty string if there are no inclusion
713 # directories. That's the symbol 'qual_includes' that's used in CPPFLAGS
714 # To resolve 3, we creata a logical name TMP_INCLUDES: to hold the list
715 # of inclusion directories.
717 # This function returns a list of two lists, one being the collection of
718 # commands to execute before the compiler is called, and the other being
719 # the collection of commands to execute after. It takes as arguments the
720 # collection of strings to include as directory specs.
727 'DELETE/SYMBOL/LOCAL qual_includes',
730 if (scalar @stuff > 0) {
731 push @before, 'tmp_includes := '.shift(@stuff);
733 push @before, 'tmp_add := '.shift(@stuff);
734 push @before, 'IF tmp_includes .NES. "" .AND. tmp_add .NES. "" THEN tmp_includes = tmp_includes + ","';
735 push @before, 'tmp_includes = tmp_includes + tmp_add';
737 push @before, "IF tmp_includes .NES. \"\" THEN DEFINE tmp_includes 'tmp_includes'";
738 push @before, 'IF tmp_includes .NES. "" THEN qual_includes := /INCLUDE=(tmp_includes:)';
739 push @before, 'DELETE/SYMBOL/LOCAL tmp_includes';
740 push @before, 'DELETE/SYMBOL/LOCAL tmp_add';
741 push @after, 'DEASSIGN tmp_includes:'
743 return ([ @before ], [ @after ]);
748 my $generator = join(" ", @{$args{generator}});
749 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
750 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
752 if (platform->isdef($args{src})) {
753 my $target = platform->def($args{src});
754 my $mkdef = sourcefile('util', 'mkdef.pl');
755 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
757 $args{generator}->[1] || basename($args{product}, '.EXE');
758 my $case_insensitive =
759 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
760 ? '' : ' --case-insensitive';
762 $target : $args{generator}->[0] $deps $mkdef
763 \$(PERL) $mkdef$ord_ver --ordinals $args{generator}->[0] --name $ord_name "--OS" "VMS"$case_insensitive > $target
765 } elsif (!platform->isasm($args{src})) {
766 my $target = $args{src};
767 if ($args{generator}->[0] =~ m|^.*\.in$|) {
768 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
769 "util", "dofile.pl")),
770 rel2abs($config{builddir}));
772 $target : $args{generator}->[0] $deps
773 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
774 "-o$target{build_file}" $generator > \$\@
778 $target : $args{generator}->[0] $deps
779 \$(PERL)$generator_incs $generator > \$\@
783 my $target = platform->asm($args{src});
784 if ($args{generator}->[0] =~ /\.pl$/) {
785 $generator = '$(PERL)'.$generator_incs.' '.$generator;
786 } elsif ($args{generator}->[0] =~ /\.S$/) {
789 die "Generator type for $src unknown: $generator\n";
793 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
794 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
795 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
796 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
797 } -> {$args{intent}};
798 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
799 lib => '$(LIB_INCLUDES)',
800 dso => '$(DSO_INCLUDES)',
801 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
805 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
806 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
807 my $defs = join("", map { ",".$_ } @{$args{defs}});
808 if (defined($generator)) {
809 # If the target is named foo.S in build.info, we want to
810 # end up generating foo.s in two steps.
811 if ($args{src} =~ /\.S$/) {
813 $target : $args{generator}->[0] $deps
816 \@ extradefines = "$defs"
817 PIPE \$(CPP) $cppflags \$\@-S | -
818 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
819 \@ DELETE/SYMBOL/LOCAL extradefines
827 $target : $args{generator}->[0] $deps
832 $target : $args{generator}->[0] $deps
834 \@ extradefines = "$defs"
835 SHOW SYMBOL qual_includes
836 PIPE \$(CPP) $cppflags $args{generator}->[0] | -
837 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
838 \@ DELETE/SYMBOL/LOCAL extradefines
846 my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x } ( @{$args{srcs}} );
847 my $obj = platform->obj($args{obj});
848 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
850 # Because VMS C isn't very good at combining a /INCLUDE path with
851 # #includes having a relative directory (like '#include "../foo.h"),
852 # the best choice is to move to the first source file's intended
853 # directory before compiling, and make sure to write the object file
854 # in the correct position (important when the object tree is other
855 # than the source tree).
856 my $forward = dirname($args{srcs}->[0]);
857 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
858 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
859 my $objn = basename($obj, platform->objext());
861 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
862 my $before = $unified_info{before}->{$obj} || "\@ !";
863 my $after = $unified_info{after}->{$obj} || "\@ !";
865 if ($srcs[0] =~ /\.asm$/) {
866 my $asflags = { shlib => ' $(LIB_ASFLAGS)',
867 lib => ' $(LIB_ASFLAGS)',
868 dso => ' $(DSO_ASFLAGS)',
869 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
874 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
875 SET DEFAULT $backward
880 if ($args{attrs}->{noinst}) {
881 $cflags = { shlib => '$(NO_INST_LIB_CFLAGS)',
882 lib => '$(NO_INST_LIB_CFLAGS)',
883 dso => '$(NO_INST_DSO_CFLAGS)',
884 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
886 $cflags = { shlib => '$(LIB_CFLAGS)',
887 lib => '$(LIB_CFLAGS)',
888 dso => '$(DSO_CFLAGS)',
889 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
891 $cflags .= { shlib => '$(LIB_CPPFLAGS)',
892 lib => '$(LIB_CPPFLAGS)',
893 dso => '$(DSO_CPPFLAGS)',
894 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
895 my $defs = join("", map { ",".$_ } @{$args{defs}});
896 my $asflags = { shlib => ' $(LIB_ASFLAGS)',
897 lib => ' $(LIB_ASFLAGS)',
898 dso => ' $(DSO_ASFLAGS)',
899 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
901 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
902 lib => '$(LIB_INCLUDES)',
903 dso => '$(DSO_INCLUDES)',
904 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
907 file_name_is_absolute($_)
908 ? $_ : catdir($backward,$_)
910 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
911 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
913 if ($srcs[0] =~ /\.asm$/) {
918 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
919 SET DEFAULT $backward
923 } elsif ($srcs[0] =~ /.S$/) {
929 \@ extradefines = "$defs"
930 PIPE \$(CPP) ${cflags} $srcs | -
931 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
933 \@ DELETE/SYMBOL/LOCAL extradefines
935 SET DEFAULT $backward
937 \$(AS) $asflags \$(ASOUTFLAG)$obj.OBJ $obj.asm
942 my $depbuild = $disabled{makedepend} ? ""
943 : " /MMS=(FILE=${objd}${objn}.D,TARGET=$obj)";
950 \@ extradefines = "$defs"
951 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
952 \@ DELETE/SYMBOL/LOCAL extradefines
954 SET DEFAULT $backward
961 my $shlibname = platform->sharedname($args{lib});
962 my $shlib = platform->sharedlib($args{lib});
963 my @objs = map { platform->convertext($_) }
964 grep { platform->isobj($_) }
966 my @defs = map { platform->convertext($_) }
967 grep { platform->isdef($_) }
969 my @deps = compute_lib_depends(@{$args{deps}});
970 die "More than one symbol vector" if scalar @defs > 1;
971 my $deps = join(", -\n\t\t", @objs, @defs, @deps);
972 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
973 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
974 "VMS", "translatesyms.pl")),
975 rel2abs($config{builddir}));
976 # The "[]" hack is because in .OPT files, each line inherits the
977 # previous line's file spec as default, so if no directory spec
978 # is present in the current line and the previous line has one that
979 # doesn't apply, you're in for a surprise.
981 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
982 "WRITE OPT_FILE \"$x" } @objs).
985 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
986 $x =~ s|(\.EXE)|$1/SHARE|;
987 $x =~ s|(\.OLB)|$1/LIB|;
988 "WRITE OPT_FILE \"$x\"" } @deps)
992 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
993 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
997 LINK \$(LIB_LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
998 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
999 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1000 PURGE $shlibname.EXE,$shlibname.MAP
1002 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1003 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1009 my $dsoname = platform->dsoname($args{lib});
1010 my $dso = platform->dso($args{lib});
1011 my @objs = map { platform->convertext($_) }
1012 grep { platform->isobj($_) }
1014 my @defs = map { platform->convertext($_) }
1015 grep { platform->isdef($_) }
1017 my @deps = compute_lib_depends(@{$args{deps}});
1018 my $deps = join(", -\n\t\t", @objs, @defs, @deps);
1019 die "More than one symbol vector" if scalar @defs > 1;
1020 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1021 # The "[]" hack is because in .OPT files, each line inherits the
1022 # previous line's file spec as default, so if no directory spec
1023 # is present in the current line and the previous line has one that
1024 # doesn't apply, you're in for a surprise.
1026 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1027 "WRITE OPT_FILE \"$x" } @objs).
1030 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1031 $x =~ s|(\.EXE)|$1/SHARE|;
1032 $x =~ s|(\.OLB)|$1/LIB|;
1033 "WRITE OPT_FILE \"$x\"" } @deps)
1037 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1041 LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $defs[0]/OPT,-
1042 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1043 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1045 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1046 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1052 my $lib = platform->staticlib($args{lib});
1053 my @objs = map { platform->convertext($_) }
1054 grep { platform->isobj($_) }
1056 my $objs = join(", -\n\t\t", @objs);
1057 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1060 LIBRARY/CREATE/OBJECT $lib
1067 my $bin = platform->bin($args{bin});
1068 my $binname = platform->binname($args{bin});
1069 my @objs = map { platform->convertext($_) }
1070 grep { platform->isobj($_) }
1072 my $objs = join(",", @objs);
1073 my @deps = compute_lib_depends(@{$args{deps}});
1074 my $deps = join(", -\n\t\t", @objs, @deps);
1076 my $olb_count = scalar grep(m|\.OLB$|, @deps);
1077 my $analyse_objs = "@ !";
1078 if ($olb_count > 0) {
1080 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1081 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1083 # The "[]" hack is because in .OPT files, each line inherits the
1084 # previous line's file spec as default, so if no directory spec
1085 # is present in the current line and the previous line has one that
1086 # doesn't apply, you're in for a surprise.
1088 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1089 "\@ WRITE OPT_FILE \"$x" } @objs).
1092 join("\n\t", map { my @lines = (
1093 "\ WRITE OPT_FILE \"CASE_SENSITIVE=YES\""
1095 my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1096 if ($x =~ m|\.EXE$|) {
1097 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1098 } elsif ($x =~ m|\.OLB$|) {
1099 (my $l = $x) =~ s/\W/_/g;
1101 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB\$(INCLUDE_MAIN_$l)\"",
1102 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1107 # The linking commands looks a bit complex, but it's for good reason.
1108 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1109 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1110 # the linker will warn about it, loudly, and will then choose to pick
1111 # the first copy encountered (the one in bar.obj in this example).
1112 # On Unix and on Windows, the corresponding maneuvre goes through
1113 # silently with the same effect.
1114 # With some test programs, made for checking the internals of OpenSSL,
1115 # we do this kind of linking deliberately, picking a few specific object
1116 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1117 # otherwise unreachable (since the shareable images only exports the
1118 # symbols listed in [.util]*.num), and then with the shared libraries
1119 # themselves. So we need to silence the warning about multiply defined
1120 # symbols, to mimic the way linking work on Unix and Windows, and so
1121 # the build isn't interrupted (MMS stops when warnings are signaled,
1122 # by default), and so someone building doesn't have to worry where it
1123 # isn't necessary. If there are other warnings, however, we show them
1124 # and let it break the build.
1128 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1132 TYPE $binname.OPT ! For debugging
1133 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1134 LINK \$(BIN_LDFLAGS)/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1135 link_status = \$status ; link_severity = link_status .AND. 7
1136 @ search_severity = 1
1137 -@ IF link_severity .EQ. 0 THEN -
1138 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1139 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1140 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1141 search_severity = \$severity
1142 @ ! search_severity is 3 when the last search didn't find any matching
1143 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1144 @ ! If that was the result, we pretend linking got through without
1145 @ ! fault or warning.
1146 @ IF search_severity .EQ. 3 THEN link_severity = 1
1147 @ ! At this point, if link_severity shows that there was a fault
1148 @ ! or warning, make sure to restore the linking status.
1149 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1150 -@ DELETE $binname.LINKLOG;*
1151 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1152 - PURGE $bin,$binname.OPT
1154 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1155 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1161 my $script = $args{script};
1162 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1163 my $sources = join(" ", @{$args{sources}});
1164 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1165 "util", "dofile.pl")),
1166 rel2abs($config{builddir}));
1169 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1170 "-o$target{build_file}" $sources > $script
1171 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1175 "" # Important! This becomes part of the template result.