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} -}:
170 # Where modules reside, for C
171 MODULESDIR_C={- platform->osslprefix() -}MODULES{- $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 'MODULESDIR="""$(MODULESDIR_C)"""'),
233 '$(CNF_DEFINES)', '$(DEFINES)') -}
234 LIB_INCLUDES={- our $lib_includes =
235 join(',', @{$target{lib_includes}},
236 @{$target{shared_includes}},
237 @{$config{lib_includes}},
238 @{$config{shared_includes}}) -}
239 LIB_CPPFLAGS={- our $lib_cppflags =
240 join('', $target{lib_cppflags} || (),
241 $target{shared_cppflags} || (),
242 @{$config{lib_cppflags}},
243 @{$config{shared_cppflag}});
244 join('', "'qual_includes'",
245 '/DEFINE=(__dummy$(LIB_DEFINES))',
247 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
248 LIB_CFLAGS={- join('', $target{lib_cflags} || (),
249 $target{shared_cflag} || (),
250 @{$config{lib_cflags}},
251 @{$config{shared_cflag}},
252 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
253 LIB_LDFLAGS={- join('', $target{lib_lflags} || (),
254 $target{shared_ldflag} || (),
255 @{$config{lib_lflags}},
256 @{$config{shared_ldflag}},
257 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
258 LIB_EX_LIBS=$(CNF_EX_LIBS)$(EX_LIBS)
259 DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (),
260 $target{module_asflags} || (),
261 @{$config{dso_asflags}},
262 @{$config{module_asflags}},
263 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
264 DSO_DEFINES={- join('', (map { ",$_" } @{$target{dso_defines}},
265 @{$target{module_defines}},
266 @{$config{dso_defines}},
267 @{$config{module_defines}}),
268 '$(CNF_DEFINES)', '$(DEFINES)') -}
269 DSO_INCLUDES={- join(',', @{$target{dso_includes}},
270 @{$target{module_includes}},
271 @{$config{dso_includes}},
272 @{$config{module_includes}}) -}
273 DSO_CPPFLAGS={- join('', "'qual_includes'",
274 '/DEFINE=(__dummy$(DSO_DEFINES))',
275 $target{dso_cppflags} || (),
276 $target{module_cppflags} || (),
277 @{$config{dso_cppflags}},
278 @{$config{module_cppflags}},
279 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
280 DSO_CFLAGS={- join('', $target{dso_cflags} || (),
281 $target{module_cflags} || (),
282 @{$config{dso_cflags}},
283 @{$config{module_cflags}},
284 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
285 DSO_LDFLAGS={- join('', $target{dso_lflags} || (),
286 $target{module_ldflags} || (),
287 @{$config{dso_lflags}},
288 @{$config{module_ldflags}},
289 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
290 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
291 BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
292 @{$config{bin_asflags}},
293 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
294 BIN_DEFINES={- join('', (map { ",$_" } @{$target{bin_defines}},
295 @{$config{bin_defines}}),
296 '$(CNF_DEFINES)', '$(DEFINES)') -}
297 BIN_INCLUDES={- join(',', @{$target{bin_includes}},
298 @{$config{bin_includes}}) -}
299 BIN_CPPFLAGS={- join('', "'qual_includes'",
300 '/DEFINE=(__dummy$(DSO_DEFINES))',
301 $target{bin_cppflags} || (),
302 @{$config{bin_cppflag}},
303 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
304 BIN_CFLAGS={- join('', $target{bin_cflags} || (),
305 @{$config{bin_cflags}},
306 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
307 BIN_LDFLAGS={- join('', $target{bin_lflags} || (),
308 @{$config{bin_lflags}} || (),
309 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
310 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
311 NO_INST_LIB_CFLAGS={- join('', $target{no_inst_lib_cflags}
312 // $target{lib_cflags}
314 $target{shared_cflag} || (),
315 @{$config{lib_cflags}},
316 @{$config{shared_cflag}},
317 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
318 NO_INST_DSO_CFLAGS={- join('', $target{no_inst_dso_cflags}
319 // $target{dso_cflags}
321 $target{no_inst_module_cflags}
322 // $target{module_cflags}
324 @{$config{dso_cflags}},
325 @{$config{module_cflags}},
326 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
327 NO_INST_BIN_CFLAGS={- join('', $target{no_inst_bin_cflags}
328 // $target{bin_cflags}
330 @{$config{bin_cflags}},
331 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
333 PERLASM_SCHEME={- $target{perlasm_scheme} -}
335 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
336 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags2.$cppflags1) =~ s|"|""|g;
337 (my $d = $lib_defines.$defines2.$defines1) =~ s|"|""|g;
338 my $i = join(',', $lib_includes || (), $includes2 || (),
341 $x .= "/INCLUDE=($i)" if $i;
342 $x .= "/DEFINE=($d)" if $d;
345 # .FIRST and .LAST are special targets with MMS and MMK.
346 # The defines in there are for C. includes that look like
349 # #include <openssl/foo.h>
350 # #include "internal/bar.h"
352 # will use the logical names to find the files. Expecting
353 # DECompHP C to find files in subdirectories of whatever was
354 # given with /INCLUDE is a fantasy, unfortunately.
357 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
358 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
359 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
360 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
361 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
362 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
363 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
364 $(NODEBUG) staging_dir = "$(DESTDIR)"
365 $(NODEBUG) staging_instdir = ""
366 $(NODEBUG) staging_datadir = ""
367 $(NODEBUG) IF staging_dir .NES. "" THEN -
368 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
369 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
370 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
371 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
372 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
373 $(NODEBUG) IF staging_dir .NES. "" THEN -
374 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
375 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
376 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
377 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
378 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
380 $(NODEBUG) ! Installation logical names
382 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
383 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
384 $(NODEBUG) DEFINE ossl_installroot 'installtop'
385 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
387 $(NODEBUG) ! Figure out the architecture
389 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
391 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
392 $(NODEBUG) ! running programs can use them.
394 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
397 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
398 $(NODEBUG) DEASSIGN ossl_dataroot
399 $(NODEBUG) DEASSIGN ossl_installroot
400 $(NODEBUG) DEASSIGN internal
401 $(NODEBUG) DEASSIGN openssl
403 @ ! MMS cannot handle no actions...
405 # The main targets ###################################################
407 {- dependmagic('all'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
408 {- dependmagic('build_libs'); -} : build_libs_nodep
409 {- dependmagic('build_modules'); -} : build_modules_nodep
410 {- dependmagic('build_programs'); -} : build_programs_nodep
412 build_generated : $(GENERATED_MANDATORY)
413 build_libs_nodep : $(LIBS), $(SHLIBS)
414 build_modules_nodep : $(MODULES)
415 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
417 # Kept around for backward compatibility
418 build_apps build_tests : build_programs
420 # Convenience target to prebuild all generated files, not just the mandatory
422 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
423 @ ! {- output_off() if $disabled{makedepend}; "" -}
424 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
425 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
426 @ WRITE SYS$OUTPUT " then make will fail..."
427 @ ! {- output_on() if $disabled{makedepend}; "" -}
430 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep
431 @ ! {- output_off() if $disabled{tests}; "" -}
432 SET DEFAULT [.test]{- move("test") -}
433 CREATE/DIR [.test-runs]
434 DEFINE SRCTOP {- sourcedir() -}
435 DEFINE BLDTOP {- builddir() -}
436 DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
437 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
438 DEFINE OPENSSL_DEBUG_MEMORY "on"
439 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
440 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
441 DEASSIGN OPENSSL_DEBUG_MEMORY
442 DEASSIGN OPENSSL_ENGINES
445 SET DEFAULT [-]{- move("..") -}
446 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
447 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
448 @ ! {- output_on() if !$disabled{tests}; "" -}
451 @ ! {- output_off() if $disabled{tests}; "" -}
452 @ DEFINE SRCTOP {- sourcedir() -}
453 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
455 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
456 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
457 @ ! {- output_on() if !$disabled{tests}; "" -}
459 install : install_sw install_ssldirs install_docs
460 @ WRITE SYS$OUTPUT ""
461 @ WRITE SYS$OUTPUT "######################################################################"
462 @ WRITE SYS$OUTPUT ""
463 @ IF "$(DESTDIR)" .EQS. "" THEN -
464 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
465 WRITE SYS$OUTPUT "" ; -
466 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
467 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
468 WRITE SYS$OUTPUT "" )
469 @ IF "$(DESTDIR)" .NES. "" THEN -
470 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
471 WRITE SYS$OUTPUT "" ; -
472 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
473 WRITE SYS$OUTPUT staging_instdir ; -
474 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
475 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
476 WRITE SYS$OUTPUT staging_datadir ; -
477 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
478 WRITE SYS$OUTPUT "" ; -
479 WRITE SYS$OUTPUT "When in its final destination," ; -
480 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
481 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
482 WRITE SYS$OUTPUT "" )
485 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
487 uninstall : uninstall_docs uninstall_sw
489 # Because VMS wants the generation number (or *) to delete files, we can't
490 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
492 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
493 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
496 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
497 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
498 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
499 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
500 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
501 - DELETE [...]*.MAP;*
503 - DELETE [...]*.OBJ;*,*.LIS;*
504 - DELETE []CXX$DEMANGLER_DB.;*
505 - DELETE [.VMS]openssl_startup.com;*
506 - DELETE [.VMS]openssl_shutdown.com;*
507 - DELETE []vmsconfig.pm;*
510 - DELETE configdata.pm;*
511 - DELETE descrip.mms;*
515 @ ! {- output_off() if $disabled{makedepend}; "" -}
516 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "VMS C"
517 @ ! {- output_on() if $disabled{makedepend}; "" -}
519 # Install helper targets #############################################
521 install_sw : install_dev install_engines install_runtime -
522 install_startup install_ivp
524 uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime -
525 uninstall_startup uninstall_ivp
527 install_docs : install_html_docs
529 uninstall_docs : uninstall_html_docs
531 install_ssldirs : check_INSTALLTOP
532 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
533 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
534 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
535 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
536 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
537 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
538 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
539 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
540 @ ! Install configuration file
541 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
542 ossl_dataroot:[000000]openssl.cnf-dist
543 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
544 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
545 ossl_dataroot:[000000]openssl.cnf
546 @ ! Install CTLOG configuration file
547 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
548 ossl_dataroot:[000000]ct_log_list.cnf-dist
549 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
550 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
551 ossl_dataroot:[000000]ct_log_list.cnf
553 install_dev : check_INSTALLTOP install_runtime_libs
554 @ WRITE SYS$OUTPUT "*** Installing development files"
555 @ ! Install header files
556 - CREATE/DIR ossl_installroot:[include.openssl]
557 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
558 @ ! Install static (development) libraries
559 - CREATE/DIR ossl_installroot:[LIB.'arch']
561 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
564 install_engines : check_INSTALLTOP install_runtime_libs build_modules
565 @ {- output_off() unless scalar @install_engines; "" -} !
566 @ WRITE SYS$OUTPUT "*** Installing ENGINE modules"
567 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
569 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
571 @ {- output_on() unless scalar @install_engines; "" -} !
573 install_runtime : install_programs
575 install_runtime_libs : check_INSTALLTOP build_libs
576 @ {- output_off() if $disabled{shared}; "" -} !
577 @ WRITE SYS$OUTPUT "*** Installing shareable images"
578 @ ! Install shared (runtime) libraries
579 - CREATE/DIR ossl_installroot:[LIB.'arch']
581 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
583 @ {- output_on() if $disabled{shared}; "" -} !
585 install_programs : check_INSTALLTOP install_runtime_libs build_programs
586 @ {- output_off() if $disabled{apps}; "" -} !
587 @ ! Install the main program
588 - CREATE/DIR ossl_installroot:[EXE.'arch']
589 COPY/PROT=W:RE [.APPS]openssl.EXE -
590 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
592 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
593 @ ! {- output_on() if $disabled{apps}; "" -}
595 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
596 [.VMS]openssl_utils.com, check_INSTALLTOP
597 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
598 COPY/PROT=W:RE [.VMS]openssl_startup.com -
599 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
600 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
601 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
602 COPY/PROT=W:RE [.VMS]openssl_utils.com -
603 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
605 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
606 - CREATE/DIR ossl_installroot:[SYSTEST]
607 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
608 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
610 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
612 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
613 {- sourcefile("VMS", "openssl_startup.com.in") -} -
614 > [.VMS]openssl_startup.com
616 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
618 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
619 {- sourcefile("VMS", "openssl_utils.com.in") -} -
620 > [.VMS]openssl_utils.com
622 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
624 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
625 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
626 > [.VMS]openssl_shutdown.com
628 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
630 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
631 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
632 > [.VMS]openssl_ivp.com
634 vmsconfig.pm : configdata.pm
635 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
636 WRITE CONFIG "package vmsconfig;"
637 WRITE CONFIG "use strict; use warnings;"
638 WRITE CONFIG "use Exporter;"
639 WRITE CONFIG "our @ISA = qw(Exporter);"
640 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
641 WRITE CONFIG "our %config = ("
642 WRITE CONFIG " target => '","{- $config{target} -}","',"
643 WRITE CONFIG " version => '","{- $config{version} -}","',"
644 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
645 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
646 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
647 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
648 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
649 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
650 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
652 WRITE CONFIG "our %target = ();"
653 WRITE CONFIG "our %disabled = ();"
654 WRITE CONFIG "our %withargs = ();"
655 WRITE CONFIG "our %unified_info = ();"
659 install_html_docs : check_INSTALLTOP
660 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
661 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
662 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
666 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
667 WRITE SYS$ERROR "INSTALLTOP should not be empty"
668 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
671 # Helper targets #####################################################
673 # Developer targets ##################################################
676 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
678 # Building targets ###################################################
680 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
681 perl configdata.pm -r
682 @ WRITE SYS$OUTPUT "*************************************************"
683 @ WRITE SYS$OUTPUT "*** ***"
684 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
685 @ WRITE SYS$OUTPUT "*** ***"
686 @ WRITE SYS$OUTPUT "*************************************************"
687 @ PIPE ( EXIT %X10000000 )
690 perl configdata.pm -r
694 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
696 # Helper function to figure out dependencies on libraries
697 # It takes a list of library names and outputs a list of dependencies
698 sub compute_lib_depends {
699 # Depending on shared libraries:
700 # On Windows POSIX layers, we depend on {libname}.dll.a
701 # On Unix platforms, we depend on {shlibname}.so
703 { lib => platform->sharedlib($_) // platform->staticlib($_),
704 attrs => $unified_info{attributes}->{$_} }
708 # Helper function to deal with inclusion directory specs.
709 # We have to deal with two things:
710 # 1. comma separation and no possibility of trailing comma
711 # 2. no inclusion directories given at all
712 # 3. long compiler command lines
713 # To resolve 1, we need to iterate through the sources of inclusion
714 # directories, and only add a comma when needed.
715 # To resolve 2, we need to have a variable that will hold the whole
716 # inclusion qualifier, or be the empty string if there are no inclusion
717 # directories. That's the symbol 'qual_includes' that's used in CPPFLAGS
718 # To resolve 3, we creata a logical name TMP_INCLUDES: to hold the list
719 # of inclusion directories.
721 # This function returns a list of two lists, one being the collection of
722 # commands to execute before the compiler is called, and the other being
723 # the collection of commands to execute after. It takes as arguments the
724 # collection of strings to include as directory specs.
731 'DELETE/SYMBOL/LOCAL qual_includes',
734 if (scalar @stuff > 0) {
735 push @before, 'tmp_includes := '.shift(@stuff);
737 push @before, 'tmp_add := '.shift(@stuff);
738 push @before, 'IF tmp_includes .NES. "" .AND. tmp_add .NES. "" THEN tmp_includes = tmp_includes + ","';
739 push @before, 'tmp_includes = tmp_includes + tmp_add';
741 push @before, "IF tmp_includes .NES. \"\" THEN DEFINE tmp_includes 'tmp_includes'";
742 push @before, 'IF tmp_includes .NES. "" THEN qual_includes := /INCLUDE=(tmp_includes:)';
743 push @before, 'DELETE/SYMBOL/LOCAL tmp_includes';
744 push @before, 'DELETE/SYMBOL/LOCAL tmp_add';
745 push @after, 'DEASSIGN tmp_includes:'
747 return ([ @before ], [ @after ]);
752 my $generator = join(" ", @{$args{generator}});
753 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
754 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
756 if (platform->isdef($args{src})) {
757 my $target = platform->def($args{src});
758 my $mkdef = sourcefile('util', 'mkdef.pl');
759 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
761 $args{generator}->[1] || basename($args{product}, '.EXE');
762 my $case_insensitive =
763 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
764 ? '' : ' --case-insensitive';
766 $target : $args{generator}->[0] $deps $mkdef
767 \$(PERL) $mkdef$ord_ver --ordinals $args{generator}->[0] --name $ord_name "--OS" "VMS"$case_insensitive > $target
769 } elsif (!platform->isasm($args{src})) {
770 my $target = $args{src};
771 if ($args{generator}->[0] =~ m|^.*\.in$|) {
772 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
773 "util", "dofile.pl")),
774 rel2abs($config{builddir}));
776 $target : $args{generator}->[0] $deps
777 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
778 "-o$target{build_file}" $generator > \$\@
782 $target : $args{generator}->[0] $deps
783 \$(PERL)$generator_incs $generator > \$\@
787 my $target = platform->asm($args{src});
788 if ($args{generator}->[0] =~ /\.pl$/) {
789 $generator = '$(PERL)'.$generator_incs.' '.$generator;
790 } elsif ($args{generator}->[0] =~ /\.S$/) {
793 die "Generator type for $src unknown: $generator\n";
797 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
798 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
799 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
800 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
801 } -> {$args{intent}};
802 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
803 lib => '$(LIB_INCLUDES)',
804 dso => '$(DSO_INCLUDES)',
805 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
809 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
810 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
811 my $defs = join("", map { ",".$_ } @{$args{defs}});
812 if (defined($generator)) {
813 # If the target is named foo.S in build.info, we want to
814 # end up generating foo.s in two steps.
815 if ($args{src} =~ /\.S$/) {
817 $target : $args{generator}->[0] $deps
820 \@ extradefines = "$defs"
821 PIPE \$(CPP) $cppflags \$\@-S | -
822 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
823 \@ DELETE/SYMBOL/LOCAL extradefines
831 $target : $args{generator}->[0] $deps
836 $target : $args{generator}->[0] $deps
838 \@ extradefines = "$defs"
839 SHOW SYMBOL qual_includes
840 PIPE \$(CPP) $cppflags $args{generator}->[0] | -
841 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
842 \@ DELETE/SYMBOL/LOCAL extradefines
850 my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x } ( @{$args{srcs}} );
851 my $obj = platform->obj($args{obj});
852 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
854 # Because VMS C isn't very good at combining a /INCLUDE path with
855 # #includes having a relative directory (like '#include "../foo.h"),
856 # the best choice is to move to the first source file's intended
857 # directory before compiling, and make sure to write the object file
858 # in the correct position (important when the object tree is other
859 # than the source tree).
860 my $forward = dirname($args{srcs}->[0]);
861 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
862 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
863 my $objn = basename($obj, platform->objext());
865 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
866 my $before = $unified_info{before}->{$obj} || "\@ !";
867 my $after = $unified_info{after}->{$obj} || "\@ !";
869 if ($srcs[0] =~ /\.asm$/) {
870 my $asflags = { shlib => ' $(LIB_ASFLAGS)',
871 lib => ' $(LIB_ASFLAGS)',
872 dso => ' $(DSO_ASFLAGS)',
873 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
878 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
879 SET DEFAULT $backward
884 if ($args{attrs}->{noinst}) {
885 $cflags = { shlib => '$(NO_INST_LIB_CFLAGS)',
886 lib => '$(NO_INST_LIB_CFLAGS)',
887 dso => '$(NO_INST_DSO_CFLAGS)',
888 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
890 $cflags = { shlib => '$(LIB_CFLAGS)',
891 lib => '$(LIB_CFLAGS)',
892 dso => '$(DSO_CFLAGS)',
893 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
895 $cflags .= { shlib => '$(LIB_CPPFLAGS)',
896 lib => '$(LIB_CPPFLAGS)',
897 dso => '$(DSO_CPPFLAGS)',
898 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
899 my $defs = join("", map { ",".$_ } @{$args{defs}});
900 my $asflags = { shlib => ' $(LIB_ASFLAGS)',
901 lib => ' $(LIB_ASFLAGS)',
902 dso => ' $(DSO_ASFLAGS)',
903 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
905 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
906 lib => '$(LIB_INCLUDES)',
907 dso => '$(DSO_INCLUDES)',
908 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
911 file_name_is_absolute($_)
912 ? $_ : catdir($backward,$_)
914 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
915 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
917 if ($srcs[0] =~ /\.asm$/) {
922 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
923 SET DEFAULT $backward
927 } elsif ($srcs[0] =~ /.S$/) {
933 \@ extradefines = "$defs"
934 PIPE \$(CPP) ${cflags} $srcs | -
935 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
937 \@ DELETE/SYMBOL/LOCAL extradefines
939 SET DEFAULT $backward
941 \$(AS) $asflags \$(ASOUTFLAG)$obj.OBJ $obj.asm
946 my $depbuild = $disabled{makedepend} ? ""
947 : " /MMS=(FILE=${objd}${objn}.D,TARGET=$obj)";
954 \@ extradefines = "$defs"
955 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
956 \@ DELETE/SYMBOL/LOCAL extradefines
958 SET DEFAULT $backward
965 my $shlibname = platform->sharedname($args{lib});
966 my $shlib = platform->sharedlib($args{lib});
967 my @objs = map { platform->convertext($_) }
968 grep { platform->isobj($_) }
970 my @defs = map { platform->convertext($_) }
971 grep { platform->isdef($_) }
973 my @deps = compute_lib_depends(@{$args{deps}});
974 die "More than one symbol vector" if scalar @defs > 1;
975 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
976 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
977 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
978 "VMS", "translatesyms.pl")),
979 rel2abs($config{builddir}));
980 # The "[]" hack is because in .OPT files, each line inherits the
981 # previous line's file spec as default, so if no directory spec
982 # is present in the current line and the previous line has one that
983 # doesn't apply, you're in for a surprise.
985 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
986 "WRITE OPT_FILE \"$x" } @objs).
989 join("\n\t", map { my $x = $_->{lib} =~ /\[/
990 ? $_->{lib} : "[]".$_->{lib};
991 $x =~ s|(\.EXE)|$1/SHARE|;
992 $x =~ s|(\.OLB)|$1/LIB|;
993 "WRITE OPT_FILE \"$x\"" } @deps)
997 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
998 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
1002 LINK \$(LIB_LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
1003 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1004 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1005 PURGE $shlibname.EXE,$shlibname.MAP
1007 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1008 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1014 my $dsoname = platform->dsoname($args{lib});
1015 my $dso = platform->dso($args{lib});
1016 my @objs = map { platform->convertext($_) }
1017 grep { platform->isobj($_) }
1019 my @defs = map { platform->convertext($_) }
1020 grep { platform->isdef($_) }
1022 my @deps = compute_lib_depends(@{$args{deps}});
1023 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1024 die "More than one symbol vector" if scalar @defs > 1;
1025 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1026 # The "[]" hack is because in .OPT files, each line inherits the
1027 # previous line's file spec as default, so if no directory spec
1028 # is present in the current line and the previous line has one that
1029 # doesn't apply, you're in for a surprise.
1031 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1032 "WRITE OPT_FILE \"$x" } @objs).
1035 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1036 ? $_->{lib} : "[]".$_->{lib};
1037 $x =~ s|(\.EXE)|$1/SHARE|;
1038 $x =~ s|(\.OLB)|$1/LIB|;
1039 "WRITE OPT_FILE \"$x\"" } @deps)
1043 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1047 LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $defs[0]/OPT,-
1048 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1049 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1051 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1052 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1058 my $lib = platform->staticlib($args{lib});
1059 my @objs = map { platform->convertext($_) }
1060 grep { platform->isobj($_) }
1062 my $objs = join(", -\n\t\t", @objs);
1063 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1066 LIBRARY/CREATE/OBJECT $lib
1073 my $bin = platform->bin($args{bin});
1074 my $binname = platform->binname($args{bin});
1075 my @objs = map { platform->convertext($_) }
1076 grep { platform->isobj($_) }
1078 my $objs = join(",", @objs);
1079 my @deps = compute_lib_depends(@{$args{deps}});
1080 my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1082 my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1083 my $analyse_objs = "@ !";
1084 if ($olb_count > 0) {
1086 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1087 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1089 # The "[]" hack is because in .OPT files, each line inherits the
1090 # previous line's file spec as default, so if no directory spec
1091 # is present in the current line and the previous line has one that
1092 # doesn't apply, you're in for a surprise.
1094 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1095 "\@ WRITE OPT_FILE \"$x" } @objs).
1098 join("\n\t", "WRITE OPT_FILE \"CASE_SENSITIVE=YES\"",
1099 map { my @lines = ();
1101 my $x = $_->{lib} =~ /\[/
1102 ? $_->{lib} : "[]".$_->{lib};
1103 if ($x =~ m|\.EXE$|) {
1104 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1105 } elsif ($x =~ m|\.OLB$|) {
1106 # Special hack to include the MAIN object
1107 # module explicitly. This will only be done
1108 # if there isn't a 'main' in the program's
1109 # object modules already.
1110 my $main = $_->{attrs}->{has_main}
1111 ? '/INCLUDE=main' : '';
1113 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB$main\"",
1114 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1119 # The linking commands looks a bit complex, but it's for good reason.
1120 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1121 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1122 # the linker will warn about it, loudly, and will then choose to pick
1123 # the first copy encountered (the one in bar.obj in this example).
1124 # On Unix and on Windows, the corresponding maneuvre goes through
1125 # silently with the same effect.
1126 # With some test programs, made for checking the internals of OpenSSL,
1127 # we do this kind of linking deliberately, picking a few specific object
1128 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1129 # otherwise unreachable (since the shareable images only exports the
1130 # symbols listed in [.util]*.num), and then with the shared libraries
1131 # themselves. So we need to silence the warning about multiply defined
1132 # symbols, to mimic the way linking work on Unix and Windows, and so
1133 # the build isn't interrupted (MMS stops when warnings are signaled,
1134 # by default), and so someone building doesn't have to worry where it
1135 # isn't necessary. If there are other warnings, however, we show them
1136 # and let it break the build.
1140 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1144 TYPE $binname.OPT ! For debugging
1145 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1146 LINK \$(BIN_LDFLAGS)/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1147 link_status = \$status ; link_severity = link_status .AND. 7
1148 @ search_severity = 1
1149 -@ IF link_severity .EQ. 0 THEN -
1150 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1151 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1152 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1153 search_severity = \$severity
1154 @ ! search_severity is 3 when the last search didn't find any matching
1155 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1156 @ ! If that was the result, we pretend linking got through without
1157 @ ! fault or warning.
1158 @ IF search_severity .EQ. 3 THEN link_severity = 1
1159 @ ! At this point, if link_severity shows that there was a fault
1160 @ ! or warning, make sure to restore the linking status.
1161 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1162 -@ DELETE $binname.LINKLOG;*
1163 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1164 - PURGE $bin,$binname.OPT
1166 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1167 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1173 my $script = $args{script};
1174 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1175 my $sources = join(" ", @{$args{sources}});
1176 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1177 "util", "dofile.pl")),
1178 rel2abs($config{builddir}));
1181 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1182 "-o$target{build_file}" $sources > $script
1183 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1187 "" # Important! This becomes part of the template result.