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