1 ## descrip.mms to build OpenSSL on OpenVMS
3 ## {- join("\n## ", @autowarntext) -}
5 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
7 # Our prefix, claimed when speaking with the VSI folks Tuesday
9 our $osslprefix = 'OSSL$';
10 (our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/;
12 our $sover_dirname = sprintf "%02d%02d", split(/\./, $config{shlib_version_number});
13 our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
15 our $sourcedir = $config{sourcedir};
16 our $builddir = $config{builddir};
18 catfile($sourcedir, @_);
21 catfile($builddir, @_);
24 catdir($sourcedir, @_);
27 catdir($builddir, @_);
30 (my $x = shift) =~ s|\]$|...]|;
35 my $b = abs2rel(rel2abs("."),rel2abs($f));
36 $sourcedir = catdir($b,$sourcedir)
37 if !file_name_is_absolute($sourcedir);
38 $builddir = catdir($b,$builddir)
39 if !file_name_is_absolute($builddir);
43 # Because we need to make two computations of these data,
44 # we store them in arrays for reuse
46 map { (my $x = $_) =~ s/\.a$//; $x }
47 @{$unified_info{libraries}};
49 map { $unified_info{sharednames}->{$_} || () }
50 grep(!/\.a$/, @{$unified_info{libraries}});
52 map { (my $x = $_) =~ s/\.a$//; $x }
53 @{$unified_info{install}->{libraries}};
55 map { $unified_info{sharednames}->{$_} || () }
56 grep(!/\.a$/, @{$unified_info{install}->{libraries}});
57 our @generated = ( ( map { (my $x = $_) =~ s|\.[sS]$|\.asm|; $x }
58 grep { defined $unified_info{generate}->{$_} }
59 map { @{$unified_info{sources}->{$_}} }
60 grep { /\.o$/ } keys %{$unified_info{sources}} ),
61 ( grep { /\.h$/ } keys %{$unified_info{generate}} ) );
63 # This is a horrible hack, but is needed because recursive inclusion of files
64 # in different directories does not work well with HP C.
65 my $sd = sourcedir("crypto", "async", "arch");
66 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
67 (my $x = $_) =~ s|\.o$|.OBJ|;
68 $unified_info{before}->{$x}
69 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
70 define arch 'arch_include');
71 $unified_info{after}->{$x}
74 my $sd1 = sourcedir("ssl","record");
75 my $sd2 = sourcedir("ssl","statem");
76 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
77 keys %{$unified_info{sources}});
78 foreach (@ssl_locl_users) {
79 (my $x = $_) =~ s|\.o$|.OBJ|;
80 $unified_info{before}->{$x}
81 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
82 define record 'record_include'
83 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
84 define statem 'statem_include');
85 $unified_info{after}->{$x}
89 # This makes sure things get built in the order they need
94 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
97 #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
98 #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
101 PLATFORM={- $config{target} -}
102 OPTIONS={- $config{options} -}
103 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
104 SRCDIR={- $config{sourcedir} -}
105 BLDDIR={- $config{builddir} -}
107 # Allow both V and VERBOSE to indicate verbosity. This only applies
111 VERSION={- $config{version} -}
112 MAJOR={- $config{major} -}
113 MINOR={- $config{minor} -}
114 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
115 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
116 SHLIB_MAJOR={- $config{shlib_major} -}
117 SHLIB_MINOR={- $config{shlib_minor} -}
118 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 { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
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={- join(", ", map { "-\n\t".$_ } @generated) -}
140 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
141 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
142 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -}
143 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -}
144 {- output_off() if $disabled{apps}; "" -}
145 BIN_SCRIPTS=[.tools]c_rehash.pl
146 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
147 {- output_on() if $disabled{apps}; "" -}
149 APPS_OPENSSL={- use File::Spec::Functions;
150 catfile("apps","openssl") -}
152 # DESTDIR is for package builders so that they can configure for, say,
153 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
154 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
155 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
156 # STAGING:[USER.OPENSSL].
157 # Normally it is left empty.
160 # Do not edit this manually. Use Configure --prefix=DIR to change this!
161 INSTALLTOP={- our $installtop =
162 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
164 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
165 # This is the standard central area to store certificates, private keys...
166 OPENSSLDIR={- catdir($config{openssldir}) or
167 $config{prefix} ? catdir($config{prefix},"COMMON")
168 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
169 # The same, but for C
170 OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
171 # Where installed engines reside, for C
172 ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
174 ##### User defined commands and flags ################################
177 CPP={- $config{CPP} -}
178 DEFINES={- our $defines1 = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
179 INCLUDES={- our $includes1 = join(',', @{$config{CPPINCLUDES}}) -}
180 CPPFLAGS={- our $cppflags1 = join('', @{$config{CPPFLAGS}}) -}
181 CFLAGS={- join('', @{$config{CFLAGS}}) -}
182 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
183 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
185 PERL={- $config{perl} -}
188 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
190 ##### Special command flags ##########################################
192 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
194 ##### Project flags ##################################################
196 # Variables starting with CNF_ are common variables for all product types
198 CNF_ASFLAGS={- join('', $target{asflags} || (),
199 @{$config{asflags}}) -}
200 CNF_DEFINES={- our $defines2 = join('', map { ",$_" } @{$target{defines}},
201 @{$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_cflag} || (),
304 @{$config{bin_cflag}},
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_lib_cflags}
318 // $target{lib_cflags}
320 $target{dso_cflags} || (),
321 @{$config{lib_cflags}},
322 @{$config{dso_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_engines_nodep, build_programs_nodep
405 {- dependmagic('build_libs'); -} : build_libs_nodep
406 {- dependmagic('build_engines'); -} : build_engines_nodep
407 {- dependmagic('build_programs'); -} : build_programs_nodep
409 build_generated : $(GENERATED_MANDATORY)
410 build_libs_nodep : $(LIBS), $(SHLIBS)
411 build_engines_nodep : $(ENGINES)
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)
422 {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep
423 @ ! {- output_off() if $disabled{tests}; "" -}
424 SET DEFAULT [.test]{- move("test") -}
425 CREATE/DIR [.test-runs]
426 DEFINE SRCTOP {- sourcedir() -}
427 DEFINE BLDTOP {- builddir() -}
428 DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
429 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
430 DEFINE OPENSSL_DEBUG_MEMORY "on"
431 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
432 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
433 DEASSIGN OPENSSL_DEBUG_MEMORY
434 DEASSIGN OPENSSL_ENGINES
437 SET DEFAULT [-]{- move("..") -}
438 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
439 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
440 @ ! {- output_on() if !$disabled{tests}; "" -}
443 @ ! {- output_off() if $disabled{tests}; "" -}
444 @ DEFINE SRCTOP {- sourcedir() -}
445 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
447 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
448 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
449 @ ! {- output_on() if !$disabled{tests}; "" -}
451 install : install_sw install_ssldirs install_docs
452 @ WRITE SYS$OUTPUT ""
453 @ WRITE SYS$OUTPUT "######################################################################"
454 @ WRITE SYS$OUTPUT ""
455 @ IF "$(DESTDIR)" .EQS. "" THEN -
456 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
457 WRITE SYS$OUTPUT "" ; -
458 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
459 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
460 WRITE SYS$OUTPUT "" )
461 @ IF "$(DESTDIR)" .NES. "" THEN -
462 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
463 WRITE SYS$OUTPUT "" ; -
464 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
465 WRITE SYS$OUTPUT staging_instdir ; -
466 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
467 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
468 WRITE SYS$OUTPUT staging_datadir ; -
469 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
470 WRITE SYS$OUTPUT "" ; -
471 WRITE SYS$OUTPUT "When in its final destination," ; -
472 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
473 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
474 WRITE SYS$OUTPUT "" )
477 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
479 uninstall : uninstall_docs uninstall_sw
481 # Because VMS wants the generation number (or *) to delete files, we can't
482 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
484 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
485 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
488 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
489 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
490 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
491 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
492 - DELETE [...]*.MAP;*
494 - DELETE [...]*.OBJ;*,*.LIS;*
495 - DELETE []CXX$DEMANGLER_DB.;*
496 - DELETE [.VMS]openssl_startup.com;*
497 - DELETE [.VMS]openssl_shutdown.com;*
498 - DELETE []vmsconfig.pm;*
501 - DELETE configdata.pm;*
502 - DELETE descrip.mms;*
506 @ ! {- output_off() if $disabled{makedepend}; "" -}
507 @ $(PERL) {- sourcefile("util", "add-depends.pl") -}
508 @ ! {- output_on() if $disabled{makedepend}; "" -}
510 # Install helper targets #############################################
512 install_sw : all install_shared _install_dev_ns -
513 install_engines _install_runtime_ns -
514 install_startup install_ivp
516 uninstall_sw : uninstall_shared _uninstall_dev_ns -
517 uninstall_engines _uninstall_runtime_ns -
518 uninstall_startup uninstall_ivp
520 install_docs : install_html_docs
522 uninstall_docs : uninstall_html_docs
524 install_ssldirs : check_INSTALLTOP
525 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
526 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
527 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
528 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
529 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
530 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
531 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
532 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
533 @ ! Install configuration file
534 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
535 ossl_dataroot:[000000]openssl.cnf-dist
536 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
537 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
538 ossl_dataroot:[000000]openssl.cnf
539 @ ! Install CTLOG configuration file
540 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
541 ossl_dataroot:[000000]ct_log_list.cnf-dist
542 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
543 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
544 ossl_dataroot:[000000]ct_log_list.cnf
546 install_shared : check_INSTALLTOP
547 @ {- output_off() if $disabled{shared}; "" -} !
548 @ WRITE SYS$OUTPUT "*** Installing shareable images"
549 @ ! Install shared (runtime) libraries
550 - CREATE/DIR ossl_installroot:[LIB.'arch']
552 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
554 @ {- output_on() if $disabled{shared}; "" -} !
556 _install_dev_ns : check_INSTALLTOP
557 @ WRITE SYS$OUTPUT "*** Installing development files"
558 @ ! Install header files
559 - CREATE/DIR ossl_installroot:[include.openssl]
560 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
561 @ ! Install static (development) libraries
562 - CREATE/DIR ossl_installroot:[LIB.'arch']
564 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
567 install_dev : install_shared _install_dev_ns
569 _install_runtime_ns : check_INSTALLTOP
570 @ ! Install the main program
571 - CREATE/DIR ossl_installroot:[EXE.'arch']
572 COPY/PROT=W:RE [.APPS]openssl.EXE -
573 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
575 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
576 @ ! {- output_on() if $disabled{apps}; "" -}
578 install_runtime : install_shared _install_runtime_ns
580 install_engines : check_INSTALLTOP
581 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
582 @ WRITE SYS$OUTPUT "*** Installing engines"
583 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
585 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
586 @{$unified_info{install}->{engines}}) -}
587 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
589 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
590 [.VMS]openssl_utils.com, check_INSTALLTOP
591 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
592 COPY/PROT=W:RE [.VMS]openssl_startup.com -
593 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
594 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
595 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
596 COPY/PROT=W:RE [.VMS]openssl_utils.com -
597 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
599 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
600 - CREATE/DIR ossl_installroot:[SYSTEST]
601 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
602 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
604 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
606 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
607 {- sourcefile("VMS", "openssl_startup.com.in") -} -
608 > [.VMS]openssl_startup.com
610 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
612 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
613 {- sourcefile("VMS", "openssl_utils.com.in") -} -
614 > [.VMS]openssl_utils.com
616 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
618 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
619 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
620 > [.VMS]openssl_shutdown.com
622 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
624 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
625 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
626 > [.VMS]openssl_ivp.com
628 vmsconfig.pm : configdata.pm
629 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
630 WRITE CONFIG "package vmsconfig;"
631 WRITE CONFIG "use strict; use warnings;"
632 WRITE CONFIG "use Exporter;"
633 WRITE CONFIG "our @ISA = qw(Exporter);"
634 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
635 WRITE CONFIG "our %config = ("
636 WRITE CONFIG " target => '","{- $config{target} -}","',"
637 WRITE CONFIG " version => '","{- $config{version} -}","',"
638 WRITE CONFIG " shlib_version_number => '","{- $config{shlib_version_number} -}","',"
639 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
640 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
641 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
642 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
643 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
644 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
646 WRITE CONFIG "our %target = ();"
647 WRITE CONFIG "our %disabled = ();"
648 WRITE CONFIG "our %withargs = ();"
649 WRITE CONFIG "our %unified_info = ();"
653 install_html_docs : check_INSTALLTOP
654 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
655 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
656 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
660 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
661 WRITE SYS$ERROR "INSTALLTOP should not be empty"
662 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
665 # Helper targets #####################################################
667 # Developer targets ##################################################
670 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
672 # Building targets ###################################################
674 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
675 perl configdata.pm -r
676 @ WRITE SYS$OUTPUT "*************************************************"
677 @ WRITE SYS$OUTPUT "*** ***"
678 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
679 @ WRITE SYS$OUTPUT "*** ***"
680 @ WRITE SYS$OUTPUT "*************************************************"
681 @ PIPE ( EXIT %X10000000 )
684 perl configdata.pm -r
688 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
690 # Helper function to figure out dependencies on libraries
691 # It takes a list of library names and outputs a list of dependencies
692 sub compute_lib_depends {
693 if ($disabled{shared}) {
694 return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_;
696 return map { $_ =~ /\.a$/
698 : $unified_info{sharednames}->{$_}.".EXE" } @_;
701 # Helper function to deal with inclusion directory specs.
702 # We have to deal with two things:
703 # 1. comma separation and no possibility of trailing comma
704 # 2. no inclusion directories given at all
705 # 3. long compiler command lines
706 # To resolve 1, we need to iterate through the sources of inclusion
707 # directories, and only add a comma when needed.
708 # To resolve 2, we need to have a variable that will hold the whole
709 # inclusion qualifier, or be the empty string if there are no inclusion
710 # directories. That's the symbol 'qual_includes' that's used in CPPFLAGS
711 # To resolve 3, we creata a logical name TMP_INCLUDES: to hold the list
712 # of inclusion directories.
714 # This function returns a list of two lists, one being the collection of
715 # commands to execute before the compiler is called, and the other being
716 # the collection of commands to execute after. It takes as arguments the
717 # collection of strings to include as directory specs.
724 'DELETE/SYMBOL/LOCAL qual_includes',
727 if (scalar @stuff > 0) {
728 push @before, 'tmp_includes := '.shift(@stuff);
730 push @before, 'tmp_add := '.shift(@stuff);
731 push @before, 'IF tmp_includes .NES. "" .AND. tmp_add .NES. "" THEN tmp_includes = tmp_includes + ","';
732 push @before, 'tmp_includes = tmp_includes + tmp_add';
734 push @before, "IF tmp_includes .NES. \"\" THEN DEFINE tmp_includes 'tmp_includes'";
735 push @before, 'IF tmp_includes .NES. "" THEN qual_includes := /INCLUDE=(tmp_includes:)';
736 push @before, 'DELETE/SYMBOL/LOCAL tmp_includes';
737 push @before, 'DELETE/SYMBOL/LOCAL tmp_add';
738 push @after, 'DEASSIGN tmp_includes:'
740 return ([ @before ], [ @after ]);
745 (my $target = $args{src}) =~ s/\.[sS]$/.asm/;
746 my $generator = join(" ", @{$args{generator}});
747 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
748 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
750 if ($target !~ /\.asm$/) {
751 if ($args{generator}->[0] =~ m|^.*\.in$|) {
752 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
753 "util", "dofile.pl")),
754 rel2abs($config{builddir}));
756 $target : $args{generator}->[0] $deps
757 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
758 "-o$target{build_file}" $generator > \$\@
762 $target : $args{generator}->[0] $deps
763 \$(PERL)$generator_incs $generator > \$\@
767 if ($args{generator}->[0] =~ /\.pl$/) {
768 $generator = '$(PERL)'.$generator_incs.' '.$generator;
769 } elsif ($args{generator}->[0] =~ /\.S$/) {
772 die "Generator type for $src unknown: $generator\n";
776 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
777 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
778 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
779 } -> {$args{intent}};
780 my @incs_cmds = includes({ lib => '$(LIB_INCLUDES)',
781 dso => '$(DSO_INCLUDES)',
782 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
786 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
787 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
788 if (defined($generator)) {
789 # If the target is named foo.S in build.info, we want to
790 # end up generating foo.s in two steps.
791 if ($args{src} =~ /\.S$/) {
793 $target : $args{generator}->[0] $deps
796 PIPE \$(CPP) $cppflags \$\@-S | -
797 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
805 $target : $args{generator}->[0] $deps
810 $target : $args{generator}->[0] $deps
812 SHOW SYMBOL qual_includes
813 PIPE \$(CPP) $cppflags $args{generator}->[0] | -
814 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
822 my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x
823 } ( @{$args{srcs}} );
824 (my $obj = $args{obj}) =~ s|\.o$||;
825 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
827 # Because VMS C isn't very good at combining a /INCLUDE path with
828 # #includes having a relative directory (like '#include "../foo.h"),
829 # the best choice is to move to the first source file's intended
830 # directory before compiling, and make sure to write the object file
831 # in the correct position (important when the object tree is other
832 # than the source tree).
833 my $forward = dirname($args{srcs}->[0]);
834 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
835 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
836 my $objn = basename($obj);
838 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
839 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
840 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
842 if ($srcs[0] =~ /\.asm$/) {
843 my $asflags = { lib => ' $(LIB_ASFLAGS)',
844 dso => ' $(DSO_ASFLAGS)',
845 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
850 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
851 SET DEFAULT $backward
856 if ($args{installed}) {
857 $cflags = { lib => '$(LIB_CFLAGS)',
858 dso => '$(DSO_CFLAGS)',
859 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
861 $cflags = { lib => '$(NO_INST_LIB_CFLAGS)',
862 dso => '$(NO_INST_DSO_CFLAGS)',
863 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
865 $cflags .= { lib => '$(LIB_CPPFLAGS)',
866 dso => '$(DSO_CPPFLAGS)',
867 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
869 my @incs_cmds = includes({ lib => '$(LIB_INCLUDES)',
870 dso => '$(DSO_INCLUDES)',
871 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
874 file_name_is_absolute($_)
875 ? $_ : catdir($backward,$_)
877 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
878 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
879 my $depbuild = $disabled{makedepend} ? ""
880 : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
887 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
889 SET DEFAULT $backward
893 . ($disabled{makedepend} ? "" : <<"EOF"
894 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
895 RENAME $obj.tmp-D $obj.d )
896 \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
902 my $lib = $args{lib};
903 my $shlib = $args{shlib};
904 my $libd = dirname($lib);
905 my $libn = basename($lib);
906 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x }
907 grep { $_ =~ m|\.o$| }
909 my @defs = grep { $_ =~ /\.opt$/ } @{$args{objs}};
910 my @deps = compute_lib_depends(@{$args{deps}});
911 die "More than one symbol vector" if scalar @defs > 1;
912 my $deps = join(", -\n\t\t", @defs, @deps);
913 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
914 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
915 "VMS", "translatesyms.pl")),
916 rel2abs($config{builddir}));
917 # The "[]" hack is because in .OPT files, each line inherits the
918 # previous line's file spec as default, so if no directory spec
919 # is present in the current line and the previous line has one that
920 # doesn't apply, you're in for a surprise.
922 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
923 "WRITE OPT_FILE \"$x" } @objs).
926 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
927 $x =~ s|(\.EXE)|$1/SHARE|;
928 $x =~ s|(\.OLB)|$1/LIB|;
929 "WRITE OPT_FILE \"$x\"" } @deps)
932 $shlib.EXE : $lib.OLB $deps
933 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
934 OPEN/WRITE/SHARE=READ OPT_FILE $lib-components.OPT
938 LINK \$(LIB_LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
939 $lib-components.OPT/OPT \$(LIB_EX_LIBS)
940 DELETE $defs[0]-translated;*,$lib-components.OPT;*
941 PURGE $shlib.EXE,$shlib.MAP
943 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
944 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
950 my $lib = $args{lib};
951 my $libd = dirname($lib);
952 my $libn = basename($lib);
953 (my $libn_nolib = $libn) =~ s/^lib//;
954 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
955 my @deps = compute_lib_depends(@{$args{deps}});
956 my $deps = join(", -\n\t\t", @objs, @deps);
957 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
958 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
959 "VMS", "engine.opt")),
960 rel2abs($config{builddir}));
961 # The "[]" hack is because in .OPT files, each line inherits the
962 # previous line's file spec as default, so if no directory spec
963 # is present in the current line and the previous line has one that
964 # doesn't apply, you're in for a surprise.
966 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
967 "WRITE OPT_FILE \"$x" } @objs).
970 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
971 $x =~ s|(\.EXE)|$1/SHARE|;
972 $x =~ s|(\.OLB)|$1/LIB|;
973 "WRITE OPT_FILE \"$x\"" } @deps)
977 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
978 TYPE $engine_opt /OUTPUT=OPT_FILE:
982 LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(DSO_EX_LIBS)
983 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
985 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
986 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
992 (my $lib = $args{lib}) =~ s/\.a$//;
993 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
994 my $objs = join(", -\n\t\t", @objs);
995 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_" }
999 LIBRARY/CREATE/OBJECT $lib.OLB
1006 my $bin = $args{bin};
1007 my $bind = dirname($bin);
1008 my $binn = basename($bin);
1009 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
1010 my $objs = join(",", @objs);
1011 my @deps = compute_lib_depends(@{$args{deps}});
1012 my $deps = join(", -\n\t\t", @objs, @deps);
1014 my $olb_count = scalar grep(m|\.OLB$|, @deps);
1015 my $analyse_objs = "@ !";
1016 if ($olb_count > 0) {
1018 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1019 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
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 @lines = ();
1031 my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1032 if ($x =~ m|\.EXE$|) {
1033 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1034 } elsif ($x =~ m|\.OLB$|) {
1035 (my $l = $x) =~ s/\W/_/g;
1037 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB\$(INCLUDE_MAIN_$l)\"",
1038 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1043 # The linking commands looks a bit complex, but it's for good reason.
1044 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1045 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1046 # the linker will warn about it, loudly, and will then choose to pick
1047 # the first copy encountered (the one in bar.obj in this example).
1048 # On Unix and on Windows, the corresponding maneuvre goes through
1049 # silently with the same effect.
1050 # With some test programs, made for checking the internals of OpenSSL,
1051 # we do this kind of linking deliberately, picking a few specific object
1052 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1053 # otherwise unreachable (since the shareable images only exports the
1054 # symbols listed in [.util]*.num), and then with the shared libraries
1055 # themselves. So we need to silence the warning about multiply defined
1056 # symbols, to mimic the way linking work on Unix and Windows, and so
1057 # the build isn't interrupted (MMS stops when warnings are signaled,
1058 # by default), and so someone building doesn't have to worry where it
1059 # isn't necessary. If there are other warnings, however, we show them
1060 # and let it break the build.
1064 @ OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
1068 TYPE $bin.opt ! For debugging
1069 - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
1070 LINK \$(BIN_LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(BIN_EX_LIBS) ; -
1071 link_status = \$status ; link_severity = link_status .AND. 7
1072 @ search_severity = 1
1073 -@ IF link_severity .EQ. 0 THEN -
1074 pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | -
1075 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1076 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1077 search_severity = \$severity
1078 @ ! search_severity is 3 when the last search didn't find any matching
1079 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1080 @ ! If that was the result, we pretend linking got through without
1081 @ ! fault or warning.
1082 @ IF search_severity .EQ. 3 THEN link_severity = 1
1083 @ ! At this point, if link_severity shows that there was a fault
1084 @ ! or warning, make sure to restore the linking status.
1085 -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG
1086 -@ DELETE $bin.LINKLOG;*
1087 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1088 - PURGE $bin.EXE,$bin.OPT
1090 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1091 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1097 my $script = $args{script};
1098 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1099 my $sources = join(" ", @{$args{sources}});
1100 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1101 "util", "dofile.pl")),
1102 rel2abs($config{builddir}));
1105 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1106 "-o$target{build_file}" $sources > $script
1107 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1111 "" # Important! This becomes part of the template result.