]> git.ipfire.org Git - thirdparty/openssl.git/blob - Configurations/descrip.mms.tmpl
Configurations/descrip.mms.tmpl: avoid enormous PIPE commands
[thirdparty/openssl.git] / Configurations / descrip.mms.tmpl
1 ## descrip.mms to build OpenSSL on OpenVMS
2 ##
3 ## {- join("\n## ", @autowarntext) -}
4 {-
5 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
6 use File::Basename;
7
8 (our $osslprefix_q = platform->osslprefix()) =~ s/\$/\\\$/;
9
10 our $sover_dirname = platform->shlib_version_as_filename();
11 our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
12
13 our $sourcedir = $config{sourcedir};
14 our $builddir = $config{builddir};
15 sub sourcefile {
16 catfile($sourcedir, @_);
17 }
18 sub buildfile {
19 catfile($builddir, @_);
20 }
21 sub sourcedir {
22 catdir($sourcedir, @_);
23 }
24 sub builddir {
25 catdir($builddir, @_);
26 }
27 sub tree {
28 (my $x = shift) =~ s|\]$|...]|;
29 $x
30 }
31 }
32
33 # Because we need to make two computations of these data,
34 # we store them in arrays for reuse
35 our @libs =
36 map { platform->staticname($_) }
37 @{$unified_info{libraries}};
38 our @shlibs =
39 map { platform->sharedname($_) // () }
40 @{$unified_info{libraries}};
41 our @install_libs =
42 map { platform->staticname($_) }
43 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
44 @{$unified_info{libraries}};
45 our @install_shlibs =
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}};
68
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}
78 = qq(deassign arch);
79 }
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}
92 = qq(deassign statem
93 deassign record);
94 }
95 # This makes sure things get built in the order they need
96 # to. You're welcome.
97 sub dependmagic {
98 my $target = shift;
99
100 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
101 }
102 "";
103 -}
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} -}
110
111 # Allow both V and VERBOSE to indicate verbosity. This only applies
112 # to testing.
113 VERBOSE=$(V)
114 VERBOSE_FAILURE=$(VF)
115
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} -}
121
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
125 my @fipsmodules =
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) -}
143
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}}) -}
155
156 APPS_OPENSSL="{- use File::Spec::Functions;
157 catfile("apps","openssl") -}"
158
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.
165 DESTDIR=
166
167 # Do not edit this manually. Use Configure --prefix=DIR to change this!
168 INSTALLTOP={- our $installtop =
169 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
170 $installtop -}
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} -}:
182
183 ##### User defined commands and flags ################################
184
185 CC={- $config{CC} -}
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}}) -}
193
194 PERL={- $config{PERL} -}
195
196 AS={- $config{AS} -}
197 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
198
199 ##### Special command flags ##########################################
200
201 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
202
203 ##### Project flags ##################################################
204
205 # Variables starting with CNF_ are common variables for all product types
206
207 CNF_ASFLAGS={- join('', $target{asflags} || (),
208 @{$config{asflags}}) -}
209 CNF_DEFINES={- our $defines2 = join('', (map { ",$_" } @{$target{defines}},
210 @{$config{defines}}),
211 "'extradefines'") -}
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}}) -}
224
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
229 # files.
230
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))',
256 $lib_cppflags,
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}
323 // (),
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}
330 // (),
331 $target{no_inst_module_cflags}
332 // $target{module_cflags}
333 // (),
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}
339 // (),
340 @{$config{bin_cflags}},
341 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
342
343 PERLASM_SCHEME={- $target{perlasm_scheme} -}
344
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 || (),
349 $includes1 || ());
350 my $x = $c;
351 $x .= "/INCLUDE=($i)" if $i;
352 $x .= "/DEFINE=($d)" if $d;
353 $x; -}
354
355 # .FIRST and .LAST are special targets with MMS and MMK.
356 # The defines in there are for C. includes that look like
357 # this:
358 #
359 # #include <openssl/foo.h>
360 # #include "internal/bar.h"
361 #
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.
365 NODEBUG=@
366 .FIRST :
367 $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
368 $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop'
369 $(NODEBUG) !
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]"
392 $(NODEBUG) !
393 $(NODEBUG) ! Installation logical names
394 $(NODEBUG) !
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'
399 $(NODEBUG) !
400 $(NODEBUG) ! Figure out the architecture
401 $(NODEBUG) !
402 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
403 $(NODEBUG) !
404 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
405 $(NODEBUG) ! running programs can use them.
406 $(NODEBUG) !
407 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
408
409 .LAST :
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
415 .DEFAULT :
416 @ ! MMS cannot handle no actions...
417
418 # The main targets ###################################################
419
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
424
425 build_generated : $(GENERATED_MANDATORY)
426 build_libs_nodep : $(LIBS), $(SHLIBS)
427 build_modules_nodep : $(MODULES)
428 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
429
430 build_docs: build_html_docs
431 build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
432
433 # Kept around for backward compatibility
434 build_apps build_tests : build_programs
435
436 # Convenience target to prebuild all generated files, not just the mandatory
437 # ones
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}; "" -}
444
445 all : build_sw build_docs
446
447 test : tests
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)
455 DEASSIGN BLDTOP
456 DEASSIGN SRCTOP
457 DEASSIGN FIPSKEY
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}; "" -}
461
462 list-tests :
463 @ ! {- output_off() if $disabled{tests}; "" -}
464 @ DEFINE SRCTOP "$(SRCDIR)"
465 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
466 @ DEASSIGN SRCTOP
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}; "" -}
470
471 install : install_sw install_ssldirs install_docs install_final
472
473 install_final :
474 @ WRITE SYS$OUTPUT ""
475 @ WRITE SYS$OUTPUT "######################################################################"
476 @ WRITE SYS$OUTPUT ""
477 @ IF "$(DESTDIR)" .EQS. "" THEN -
478 @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}"
479 @ IF "$(DESTDIR)" .NES. "" THEN -
480 @{- sourcefile("VMS", "msg_staging.com") -} -
481 'installtop' 'datatop' "$(INSTALLTOP)" "$(OPENSSLDIR)" -
482 "$(SYSTARTUP)" "{- $osslver -}" -
483
484
485 check_install :
486 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
487
488 uninstall : uninstall_docs uninstall_sw
489
490 # Because VMS wants the generation number (or *) to delete files, we can't
491 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
492 libclean :
493 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
494 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
495
496 clean : libclean
497 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
498 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
499 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
500 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
501 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
502 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
503 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
504 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
505 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
506 - DELETE [...]*.MAP;*
507 - DELETE [...]*.D;*
508 - DELETE [...]*.OBJ;*,*.LIS;*
509 - DELETE []CXX$DEMANGLER_DB.;*
510 - DELETE [.VMS]openssl_startup.com;*
511 - DELETE [.VMS]openssl_shutdown.com;*
512 - DELETE []vmsconfig.pm;*
513
514 distclean : clean
515 - DELETE configdata.pm;*
516 - DELETE descrip.mms;*
517
518 depend : descrip.mms
519 descrip.mms : FORCE
520 @ ! {- output_off() if $disabled{makedepend}; "" -}
521 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "VMS C"
522 @ ! {- output_on() if $disabled{makedepend}; "" -}
523
524 # Install helper targets #############################################
525
526 install_sw : install_dev install_engines install_modules -
527 install_runtime install_startup install_ivp
528
529 uninstall_sw : uninstall_dev uninstall_modules uninstall_engines -
530 uninstall_runtime uninstall_startup uninstall_ivp
531
532 install_docs : install_html_docs
533
534 uninstall_docs : uninstall_html_docs
535
536 install_fips: install_sw
537 @ WRITE SYS$OUTPUT "*** Installing FIPS module configuration"
538 @ WRITE SYS$OUTPUT "fipsinstall $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).cnf"
539 openssl fipsinstall -
540 -module ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME) -
541 -out ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf -
542 -macopt "key:$(FIPSKEY)"
543
544 uninstall_fips: uninstall_sw
545 @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module configuration"
546 DELETE ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']$(FIPSMODULENAME).cnf;*
547
548 install_ssldirs : check_INSTALLTOP
549 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
550 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
551 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
552 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
553 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
554 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
555 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
556 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
557 @ ! Install configuration file
558 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
559 ossl_dataroot:[000000]openssl.cnf-dist
560 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
561 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
562 ossl_dataroot:[000000]openssl.cnf
563 @ ! Install CTLOG configuration file
564 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
565 ossl_dataroot:[000000]ct_log_list.cnf-dist
566 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
567 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
568 ossl_dataroot:[000000]ct_log_list.cnf
569
570 install_dev : check_INSTALLTOP install_runtime_libs
571 @ WRITE SYS$OUTPUT "*** Installing development files"
572 @ ! Install header files
573 - CREATE/DIR ossl_installroot:[include.openssl]
574 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
575 @ ! Install static (development) libraries
576 - CREATE/DIR ossl_installroot:[LIB.'arch']
577 {- join("\n ",
578 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
579 @install_libs) -}
580
581 install_engines : check_INSTALLTOP install_runtime_libs build_modules
582 @ {- output_off() unless scalar @install_engines; "" -} !
583 @ WRITE SYS$OUTPUT "*** Installing engines"
584 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
585 {- join("\n ",
586 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
587 @install_engines) -}
588 @ {- output_on() unless scalar @install_engines; "" -} !
589
590 install_modules : check_INSTALLTOP install_runtime_libs build_modules
591 @ {- output_off() unless scalar @install_modules; "" -} !
592 @ WRITE SYS$OUTPUT "*** Installing modules"
593 - CREATE/DIR ossl_installroot:[MODULES{- $sover_dirname.$target{pointer_size} -}.'arch']
594 {- join("\n ",
595 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$sover_dirname$target{pointer_size}.'arch']" }
596 @install_modules) -}
597 @ {- output_on() unless scalar @install_modules; "" -} !
598
599 install_runtime : install_programs
600
601 install_runtime_libs : check_INSTALLTOP build_libs
602 @ {- output_off() if $disabled{shared}; "" -} !
603 @ WRITE SYS$OUTPUT "*** Installing shareable images"
604 @ ! Install shared (runtime) libraries
605 - CREATE/DIR ossl_installroot:[LIB.'arch']
606 {- join("\n ",
607 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
608 @install_shlibs) -}
609 @ {- output_on() if $disabled{shared}; "" -} !
610
611 install_programs : check_INSTALLTOP install_runtime_libs build_programs
612 @ {- output_off() if $disabled{apps}; "" -} !
613 @ ! Install the main program
614 - CREATE/DIR ossl_installroot:[EXE.'arch']
615 COPY/PROT=W:RE [.APPS]openssl.EXE -
616 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
617 @ ! Install scripts
618 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
619 @ ! {- output_on() if $disabled{apps}; "" -}
620
621 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
622 [.VMS]openssl_utils.com, check_INSTALLTOP
623 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
624 COPY/PROT=W:RE [.VMS]openssl_startup.com -
625 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
626 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
627 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
628 COPY/PROT=W:RE [.VMS]openssl_utils.com -
629 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
630
631 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
632 - CREATE/DIR ossl_installroot:[SYSTEST]
633 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
634 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
635
636 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
637 - CREATE/DIR [.VMS]
638 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
639 {- sourcefile("VMS", "openssl_startup.com.in") -} -
640 > [.VMS]openssl_startup.com
641
642 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
643 - CREATE/DIR [.VMS]
644 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
645 {- sourcefile("VMS", "openssl_utils.com.in") -} -
646 > [.VMS]openssl_utils.com
647
648 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
649 - CREATE/DIR [.VMS]
650 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
651 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
652 > [.VMS]openssl_shutdown.com
653
654 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
655 - CREATE/DIR [.VMS]
656 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
657 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
658 > [.VMS]openssl_ivp.com
659
660 vmsconfig.pm : configdata.pm
661 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
662 WRITE CONFIG "package vmsconfig;"
663 WRITE CONFIG "use strict; use warnings;"
664 WRITE CONFIG "use Exporter;"
665 WRITE CONFIG "our @ISA = qw(Exporter);"
666 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
667 WRITE CONFIG "our %config = ("
668 WRITE CONFIG " target => '","{- $config{target} -}","',"
669 WRITE CONFIG " version => '","{- $config{version} -}","',"
670 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
671 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
672 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
673 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
674 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
675 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
676 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
677 WRITE CONFIG ");"
678 WRITE CONFIG "our %target = ();"
679 WRITE CONFIG "our %disabled = ();"
680 WRITE CONFIG "our %withargs = ();"
681 WRITE CONFIG "our %unified_info = ();"
682 WRITE CONFIG "1;"
683 CLOSE CONFIG
684
685 install_html_docs : check_INSTALLTOP build_html_docs
686 @ WRITE SYS$OUTPUT "*** Installing HTML docs"
687 - CREATE/DIR ossl_installroot:[HTML.MAN1]
688 - CREATE/DIR ossl_installroot:[HTML.MAN3]
689 - CREATE/DIR ossl_installroot:[HTML.MAN5]
690 - CREATE/DIR ossl_installroot:[HTML.MAN7]
691 {- join("\n ",
692 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
693 @{$unified_info{htmldocs}->{man1}} ),
694 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
695 @{$unified_info{htmldocs}->{man3}} ),
696 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
697 @{$unified_info{htmldocs}->{man5}} ),
698 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
699 @{$unified_info{htmldocs}->{man7}} )) -}
700
701 check_INSTALLTOP :
702 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
703 WRITE SYS$ERROR "INSTALLTOP should not be empty"
704 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
705 EXIT %x10000002
706
707 # Helper targets #####################################################
708
709 copy-utils : [.util]wrap.pl
710
711 [.util]wrap.pl : configdata.pm
712 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
713 CREATE/DIR/LOG [.util]
714 @ IF "$(SRCDIR)" .NES. "$(BLDDIR)" THEN -
715 COPY/LOG ossl_sourceroot:[util]wrap.pl [.util]
716
717 # Developer targets ##################################################
718
719 debug_logicals :
720 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
721
722 # Building targets ###################################################
723
724 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
725 perl configdata.pm -r
726 @ WRITE SYS$OUTPUT "*************************************************"
727 @ WRITE SYS$OUTPUT "*** ***"
728 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
729 @ WRITE SYS$OUTPUT "*** ***"
730 @ WRITE SYS$OUTPUT "*************************************************"
731 @ PIPE ( EXIT %X10000000 )
732
733 reconfigure reconf :
734 perl configdata.pm -r
735
736 {-
737 use File::Basename;
738 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
739
740 # Helper function to figure out dependencies on libraries
741 # It takes a list of library names and outputs a list of dependencies
742 sub compute_lib_depends {
743 # Depending on shared libraries:
744 # On Windows POSIX layers, we depend on {libname}.dll.a
745 # On Unix platforms, we depend on {shlibname}.so
746 return map {
747 { lib => platform->sharedlib($_) // platform->staticlib($_),
748 attrs => $unified_info{attributes}->{libraries}->{$_} }
749 } @_;
750 }
751
752 # Helper function to deal with inclusion directory specs.
753 # We have to deal with two things:
754 # 1. comma separation and no possibility of trailing comma
755 # 2. no inclusion directories given at all
756 # 3. long compiler command lines
757 # To resolve 1, we need to iterate through the sources of inclusion
758 # directories, and only add a comma when needed.
759 # To resolve 2, we need to have a variable that will hold the whole
760 # inclusion qualifier, or be the empty string if there are no inclusion
761 # directories. That's the symbol 'qual_includes' that's used in CPPFLAGS
762 # To resolve 3, we creata a logical name TMP_INCLUDES: to hold the list
763 # of inclusion directories.
764 #
765 # This function returns a list of two lists, one being the collection of
766 # commands to execute before the compiler is called, and the other being
767 # the collection of commands to execute after. It takes as arguments the
768 # collection of strings to include as directory specs.
769 sub includes {
770 my @stuff = ( @_ );
771 my @before = (
772 'qual_includes :=',
773 );
774 my @after = (
775 'DELETE/SYMBOL/LOCAL qual_includes',
776 );
777
778 if (scalar @stuff > 0) {
779 push @before, 'tmp_includes := '.shift(@stuff);
780 while (@stuff) {
781 push @before, 'tmp_add := '.shift(@stuff);
782 push @before, 'IF tmp_includes .NES. "" .AND. tmp_add .NES. "" THEN tmp_includes = tmp_includes + ","';
783 push @before, 'tmp_includes = tmp_includes + tmp_add';
784 }
785 push @before, "IF tmp_includes .NES. \"\" THEN DEFINE tmp_includes 'tmp_includes'";
786 push @before, 'IF tmp_includes .NES. "" THEN qual_includes := /INCLUDE=(tmp_includes:)';
787 push @before, 'DELETE/SYMBOL/LOCAL tmp_includes';
788 push @before, 'DELETE/SYMBOL/LOCAL tmp_add';
789 push @after, 'DEASSIGN tmp_includes:'
790 }
791 return ([ @before ], [ @after ]);
792 }
793
794 sub generatesrc {
795 my %args = @_;
796 my $generator = join(" ", @{$args{generator}});
797 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
798 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
799
800 if ($args{src} =~ /\.html$/) {
801 my $title = basename($args{src}, ".html");
802 my $pod = $args{generator}->[0];
803 my $mkpod2html = sourcefile('util', 'mkpod2html.pl');
804 return <<"EOF";
805 $args{src}: $pod
806 \$(PERL) $mkpod2html -i $pod -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
807 EOF
808 } elsif (platform->isdef($args{src})) {
809 my $target = platform->def($args{src});
810 my $mkdef = sourcefile('util', 'mkdef.pl');
811 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
812 my $ord_name =
813 $args{generator}->[1] || basename($args{product}, '.EXE');
814 my $case_insensitive =
815 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
816 ? '' : ' --case-insensitive';
817 return <<"EOF";
818 $target : $args{generator}->[0] $deps $mkdef
819 \$(PERL) $mkdef$ord_ver --ordinals $args{generator}->[0] --name $ord_name "--OS" "VMS"$case_insensitive > $target
820 EOF
821 } elsif (!platform->isasm($args{src})) {
822 my $target = $args{src};
823 if ($args{generator}->[0] =~ m|^.*\.in$|) {
824 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
825 "util", "dofile.pl")),
826 rel2abs($config{builddir}));
827 my @modules = ( 'configdata.pm',
828 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
829 my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
830 @modules = map { '"-M'.basename($_, '.pm').'"' } @modules;
831 my $modules = join(' ', '', sort keys %moduleincs, @modules);
832 return <<"EOF";
833 $target : $args{generator}->[0] $deps
834 \$(PERL)$modules $dofile "-o$target{build_file}" $generator > \$\@
835 EOF
836 } else {
837 return <<"EOF";
838 $target : $args{generator}->[0] $deps
839 \$(PERL)$generator_incs $generator > \$\@
840 EOF
841 }
842 } else {
843 my $cppflags = {
844 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
845 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
846 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
847 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
848 } -> {$args{intent}};
849 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
850 lib => '$(LIB_INCLUDES)',
851 dso => '$(DSO_INCLUDES)',
852 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
853 '$(CNF_INCLUDES)',
854 '$(INCLUDES)',
855 @{$args{incs}});
856 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
857 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
858 my $defs = join("", map { ",".$_ } @{$args{defs}});
859 my $target = platform->asm($args{src});
860
861 if ($args{generator}->[0] =~ /\.pl$/) {
862 $generator = '$(PERL)'.$generator_incs.' '.$generator
863 .' '.$cppflags;
864 } elsif ($args{generator}->[0] =~ /\.S$/) {
865 $generator = undef;
866 } else {
867 die "Generator type for $src unknown: $generator\n";
868 }
869
870 if (defined($generator)) {
871 # If the target is named foo.S in build.info, we want to
872 # end up generating foo.s in two steps.
873 if ($args{src} =~ /\.S$/) {
874 return <<"EOF";
875 $target : $args{generator}->[0] $deps
876 $generator \$\@-S
877 \@ $incs_on
878 \@ extradefines = "$defs"
879 PIPE \$(CPP) $cppflags \$\@-S | -
880 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
881 \@ DELETE/SYMBOL/LOCAL extradefines
882 \@ $incs_off
883 RENAME \$\@-i \$\@
884 DELETE \$\@-S;
885 EOF
886 }
887 # Otherwise....
888 return <<"EOF";
889 $target : $args{generator}->[0] $deps
890 \@ $incs_on
891 \@ extradefines = "$defs"
892 $generator \$\@
893 \@ DELETE/SYMBOL/LOCAL extradefines
894 \@ $incs_off
895 EOF
896 }
897 return <<"EOF";
898 $target : $args{generator}->[0] $deps
899 \@ $incs_on
900 \@ extradefines = "$defs"
901 SHOW SYMBOL qual_includes
902 PIPE \$(CPP) $cppflags $args{generator}->[0] | -
903 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
904 \@ DELETE/SYMBOL/LOCAL extradefines
905 \@ $incs_off
906 EOF
907 }
908 }
909
910 sub src2obj {
911 my $asmext = platform->asmext();
912 my %args = @_;
913 my @srcs =
914 map { my $x = $_;
915 (platform->isasm($x) && grep { $x eq $_ } @generated)
916 ? platform->asm($x) : $x }
917 ( @{$args{srcs}} );
918 my $obj = platform->obj($args{obj});
919 my $dep = platform->dep($args{obj});
920 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
921
922 # Because VMS C isn't very good at combining a /INCLUDE path with
923 # #includes having a relative directory (like '#include "../foo.h"),
924 # the best choice is to move to the first source file's intended
925 # directory before compiling, and make sure to write the object file
926 # in the correct position (important when the object tree is other
927 # than the source tree).
928 my $forward = dirname($args{srcs}->[0]);
929 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
930 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
931 my $objn = basename($obj);
932 my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
933 my $depn = basename($dep);
934 my $srcs =
935 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
936 my $before = $unified_info{before}->{$obj} || "\@ !";
937 my $after = $unified_info{after}->{$obj} || "\@ !";
938
939 my $cflags;
940 if ($args{attrs}->{noinst}) {
941 $cflags = { shlib => '$(NO_INST_LIB_CFLAGS)',
942 lib => '$(NO_INST_LIB_CFLAGS)',
943 dso => '$(NO_INST_DSO_CFLAGS)',
944 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
945 } else {
946 $cflags = { shlib => '$(LIB_CFLAGS)',
947 lib => '$(LIB_CFLAGS)',
948 dso => '$(DSO_CFLAGS)',
949 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
950 }
951 $cflags .= { shlib => '$(LIB_CPPFLAGS)',
952 lib => '$(LIB_CPPFLAGS)',
953 dso => '$(DSO_CPPFLAGS)',
954 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
955 my $defs = join("", map { ",".$_ } @{$args{defs}});
956 my $asflags = { shlib => ' $(LIB_ASFLAGS)',
957 lib => ' $(LIB_ASFLAGS)',
958 dso => ' $(DSO_ASFLAGS)',
959 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
960
961 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
962 lib => '$(LIB_INCLUDES)',
963 dso => '$(DSO_INCLUDES)',
964 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
965 '$(INCLUDES)',
966 map {
967 file_name_is_absolute($_)
968 ? $_ : catdir($backward,$_)
969 } @{$args{incs}});
970 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
971 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
972
973 if ($srcs[0] =~ /\Q${asmext}\E$/) {
974 return <<"EOF";
975 $obj : $deps
976 ${before}
977 SET DEFAULT $forward
978 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn} $srcs
979 SET DEFAULT $backward
980 ${after}
981 - PURGE $obj
982 EOF
983 } elsif ($srcs[0] =~ /.S$/) {
984 return <<"EOF";
985 $obj : $deps
986 ${before}
987 SET DEFAULT $forward
988 \@ $incs_on
989 \@ extradefines = "$defs"
990 PIPE \$(CPP) ${cflags} $srcs | -
991 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
992 > ${objd}${objn}-asm
993 \@ DELETE/SYMBOL/LOCAL extradefines
994 \@ $incs_off
995 SET DEFAULT $backward
996 ${after}
997 \$(AS) $asflags \$(ASOUTFLAG)$obj $obj-asm
998 - PURGE $obj
999 EOF
1000 }
1001
1002 my $depbuild = $disabled{makedepend} ? ""
1003 : " /MMS=(FILE=${depd}${depn},TARGET=$obj)";
1004
1005 return <<"EOF";
1006 $obj : $deps
1007 ${before}
1008 SET DEFAULT $forward
1009 \@ $incs_on
1010 \@ extradefines = "$defs"
1011 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn} /REPOSITORY=$backward $srcs
1012 \@ DELETE/SYMBOL/LOCAL extradefines
1013 \@ $incs_off
1014 SET DEFAULT $backward
1015 ${after}
1016 - PURGE $obj
1017 EOF
1018 }
1019 sub obj2shlib {
1020 my %args = @_;
1021 my $shlibname = platform->sharedname($args{lib});
1022 my $shlib = platform->sharedlib($args{lib});
1023 my @objs = map { platform->convertext($_) }
1024 grep { platform->isobj($_) }
1025 @{$args{objs}};
1026 my @defs = map { platform->convertext($_) }
1027 grep { platform->isdef($_) }
1028 @{$args{objs}};
1029 my @deps = compute_lib_depends(@{$args{deps}});
1030 die "More than one symbol vector" if scalar @defs > 1;
1031 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1032 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1033 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
1034 "VMS", "translatesyms.pl")),
1035 rel2abs($config{builddir}));
1036 # The "[]" hack is because in .OPT files, each line inherits the
1037 # previous line's file spec as default, so if no directory spec
1038 # is present in the current line and the previous line has one that
1039 # doesn't apply, you're in for a surprise.
1040 my $write_opt1 =
1041 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1042 "WRITE OPT_FILE \"$x" } @objs).
1043 "\"";
1044 my $write_opt2 =
1045 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1046 ? $_->{lib} : "[]".$_->{lib};
1047 $x =~ s|(\.EXE)|$1/SHARE|;
1048 $x =~ s|(\.OLB)|$1/LIB|;
1049 "WRITE OPT_FILE \"$x\"" } @deps)
1050 || "\@ !";
1051 return <<"EOF"
1052 $shlib : $deps
1053 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
1054 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
1055 $write_opt1
1056 $write_opt2
1057 CLOSE OPT_FILE
1058 LINK \$(LIB_LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
1059 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1060 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1061 PURGE $shlibname.EXE,$shlibname.MAP
1062 EOF
1063 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1064 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1065 EOF
1066 );
1067 }
1068 sub obj2dso {
1069 my %args = @_;
1070 my $dsoname = platform->dsoname($args{module});
1071 my $dso = platform->dso($args{module});
1072 my @objs = map { platform->convertext($_) }
1073 grep { platform->isobj($_) }
1074 @{$args{objs}};
1075 my @defs = map { platform->convertext($_) }
1076 grep { platform->isdef($_) }
1077 @{$args{objs}};
1078 my @deps = compute_lib_depends(@{$args{deps}});
1079 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1080 die "More than one symbol vector" if scalar @defs > 1;
1081 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1082 # The "[]" hack is because in .OPT files, each line inherits the
1083 # previous line's file spec as default, so if no directory spec
1084 # is present in the current line and the previous line has one that
1085 # doesn't apply, you're in for a surprise.
1086 my $write_opt1 =
1087 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1088 "WRITE OPT_FILE \"$x" } @objs).
1089 "\"";
1090 my $write_opt2 =
1091 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1092 ? $_->{lib} : "[]".$_->{lib};
1093 $x =~ s|(\.EXE)|$1/SHARE|;
1094 $x =~ s|(\.OLB)|$1/LIB|;
1095 "WRITE OPT_FILE \"$x\"" } @deps)
1096 || "\@ !";
1097 return <<"EOF"
1098 $dso : $deps
1099 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1100 $write_opt1
1101 $write_opt2
1102 CLOSE OPT_FILE
1103 LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $defs[0]/OPT,-
1104 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1105 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1106 EOF
1107 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1108 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1109 EOF
1110 );
1111 }
1112 sub obj2lib {
1113 my %args = @_;
1114 my $lib = platform->staticlib($args{lib});
1115 my @objs = map { platform->convertext($_) }
1116 grep { platform->isobj($_) }
1117 @{$args{objs}};
1118 my $objs = join(", -\n\t\t", @objs);
1119 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1120 return <<"EOF";
1121 $lib : $objs
1122 LIBRARY/CREATE/OBJECT $lib
1123 $fill_lib
1124 - PURGE $lib
1125 EOF
1126 }
1127 sub obj2bin {
1128 my %args = @_;
1129 my $bin = platform->bin($args{bin});
1130 my $binname = platform->binname($args{bin});
1131 my @objs = map { platform->convertext($_) }
1132 grep { platform->isobj($_) }
1133 @{$args{objs}};
1134 my $objs = join(",", @objs);
1135 my @deps = compute_lib_depends(@{$args{deps}});
1136 my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1137
1138 my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1139 my $analyse_objs = "@ !";
1140 if ($olb_count > 0) {
1141 my $analyse_quals =
1142 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1143 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1144 }
1145 # The "[]" hack is because in .OPT files, each line inherits the
1146 # previous line's file spec as default, so if no directory spec
1147 # is present in the current line and the previous line has one that
1148 # doesn't apply, you're in for a surprise.
1149 my $write_opt1 =
1150 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1151 "\@ WRITE OPT_FILE \"$x" } @objs).
1152 "\"";
1153 my $write_opt2 =
1154 join("\n\t", "WRITE OPT_FILE \"CASE_SENSITIVE=YES\"",
1155 map { my @lines = ();
1156 use Data::Dumper;
1157 my $x = $_->{lib} =~ /\[/
1158 ? $_->{lib} : "[]".$_->{lib};
1159 if ($x =~ m|\.EXE$|) {
1160 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1161 } elsif ($x =~ m|\.OLB$|) {
1162 # Special hack to include the MAIN object
1163 # module explicitly. This will only be done
1164 # if there isn't a 'main' in the program's
1165 # object modules already.
1166 my $main = $_->{attrs}->{has_main}
1167 ? '/INCLUDE=main' : '';
1168 push @lines,
1169 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB$main\"",
1170 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1171 }
1172 @lines
1173 } @deps)
1174 || "\@ !";
1175 # The linking commands looks a bit complex, but it's for good reason.
1176 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1177 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1178 # the linker will warn about it, loudly, and will then choose to pick
1179 # the first copy encountered (the one in bar.obj in this example).
1180 # On Unix and on Windows, the corresponding maneuvre goes through
1181 # silently with the same effect.
1182 # With some test programs, made for checking the internals of OpenSSL,
1183 # we do this kind of linking deliberately, picking a few specific object
1184 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1185 # otherwise unreachable (since the shareable images only exports the
1186 # symbols listed in [.util]*.num), and then with the shared libraries
1187 # themselves. So we need to silence the warning about multiply defined
1188 # symbols, to mimic the way linking work on Unix and Windows, and so
1189 # the build isn't interrupted (MMS stops when warnings are signaled,
1190 # by default), and so someone building doesn't have to worry where it
1191 # isn't necessary. If there are other warnings, however, we show them
1192 # and let it break the build.
1193 return <<"EOF"
1194 $bin : $deps
1195 $analyse_objs
1196 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1197 $write_opt1
1198 $write_opt2
1199 @ CLOSE OPT_FILE
1200 TYPE $binname.OPT ! For debugging
1201 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1202 LINK \$(BIN_LDFLAGS)/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1203 link_status = \$status ; link_severity = link_status .AND. 7
1204 @ search_severity = 1
1205 -@ IF link_severity .EQ. 0 THEN -
1206 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1207 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1208 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1209 search_severity = \$severity
1210 @ ! search_severity is 3 when the last search didn't find any matching
1211 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1212 @ ! If that was the result, we pretend linking got through without
1213 @ ! fault or warning.
1214 @ IF search_severity .EQ. 3 THEN link_severity = 1
1215 @ ! At this point, if link_severity shows that there was a fault
1216 @ ! or warning, make sure to restore the linking status.
1217 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1218 -@ DELETE $binname.LINKLOG;*
1219 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1220 - PURGE $bin,$binname.OPT
1221 EOF
1222 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1223 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1224 EOF
1225 );
1226 }
1227 sub in2script {
1228 my %args = @_;
1229 my $script = $args{script};
1230 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1231 my $sources = join(" ", @{$args{sources}});
1232 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1233 "util", "dofile.pl")),
1234 rel2abs($config{builddir}));
1235 return <<"EOF";
1236 $script : $sources
1237 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1238 "-o$target{build_file}" $sources > $script
1239 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1240 PURGE $script
1241 EOF
1242 }
1243 "" # Important! This becomes part of the template result.
1244 -}