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