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