]> git.ipfire.org Git - thirdparty/openssl.git/blob - Configurations/descrip.mms.tmpl
4215fe92b25eee796021eef503962128cdfd9897
[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 prefix, claimed when speaking with the VSI folks Tuesday
9 # January 26th 2016
10 our $osslprefix = 'OSSL$';
11 (our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/;
12
13 our $sover_dirname = sprintf "%02d%02d", split(/\./, $config{shlib_version_number});
14 our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
15
16 our $sourcedir = $config{sourcedir};
17 our $builddir = $config{builddir};
18 sub sourcefile {
19 catfile($sourcedir, @_);
20 }
21 sub buildfile {
22 catfile($builddir, @_);
23 }
24 sub sourcedir {
25 catdir($sourcedir, @_);
26 }
27 sub builddir {
28 catdir($builddir, @_);
29 }
30 sub tree {
31 (my $x = shift) =~ s|\]$|...]|;
32 $x
33 }
34 sub move {
35 my $f = catdir(@_);
36 my $b = abs2rel(rel2abs("."),rel2abs($f));
37 $sourcedir = catdir($b,$sourcedir)
38 if !file_name_is_absolute($sourcedir);
39 $builddir = catdir($b,$builddir)
40 if !file_name_is_absolute($builddir);
41 "";
42 }
43
44 # Because we need to make two computations of these data,
45 # we store them in arrays for reuse
46 our @libs =
47 map { (my $x = $_) =~ s/\.a$//; $x }
48 @{$unified_info{libraries}};
49 our @shlibs =
50 map { $unified_info{sharednames}->{$_} || () }
51 grep(!/\.a$/, @{$unified_info{libraries}});
52 our @install_libs =
53 map { (my $x = $_) =~ s/\.a$//; $x }
54 @{$unified_info{install}->{libraries}};
55 our @install_shlibs =
56 map { $unified_info{sharednames}->{$_} || () }
57 grep(!/\.a$/, @{$unified_info{install}->{libraries}});
58
59 # This is a horrible hack, but is needed because recursive inclusion of files
60 # in different directories does not work well with HP C.
61 my $sd = sourcedir("crypto", "async", "arch");
62 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
63 (my $x = $_) =~ s|\.o$|.OBJ|;
64 $unified_info{before}->{$x}
65 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
66 define arch 'arch_include');
67 $unified_info{after}->{$x}
68 = qq(deassign arch);
69 }
70 my $sd1 = sourcedir("ssl","record");
71 my $sd2 = sourcedir("ssl","statem");
72 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
73 keys %{$unified_info{sources}});
74 foreach (@ssl_locl_users) {
75 (my $x = $_) =~ s|\.o$|.OBJ|;
76 $unified_info{before}->{$x}
77 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
78 define record 'record_include'
79 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
80 define statem 'statem_include');
81 $unified_info{after}->{$x}
82 = qq(deassign statem
83 deassign record);
84 }
85 # This makes sure things get built in the order they need
86 # to. You're welcome.
87 sub dependmagic {
88 my $target = shift;
89
90 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
91 }
92 #use Data::Dumper;
93 #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
94 #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
95 "";
96 -}
97 PLATFORM={- $config{target} -}
98 OPTIONS={- $config{options} -}
99 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
100 SRCDIR={- $config{sourcedir} -}
101 BLDDIR={- $config{builddir} -}
102
103 # Allow both V and VERBOSE to indicate verbosity. This only applies
104 # to testing.
105 VERBOSE=$(V)
106
107 VERSION={- "$config{major}.$config{minor}.$config{patch}$config{prerelease}$config{build_metadata}" -}
108 MAJOR={- $config{major} -}
109 MINOR={- $config{minor} -}
110 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
111 SHLIB_TARGET={- $target{shared_target} -}
112
113 EXE_EXT=.EXE
114 LIB_EXT=.OLB
115 SHLIB_EXT=.EXE
116 OBJ_EXT=.OBJ
117 DEP_EXT=.D
118
119 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
120 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
121 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
122 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
123 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
124 {- output_off() if $disabled{makedepend}; "" -}
125 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
126 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
127 keys %{$unified_info{sources}};
128 join(", ", map { "-\n\t".$_ } @deps); -}
129 {- output_on() if $disabled{makedepend}; "" -}
130 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
131 GENERATED={- # common0.tmpl provides @generated
132 join(", ", map { my $x = $_;
133 $x =~ s|\.[sS]$|.asm|;
134 $x =~ s|\.ld$|.OPT|;
135 "-\n\t".$x }
136 @generated) -}
137
138 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
139 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
140 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -}
141 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -}
142 {- output_off() if $disabled{apps}; "" -}
143 BIN_SCRIPTS=[.tools]c_rehash.pl
144 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
145 {- output_on() if $disabled{apps}; "" -}
146
147 APPS_OPENSSL={- use File::Spec::Functions;
148 catfile("apps","openssl") -}
149
150 # DESTDIR is for package builders so that they can configure for, say,
151 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
152 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
153 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
154 # STAGING:[USER.OPENSSL].
155 # Normally it is left empty.
156 DESTDIR=
157
158 # Do not edit this manually. Use Configure --prefix=DIR to change this!
159 INSTALLTOP={- our $installtop =
160 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
161 $installtop -}
162 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
163 # This is the standard central area to store certificates, private keys...
164 OPENSSLDIR={- catdir($config{openssldir}) or
165 $config{prefix} ? catdir($config{prefix},"COMMON")
166 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
167 # The same, but for C
168 OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
169 # Where installed engines reside, for C
170 ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
171
172 ##### User defined commands and flags ################################
173
174 CC={- $config{CC} -}
175 CPP={- $config{CPP} -}
176 DEFINES={- our $defines1 = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
177 INCLUDES={- our $includes1 = join(',', @{$config{CPPINCLUDES}}) -}
178 CPPFLAGS={- our $cppflags1 = join('', @{$config{CPPFLAGS}}) -}
179 CFLAGS={- join('', @{$config{CFLAGS}}) -}
180 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
181 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
182
183 PERL={- $config{PERL} -}
184
185 AS={- $config{AS} -}
186 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
187
188 ##### Special command flags ##########################################
189
190 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
191
192 ##### Project flags ##################################################
193
194 # Variables starting with CNF_ are common variables for all product types
195
196 CNF_ASFLAGS={- join('', $target{asflags} || (),
197 @{$config{asflags}}) -}
198 CNF_DEFINES={- our $defines2 = join('', (map { ",$_" } @{$target{defines}},
199 @{$config{defines}}),
200 "'extradefines'") -}
201 CNF_INCLUDES={- our $includes2 = join(',', @{$target{includes}},
202 @{$config{includes}}) -}
203 CNF_CPPFLAGS={- our $cppflags2 = join('', $target{cppflags} || (),
204 @{$config{cppflags}}) -}
205 CNF_CFLAGS={- join('', $target{cflags} || (),
206 @{$config{cflags}}) -}
207 CNF_CXXFLAGS={- join('', $target{cxxflags} || (),
208 @{$config{cxxflags}}) -}
209 CNF_LDFLAGS={- join('', $target{lflags} || (),
210 @{$config{lflags}}) -}
211 CNF_EX_LIBS={- join('', map{ ",$_" } @{$target{ex_libs}},
212 @{$config{ex_libs}}) -}
213
214 # Variables starting with LIB_ are used to build library object files
215 # and shared libraries.
216 # Variables starting with DSO_ are used to build DSOs and their object files.
217 # Variables starting with BIN_ are used to build programs and their object
218 # files.
219
220 LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (),
221 @{$config{lib_asflags}},
222 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
223 LIB_DEFINES={- our $lib_defines =
224 join('', (map { ",$_" } @{$target{lib_defines}},
225 @{$target{shared_defines}},
226 @{$config{lib_defines}},
227 @{$config{shared_defines}}));
228 join('', $lib_defines,
229 (map { ",$_" } 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
230 'ENGINESDIR="""$(ENGINESDIR_C)"""'),
231 '$(CNF_DEFINES)', '$(DEFINES)') -}
232 LIB_INCLUDES={- our $lib_includes =
233 join(',', @{$target{lib_includes}},
234 @{$target{shared_includes}},
235 @{$config{lib_includes}},
236 @{$config{shared_includes}}) -}
237 LIB_CPPFLAGS={- our $lib_cppflags =
238 join('', $target{lib_cppflags} || (),
239 $target{shared_cppflags} || (),
240 @{$config{lib_cppflags}},
241 @{$config{shared_cppflag}});
242 join('', "'qual_includes'",
243 '/DEFINE=(__dummy$(LIB_DEFINES))',
244 $lib_cppflags,
245 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
246 LIB_CFLAGS={- join('', $target{lib_cflags} || (),
247 $target{shared_cflag} || (),
248 @{$config{lib_cflags}},
249 @{$config{shared_cflag}},
250 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
251 LIB_LDFLAGS={- join('', $target{lib_lflags} || (),
252 $target{shared_ldflag} || (),
253 @{$config{lib_lflags}},
254 @{$config{shared_ldflag}},
255 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
256 LIB_EX_LIBS=$(CNF_EX_LIBS)$(EX_LIBS)
257 DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (),
258 $target{module_asflags} || (),
259 @{$config{dso_asflags}},
260 @{$config{module_asflags}},
261 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
262 DSO_DEFINES={- join('', (map { ",$_" } @{$target{dso_defines}},
263 @{$target{module_defines}},
264 @{$config{dso_defines}},
265 @{$config{module_defines}}),
266 '$(CNF_DEFINES)', '$(DEFINES)') -}
267 DSO_INCLUDES={- join(',', @{$target{dso_includes}},
268 @{$target{module_includes}},
269 @{$config{dso_includes}},
270 @{$config{module_includes}}) -}
271 DSO_CPPFLAGS={- join('', "'qual_includes'",
272 '/DEFINE=(__dummy$(DSO_DEFINES))',
273 $target{dso_cppflags} || (),
274 $target{module_cppflags} || (),
275 @{$config{dso_cppflags}},
276 @{$config{module_cppflags}},
277 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
278 DSO_CFLAGS={- join('', $target{dso_cflags} || (),
279 $target{module_cflags} || (),
280 @{$config{dso_cflags}},
281 @{$config{module_cflags}},
282 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
283 DSO_LDFLAGS={- join('', $target{dso_lflags} || (),
284 $target{module_ldflags} || (),
285 @{$config{dso_lflags}},
286 @{$config{module_ldflags}},
287 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
288 DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
289 BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
290 @{$config{bin_asflags}},
291 '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
292 BIN_DEFINES={- join('', (map { ",$_" } @{$target{bin_defines}},
293 @{$config{bin_defines}}),
294 '$(CNF_DEFINES)', '$(DEFINES)') -}
295 BIN_INCLUDES={- join(',', @{$target{bin_includes}},
296 @{$config{bin_includes}}) -}
297 BIN_CPPFLAGS={- join('', "'qual_includes'",
298 '/DEFINE=(__dummy$(DSO_DEFINES))',
299 $target{bin_cppflags} || (),
300 @{$config{bin_cppflag}},
301 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
302 BIN_CFLAGS={- join('', $target{bin_cflags} || (),
303 @{$config{bin_cflags}},
304 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
305 BIN_LDFLAGS={- join('', $target{bin_lflags} || (),
306 @{$config{bin_lflags}} || (),
307 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
308 BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
309 NO_INST_LIB_CFLAGS={- join('', $target{no_inst_lib_cflags}
310 // $target{lib_cflags}
311 // (),
312 $target{shared_cflag} || (),
313 @{$config{lib_cflags}},
314 @{$config{shared_cflag}},
315 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
316 NO_INST_DSO_CFLAGS={- join('', $target{no_inst_dso_cflags}
317 // $target{dso_cflags}
318 // (),
319 $target{no_inst_module_cflags}
320 // $target{module_cflags}
321 // (),
322 @{$config{dso_cflags}},
323 @{$config{module_cflags}},
324 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
325 NO_INST_BIN_CFLAGS={- join('', $target{no_inst_bin_cflags}
326 // $target{bin_cflags}
327 // (),
328 @{$config{bin_cflags}},
329 '$(CNF_CFLAGS)', '$(CFLAGS)') -}
330
331 PERLASM_SCHEME={- $target{perlasm_scheme} -}
332
333 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
334 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags2.$cppflags1) =~ s|"|""|g;
335 (my $d = $lib_defines.$defines2.$defines1) =~ s|"|""|g;
336 my $i = join(',', $lib_includes || (), $includes2 || (),
337 $includes1 || ());
338 my $x = $c;
339 $x .= "/INCLUDE=($i)" if $i;
340 $x .= "/DEFINE=($d)" if $d;
341 $x; -}
342
343 # .FIRST and .LAST are special targets with MMS and MMK.
344 # The defines in there are for C. includes that look like
345 # this:
346 #
347 # #include <openssl/foo.h>
348 # #include "internal/bar.h"
349 #
350 # will use the logical names to find the files. Expecting
351 # DECompHP C to find files in subdirectories of whatever was
352 # given with /INCLUDE is a fantasy, unfortunately.
353 NODEBUG=@
354 .FIRST :
355 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
356 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
357 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
358 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
359 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
360 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
361 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
362 $(NODEBUG) staging_dir = "$(DESTDIR)"
363 $(NODEBUG) staging_instdir = ""
364 $(NODEBUG) staging_datadir = ""
365 $(NODEBUG) IF staging_dir .NES. "" THEN -
366 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
367 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
368 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
369 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
370 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
371 $(NODEBUG) IF staging_dir .NES. "" THEN -
372 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
373 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
374 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
375 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
376 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
377 $(NODEBUG) !
378 $(NODEBUG) ! Installation logical names
379 $(NODEBUG) !
380 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
381 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
382 $(NODEBUG) DEFINE ossl_installroot 'installtop'
383 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
384 $(NODEBUG) !
385 $(NODEBUG) ! Figure out the architecture
386 $(NODEBUG) !
387 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
388 $(NODEBUG) !
389 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
390 $(NODEBUG) ! running programs can use them.
391 $(NODEBUG) !
392 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
393
394 .LAST :
395 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
396 $(NODEBUG) DEASSIGN ossl_dataroot
397 $(NODEBUG) DEASSIGN ossl_installroot
398 $(NODEBUG) DEASSIGN internal
399 $(NODEBUG) DEASSIGN openssl
400 .DEFAULT :
401 @ ! MMS cannot handle no actions...
402
403 # The main targets ###################################################
404
405 {- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep
406 {- dependmagic('build_libs'); -} : build_libs_nodep
407 {- dependmagic('build_engines'); -} : build_engines_nodep
408 {- dependmagic('build_programs'); -} : build_programs_nodep
409
410 build_generated : $(GENERATED_MANDATORY)
411 build_libs_nodep : $(LIBS), $(SHLIBS)
412 build_engines_nodep : $(ENGINES)
413 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
414
415 # Kept around for backward compatibility
416 build_apps build_tests : build_programs
417
418 # Convenience target to prebuild all generated files, not just the mandatory
419 # ones
420 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
421 @ ! {- output_off() if $disabled{makedepend}; "" -}
422 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
423 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
424 @ WRITE SYS$OUTPUT " then make will fail..."
425 @ ! {- output_on() if $disabled{makedepend}; "" -}
426
427 test : tests
428 {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep
429 @ ! {- output_off() if $disabled{tests}; "" -}
430 SET DEFAULT [.test]{- move("test") -}
431 CREATE/DIR [.test-runs]
432 DEFINE SRCTOP {- sourcedir() -}
433 DEFINE BLDTOP {- builddir() -}
434 DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
435 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
436 DEFINE OPENSSL_DEBUG_MEMORY "on"
437 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
438 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
439 DEASSIGN OPENSSL_DEBUG_MEMORY
440 DEASSIGN OPENSSL_ENGINES
441 DEASSIGN BLDTOP
442 DEASSIGN SRCTOP
443 SET DEFAULT [-]{- move("..") -}
444 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
445 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
446 @ ! {- output_on() if !$disabled{tests}; "" -}
447
448 list-tests :
449 @ ! {- output_off() if $disabled{tests}; "" -}
450 @ DEFINE SRCTOP {- sourcedir() -}
451 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
452 @ DEASSIGN SRCTOP
453 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
454 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
455 @ ! {- output_on() if !$disabled{tests}; "" -}
456
457 install : install_sw install_ssldirs install_docs
458 @ WRITE SYS$OUTPUT ""
459 @ WRITE SYS$OUTPUT "######################################################################"
460 @ WRITE SYS$OUTPUT ""
461 @ IF "$(DESTDIR)" .EQS. "" THEN -
462 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
463 WRITE SYS$OUTPUT "" ; -
464 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
465 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
466 WRITE SYS$OUTPUT "" )
467 @ IF "$(DESTDIR)" .NES. "" THEN -
468 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
469 WRITE SYS$OUTPUT "" ; -
470 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
471 WRITE SYS$OUTPUT staging_instdir ; -
472 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
473 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
474 WRITE SYS$OUTPUT staging_datadir ; -
475 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
476 WRITE SYS$OUTPUT "" ; -
477 WRITE SYS$OUTPUT "When in its final destination," ; -
478 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
479 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
480 WRITE SYS$OUTPUT "" )
481
482 check_install :
483 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
484
485 uninstall : uninstall_docs uninstall_sw
486
487 # Because VMS wants the generation number (or *) to delete files, we can't
488 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
489 libclean :
490 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
491 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
492
493 clean : libclean
494 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
495 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
496 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
497 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
498 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
499 - DELETE [...]*.MAP;*
500 - DELETE [...]*.D;*
501 - DELETE [...]*.OBJ;*,*.LIS;*
502 - DELETE []CXX$DEMANGLER_DB.;*
503 - DELETE [.VMS]openssl_startup.com;*
504 - DELETE [.VMS]openssl_shutdown.com;*
505 - DELETE []vmsconfig.pm;*
506
507 distclean : clean
508 - DELETE configdata.pm;*
509 - DELETE descrip.mms;*
510
511 depend : descrip.mms
512 descrip.mms : FORCE
513 @ ! {- output_off() if $disabled{makedepend}; "" -}
514 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "VMS C"
515 @ ! {- output_on() if $disabled{makedepend}; "" -}
516
517 # Install helper targets #############################################
518
519 install_sw : install_dev install_engines install_runtime -
520 install_startup install_ivp
521
522 uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime -
523 uninstall_startup uninstall_ivp
524
525 install_docs : install_html_docs
526
527 uninstall_docs : uninstall_html_docs
528
529 install_ssldirs : check_INSTALLTOP
530 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
531 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
532 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
533 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
534 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
535 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
536 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
537 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
538 @ ! Install configuration file
539 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
540 ossl_dataroot:[000000]openssl.cnf-dist
541 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
542 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
543 ossl_dataroot:[000000]openssl.cnf
544 @ ! Install CTLOG configuration file
545 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
546 ossl_dataroot:[000000]ct_log_list.cnf-dist
547 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
548 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
549 ossl_dataroot:[000000]ct_log_list.cnf
550
551 install_dev : check_INSTALLTOP install_runtime_libs
552 @ WRITE SYS$OUTPUT "*** Installing development files"
553 @ ! Install header files
554 - CREATE/DIR ossl_installroot:[include.openssl]
555 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
556 @ ! Install static (development) libraries
557 - CREATE/DIR ossl_installroot:[LIB.'arch']
558 {- join("\n ",
559 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
560 @install_libs) -}
561
562 install_engines : check_INSTALLTOP install_runtime_libs build_engines
563 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
564 @ WRITE SYS$OUTPUT "*** Installing engines"
565 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
566 {- join("\n ",
567 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
568 @{$unified_info{install}->{engines}}) -}
569 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
570
571 install_runtime : install_programs
572
573 install_runtime_libs : check_INSTALLTOP build_libs
574 @ {- output_off() if $disabled{shared}; "" -} !
575 @ WRITE SYS$OUTPUT "*** Installing shareable images"
576 @ ! Install shared (runtime) libraries
577 - CREATE/DIR ossl_installroot:[LIB.'arch']
578 {- join("\n ",
579 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
580 @install_shlibs) -}
581 @ {- output_on() if $disabled{shared}; "" -} !
582
583 install_programs : check_INSTALLTOP install_runtime_libs build_programs
584 @ {- output_off() if $disabled{apps}; "" -} !
585 @ ! Install the main program
586 - CREATE/DIR ossl_installroot:[EXE.'arch']
587 COPY/PROT=W:RE [.APPS]openssl.EXE -
588 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
589 @ ! Install scripts
590 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
591 @ ! {- output_on() if $disabled{apps}; "" -}
592
593 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
594 [.VMS]openssl_utils.com, check_INSTALLTOP
595 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
596 COPY/PROT=W:RE [.VMS]openssl_startup.com -
597 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
598 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
599 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
600 COPY/PROT=W:RE [.VMS]openssl_utils.com -
601 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
602
603 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
604 - CREATE/DIR ossl_installroot:[SYSTEST]
605 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
606 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
607
608 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
609 - CREATE/DIR [.VMS]
610 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
611 {- sourcefile("VMS", "openssl_startup.com.in") -} -
612 > [.VMS]openssl_startup.com
613
614 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
615 - CREATE/DIR [.VMS]
616 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
617 {- sourcefile("VMS", "openssl_utils.com.in") -} -
618 > [.VMS]openssl_utils.com
619
620 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
621 - CREATE/DIR [.VMS]
622 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
623 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
624 > [.VMS]openssl_shutdown.com
625
626 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
627 - CREATE/DIR [.VMS]
628 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
629 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
630 > [.VMS]openssl_ivp.com
631
632 vmsconfig.pm : configdata.pm
633 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
634 WRITE CONFIG "package vmsconfig;"
635 WRITE CONFIG "use strict; use warnings;"
636 WRITE CONFIG "use Exporter;"
637 WRITE CONFIG "our @ISA = qw(Exporter);"
638 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
639 WRITE CONFIG "our %config = ("
640 WRITE CONFIG " target => '","{- $config{target} -}","',"
641 WRITE CONFIG " version => '","{- $config{version} -}","',"
642 WRITE CONFIG " shlib_version_number => '","{- $config{shlib_version_number} -}","',"
643 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
644 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
645 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
646 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
647 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
648 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
649 WRITE CONFIG ");"
650 WRITE CONFIG "our %target = ();"
651 WRITE CONFIG "our %disabled = ();"
652 WRITE CONFIG "our %withargs = ();"
653 WRITE CONFIG "our %unified_info = ();"
654 WRITE CONFIG "1;"
655 CLOSE CONFIG
656
657 install_html_docs : check_INSTALLTOP
658 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
659 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
660 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
661 --type=html
662
663 check_INSTALLTOP :
664 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
665 WRITE SYS$ERROR "INSTALLTOP should not be empty"
666 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
667 EXIT %x10000002
668
669 # Helper targets #####################################################
670
671 # Developer targets ##################################################
672
673 debug_logicals :
674 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
675
676 # Building targets ###################################################
677
678 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
679 perl configdata.pm -r
680 @ WRITE SYS$OUTPUT "*************************************************"
681 @ WRITE SYS$OUTPUT "*** ***"
682 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
683 @ WRITE SYS$OUTPUT "*** ***"
684 @ WRITE SYS$OUTPUT "*************************************************"
685 @ PIPE ( EXIT %X10000000 )
686
687 reconfigure reconf :
688 perl configdata.pm -r
689
690 {-
691 use File::Basename;
692 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
693
694 # Helper function to figure out dependencies on libraries
695 # It takes a list of library names and outputs a list of dependencies
696 sub compute_lib_depends {
697 if ($disabled{shared}) {
698 return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_;
699 }
700 return map { $_ =~ /\.a$/
701 ? $`.".OLB"
702 : $unified_info{sharednames}->{$_}.".EXE" } @_;
703 }
704
705 # Helper function to deal with inclusion directory specs.
706 # We have to deal with two things:
707 # 1. comma separation and no possibility of trailing comma
708 # 2. no inclusion directories given at all
709 # 3. long compiler command lines
710 # To resolve 1, we need to iterate through the sources of inclusion
711 # directories, and only add a comma when needed.
712 # To resolve 2, we need to have a variable that will hold the whole
713 # inclusion qualifier, or be the empty string if there are no inclusion
714 # directories. That's the symbol 'qual_includes' that's used in CPPFLAGS
715 # To resolve 3, we creata a logical name TMP_INCLUDES: to hold the list
716 # of inclusion directories.
717 #
718 # This function returns a list of two lists, one being the collection of
719 # commands to execute before the compiler is called, and the other being
720 # the collection of commands to execute after. It takes as arguments the
721 # collection of strings to include as directory specs.
722 sub includes {
723 my @stuff = ( @_ );
724 my @before = (
725 'qual_includes :=',
726 );
727 my @after = (
728 'DELETE/SYMBOL/LOCAL qual_includes',
729 );
730
731 if (scalar @stuff > 0) {
732 push @before, 'tmp_includes := '.shift(@stuff);
733 while (@stuff) {
734 push @before, 'tmp_add := '.shift(@stuff);
735 push @before, 'IF tmp_includes .NES. "" .AND. tmp_add .NES. "" THEN tmp_includes = tmp_includes + ","';
736 push @before, 'tmp_includes = tmp_includes + tmp_add';
737 }
738 push @before, "IF tmp_includes .NES. \"\" THEN DEFINE tmp_includes 'tmp_includes'";
739 push @before, 'IF tmp_includes .NES. "" THEN qual_includes := /INCLUDE=(tmp_includes:)';
740 push @before, 'DELETE/SYMBOL/LOCAL tmp_includes';
741 push @before, 'DELETE/SYMBOL/LOCAL tmp_add';
742 push @after, 'DEASSIGN tmp_includes:'
743 }
744 return ([ @before ], [ @after ]);
745 }
746
747 sub generatesrc {
748 my %args = @_;
749 my $generator = join(" ", @{$args{generator}});
750 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
751 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
752
753 if ($args{src} =~ /\.ld$/) {
754 (my $target = $args{src}) =~ s/\.ld$/.OPT/;
755 my $mkdef = sourcefile('util', 'mkdef.pl');
756 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
757 my $ord_name =
758 $args{generator}->[1] || basename($args{product}, '.EXE');
759 my $case_insensitive =
760 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
761 ? '' : ' --case-insensitive';
762 return <<"EOF";
763 $target : $args{generator}->[0] $deps $mkdef
764 \$(PERL) $mkdef$ord_ver --ordinals $args{generator}->[0] --name $ord_name "--OS" "VMS"$case_insensitive > $target
765 EOF
766 } elsif ($args{src} !~ /\.[sS]$/) {
767 my $target = $args{src};
768 if ($args{generator}->[0] =~ m|^.*\.in$|) {
769 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
770 "util", "dofile.pl")),
771 rel2abs($config{builddir}));
772 return <<"EOF";
773 $target : $args{generator}->[0] $deps
774 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
775 "-o$target{build_file}" $generator > \$\@
776 EOF
777 } else {
778 return <<"EOF";
779 $target : $args{generator}->[0] $deps
780 \$(PERL)$generator_incs $generator > \$\@
781 EOF
782 }
783 } else {
784 (my $target = $args{src}) =~ s/\.[sS]$/.asm/;
785 if ($args{generator}->[0] =~ /\.pl$/) {
786 $generator = '$(PERL)'.$generator_incs.' '.$generator;
787 } elsif ($args{generator}->[0] =~ /\.S$/) {
788 $generator = undef;
789 } else {
790 die "Generator type for $src unknown: $generator\n";
791 }
792
793 my $cppflags = {
794 shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
795 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
796 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
797 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
798 } -> {$args{intent}};
799 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
800 lib => '$(LIB_INCLUDES)',
801 dso => '$(DSO_INCLUDES)',
802 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
803 '$(CNF_INCLUDES)',
804 '$(INCLUDES)',
805 @{$args{incs}});
806 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
807 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
808 my $defs = join("", map { ",".$_ } @{$args{defs}});
809 if (defined($generator)) {
810 # If the target is named foo.S in build.info, we want to
811 # end up generating foo.s in two steps.
812 if ($args{src} =~ /\.S$/) {
813 return <<"EOF";
814 $target : $args{generator}->[0] $deps
815 $generator \$\@-S
816 \@ $incs_on
817 \@ extradefines = "$defs"
818 PIPE \$(CPP) $cppflags \$\@-S | -
819 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i
820 \@ DELETE/SYMBOL/LOCAL extradefines
821 \@ $incs_off
822 RENAME \$\@-i \$\@
823 DELETE \$\@-S;
824 EOF
825 }
826 # Otherwise....
827 return <<"EOF";
828 $target : $args{generator}->[0] $deps
829 $generator \$\@
830 EOF
831 }
832 return <<"EOF";
833 $target : $args{generator}->[0] $deps
834 \@ $incs_on
835 \@ extradefines = "$defs"
836 SHOW SYMBOL qual_includes
837 PIPE \$(CPP) $cppflags $args{generator}->[0] | -
838 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
839 \@ DELETE/SYMBOL/LOCAL extradefines
840 \@ $incs_off
841 EOF
842 }
843 }
844
845 sub src2obj {
846 my %args = @_;
847 my @srcs = map { (my $x = $_) =~ s/\.[sS]$/.asm/; $x
848 } ( @{$args{srcs}} );
849 (my $obj = $args{obj}) =~ s|\.o$||;
850 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
851
852 # Because VMS C isn't very good at combining a /INCLUDE path with
853 # #includes having a relative directory (like '#include "../foo.h"),
854 # the best choice is to move to the first source file's intended
855 # directory before compiling, and make sure to write the object file
856 # in the correct position (important when the object tree is other
857 # than the source tree).
858 my $forward = dirname($args{srcs}->[0]);
859 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
860 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
861 my $objn = basename($obj);
862 my $srcs =
863 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
864 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
865 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
866
867 if ($srcs[0] =~ /\.asm$/) {
868 my $asflags = { shlib => ' $(LIB_ASFLAGS)',
869 lib => ' $(LIB_ASFLAGS)',
870 dso => ' $(DSO_ASFLAGS)',
871 bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
872 return <<"EOF";
873 $obj.OBJ : $deps
874 ${before}
875 SET DEFAULT $forward
876 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs
877 SET DEFAULT $backward
878 EOF
879 }
880
881 my $cflags;
882 if ($args{installed}) {
883 $cflags = { shlib => '$(LIB_CFLAGS)',
884 lib => '$(LIB_CFLAGS)',
885 dso => '$(DSO_CFLAGS)',
886 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
887 } else {
888 $cflags = { shlib => '$(NO_INST_LIB_CFLAGS)',
889 lib => '$(NO_INST_LIB_CFLAGS)',
890 dso => '$(NO_INST_DSO_CFLAGS)',
891 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
892 }
893 $cflags .= { shlib => '$(LIB_CPPFLAGS)',
894 lib => '$(LIB_CPPFLAGS)',
895 dso => '$(DSO_CPPFLAGS)',
896 bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
897 my $defs = join("", map { ",".$_ } @{$args{defs}});
898
899 my @incs_cmds = includes({ shlib => '$(LIB_INCLUDES)',
900 lib => '$(LIB_INCLUDES)',
901 dso => '$(DSO_INCLUDES)',
902 bin => '$(BIN_INCLUDES)' } -> {$args{intent}},
903 '$(INCLUDES)',
904 map {
905 file_name_is_absolute($_)
906 ? $_ : catdir($backward,$_)
907 } @{$args{incs}});
908 my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!';
909 my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!';
910 my $depbuild = $disabled{makedepend} ? ""
911 : " /MMS=(FILE=${objd}${objn}.D,TARGET=$obj.OBJ)";
912
913 return <<"EOF";
914 $obj.OBJ : $deps
915 ${before}
916 SET DEFAULT $forward
917 \@ $incs_on
918 \@ extradefines = "$defs"
919 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
920 \@ DELETE/SYMBOL/LOCAL extradefines
921 \@ $incs_off
922 SET DEFAULT $backward
923 ${after}
924 - PURGE $obj.OBJ
925 EOF
926 }
927 sub obj2shlib {
928 my %args = @_;
929 my $lib = $args{lib};
930 my $shlib = $args{shlib};
931 my $libd = dirname($lib);
932 my $libn = basename($lib);
933 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x }
934 grep { $_ =~ m|\.o$| }
935 @{$args{objs}};
936 my @defs = map { (my $x = $_) =~ s|\.ld$|.OPT|; $x }
937 grep { $_ =~ m|\.ld$| }
938 @{$args{objs}};
939 my @deps = compute_lib_depends(@{$args{deps}});
940 die "More than one symbol vector" if scalar @defs > 1;
941 my $deps = join(", -\n\t\t", @objs, @defs, @deps);
942 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
943 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
944 "VMS", "translatesyms.pl")),
945 rel2abs($config{builddir}));
946 # The "[]" hack is because in .OPT files, each line inherits the
947 # previous line's file spec as default, so if no directory spec
948 # is present in the current line and the previous line has one that
949 # doesn't apply, you're in for a surprise.
950 my $write_opt1 =
951 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
952 "WRITE OPT_FILE \"$x" } @objs).
953 "\"";
954 my $write_opt2 =
955 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
956 $x =~ s|(\.EXE)|$1/SHARE|;
957 $x =~ s|(\.OLB)|$1/LIB|;
958 "WRITE OPT_FILE \"$x\"" } @deps)
959 || "\@ !";
960 return <<"EOF"
961 $shlib.EXE : $deps
962 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
963 OPEN/WRITE/SHARE=READ OPT_FILE $lib-components.OPT
964 $write_opt1
965 $write_opt2
966 CLOSE OPT_FILE
967 LINK \$(LIB_LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,-
968 $lib-components.OPT/OPT \$(LIB_EX_LIBS)
969 DELETE $defs[0]-translated;*,$lib-components.OPT;*
970 PURGE $shlib.EXE,$shlib.MAP
971 EOF
972 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
973 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
974 EOF
975 );
976 }
977 sub obj2dso {
978 my %args = @_;
979 my $lib = $args{lib};
980 my $libd = dirname($lib);
981 my $libn = basename($lib);
982 (my $libn_nolib = $libn) =~ s/^lib//;
983 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x }
984 grep { $_ =~ m|\.o$| }
985 @{$args{objs}};
986 my @defs = map { (my $x = $_) =~ s|\.ld$|.OPT|; $x }
987 grep { $_ =~ m|\.ld$| }
988 @{$args{objs}};
989 my @deps = compute_lib_depends(@{$args{deps}});
990 my $deps = join(", -\n\t\t", @objs, @defs, @deps);
991 die "More than one symbol vector" if scalar @defs > 1;
992 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
993 # The "[]" hack is because in .OPT files, each line inherits the
994 # previous line's file spec as default, so if no directory spec
995 # is present in the current line and the previous line has one that
996 # doesn't apply, you're in for a surprise.
997 my $write_opt1 =
998 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
999 "WRITE OPT_FILE \"$x" } @objs).
1000 "\"";
1001 my $write_opt2 =
1002 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1003 $x =~ s|(\.EXE)|$1/SHARE|;
1004 $x =~ s|(\.OLB)|$1/LIB|;
1005 "WRITE OPT_FILE \"$x\"" } @deps)
1006 || "\@ !";
1007 return <<"EOF"
1008 $lib.EXE : $deps
1009 OPEN/WRITE/SHARE=READ OPT_FILE $lib-components.OPT
1010 $write_opt1
1011 $write_opt2
1012 CLOSE OPT_FILE
1013 LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $defs[0]/OPT,-
1014 $lib-components.OPT/OPT \$(DSO_EX_LIBS)
1015 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
1016 EOF
1017 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1018 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1019 EOF
1020 );
1021 }
1022 sub obj2lib {
1023 my %args = @_;
1024 (my $lib = $args{lib}) =~ s/\.a$//;
1025 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
1026 my $objs = join(", -\n\t\t", @objs);
1027 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_" }
1028 @objs));
1029 return <<"EOF";
1030 $lib.OLB : $objs
1031 LIBRARY/CREATE/OBJECT $lib.OLB
1032 $fill_lib
1033 - PURGE $lib.OLB
1034 EOF
1035 }
1036 sub obj2bin {
1037 my %args = @_;
1038 my $bin = $args{bin};
1039 my $bind = dirname($bin);
1040 my $binn = basename($bin);
1041 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
1042 my $objs = join(",", @objs);
1043 my @deps = compute_lib_depends(@{$args{deps}});
1044 my $deps = join(", -\n\t\t", @objs, @deps);
1045
1046 my $olb_count = scalar grep(m|\.OLB$|, @deps);
1047 my $analyse_objs = "@ !";
1048 if ($olb_count > 0) {
1049 my $analyse_quals =
1050 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1051 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1052 }
1053 # The "[]" hack is because in .OPT files, each line inherits the
1054 # previous line's file spec as default, so if no directory spec
1055 # is present in the current line and the previous line has one that
1056 # doesn't apply, you're in for a surprise.
1057 my $write_opt1 =
1058 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1059 "\@ WRITE OPT_FILE \"$x" } @objs).
1060 "\"";
1061 my $write_opt2 =
1062 join("\n\t", map { my @lines = (
1063 "\ WRITE OPT_FILE \"CASE_SENSITIVE=YES\""
1064 );
1065 my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1066 if ($x =~ m|\.EXE$|) {
1067 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1068 } elsif ($x =~ m|\.OLB$|) {
1069 (my $l = $x) =~ s/\W/_/g;
1070 push @lines,
1071 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB\$(INCLUDE_MAIN_$l)\"",
1072 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1073 }
1074 @lines
1075 } @deps)
1076 || "\@ !";
1077 # The linking commands looks a bit complex, but it's for good reason.
1078 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1079 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1080 # the linker will warn about it, loudly, and will then choose to pick
1081 # the first copy encountered (the one in bar.obj in this example).
1082 # On Unix and on Windows, the corresponding maneuvre goes through
1083 # silently with the same effect.
1084 # With some test programs, made for checking the internals of OpenSSL,
1085 # we do this kind of linking deliberately, picking a few specific object
1086 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1087 # otherwise unreachable (since the shareable images only exports the
1088 # symbols listed in [.util]*.num), and then with the shared libraries
1089 # themselves. So we need to silence the warning about multiply defined
1090 # symbols, to mimic the way linking work on Unix and Windows, and so
1091 # the build isn't interrupted (MMS stops when warnings are signaled,
1092 # by default), and so someone building doesn't have to worry where it
1093 # isn't necessary. If there are other warnings, however, we show them
1094 # and let it break the build.
1095 return <<"EOF"
1096 $bin.EXE : $deps
1097 $analyse_objs
1098 @ OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
1099 $write_opt1
1100 $write_opt2
1101 @ CLOSE OPT_FILE
1102 TYPE $bin.opt ! For debugging
1103 - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
1104 LINK \$(BIN_LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(BIN_EX_LIBS) ; -
1105 link_status = \$status ; link_severity = link_status .AND. 7
1106 @ search_severity = 1
1107 -@ IF link_severity .EQ. 0 THEN -
1108 pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | -
1109 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1110 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1111 search_severity = \$severity
1112 @ ! search_severity is 3 when the last search didn't find any matching
1113 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1114 @ ! If that was the result, we pretend linking got through without
1115 @ ! fault or warning.
1116 @ IF search_severity .EQ. 3 THEN link_severity = 1
1117 @ ! At this point, if link_severity shows that there was a fault
1118 @ ! or warning, make sure to restore the linking status.
1119 -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG
1120 -@ DELETE $bin.LINKLOG;*
1121 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1122 - PURGE $bin.EXE,$bin.OPT
1123 EOF
1124 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1125 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1126 EOF
1127 );
1128 }
1129 sub in2script {
1130 my %args = @_;
1131 my $script = $args{script};
1132 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1133 my $sources = join(" ", @{$args{sources}});
1134 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1135 "util", "dofile.pl")),
1136 rel2abs($config{builddir}));
1137 return <<"EOF";
1138 $script : $sources
1139 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1140 "-o$target{build_file}" $sources > $script
1141 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1142 PURGE $script
1143 EOF
1144 }
1145 "" # Important! This becomes part of the template result.
1146 -}