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