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