]> git.ipfire.org Git - thirdparty/openssl.git/blob - Configurations/descrip.mms.tmpl
Ensure ossl_cms_EncryptedContent_init_bio() reports an error on no OID
[thirdparty/openssl.git] / Configurations / descrip.mms.tmpl
1 ## descrip.mms to build OpenSSL on OpenVMS
2 ##
3 ## {- join("\n## ", @autowarntext) -}
4 {-
5 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
6 use File::Basename;
7 use OpenSSL::Util;
8
9 (our $osslprefix_q = platform->osslprefix()) =~ s/\$/\\\$/;
10
11 our $sover_dirname = platform->shlib_version_as_filename();
12 our $osslver = sprintf "%02d", split(/\./, $config{version});
13
14 our $sourcedir = $config{sourcedir};
15 our $builddir = $config{builddir};
16 sub make_unix_path {
17 # Split the native path
18 (my $vol, my $dirs, my $file) = File::Spec->splitpath($_[0]);
19 my @dirs = File::Spec->splitdir($dirs);
20
21 # Reassemble it as a Unix path
22 $vol =~ s|:$||;
23 return File::Spec::Unix->catpath(
24 '', File::Spec::Unix->catdir('', $vol ? $vol : (), @dirs), $file);
25 }
26 sub sourcefile {
27 catfile($sourcedir, @_);
28 }
29 sub buildfile {
30 catfile($builddir, @_);
31 }
32 sub sourcedir {
33 catdir($sourcedir, @_);
34 }
35 sub builddir {
36 catdir($builddir, @_);
37 }
38 sub tree {
39 (my $x = shift) =~ s|\]$|...]|;
40 $x
41 }
42
43 # Because we need to make two computations of these data,
44 # we store them in arrays for reuse
45 our @libs =
46 map { platform->staticname($_) }
47 @{$unified_info{libraries}};
48 our @shlibs =
49 map { platform->sharedname($_) // () }
50 @{$unified_info{libraries}};
51 our @install_libs =
52 map { platform->staticname($_) }
53 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
54 @{$unified_info{libraries}};
55 our @install_shlibs =
56 map { platform->sharedname($_) // () }
57 grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
58 @{$unified_info{libraries}};
59 our @install_engines =
60 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
61 && $unified_info{attributes}->{modules}->{$_}->{engine} }
62 @{$unified_info{modules}};
63 our @install_modules =
64 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
65 && !$unified_info{attributes}->{modules}->{$_}->{engine}
66 && !$unified_info{attributes}->{modules}->{$_}->{fips} }
67 @{$unified_info{modules}};
68 our @install_fipsmodules =
69 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
70 && $unified_info{attributes}->{modules}->{$_}->{fips} }
71 @{$unified_info{modules}};
72 our @install_programs =
73 grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
74 @{$unified_info{programs}};
75 our @install_bin_scripts =
76 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
77 && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
78 @{$unified_info{scripts}};
79 our @install_misc_scripts =
80 grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
81 && $unified_info{attributes}->{scripts}->{$_}->{misc} }
82 @{$unified_info{scripts}};
83
84 # Configured flags
85
86 our @cnf_asflags = ($target{asflags} || (), @{$config{asflags}});
87 our @cnf_defines = (@{$target{defines}}, @{$config{defines}});
88 our @cnf_includes = (@{$target{includes}}, @{$config{includes}});
89 our @cnf_cppflags = ($target{cppflags} || (), @{$config{cppflags}});
90 our @cnf_cflags = ($target{cflags} || (), @{$config{cflags}});
91 our @cnf_cxxflags = ($target{cxxflags} || (), @{$config{cxxflags}});
92 our @cnf_ldflags = ($target{lflags} || (), @{$config{lflags}});
93 our @cnf_ex_libs = (map{ ",$_" } @{$target{ex_libs}}, @{$config{ex_libs}});
94
95 # Variables starting with $lib_ are used to build library object files
96 # and shared libraries.
97 # Variables starting with $dso_ are used to build DSOs and their object files.
98 # Variables starting with $bin_ are used to build programs and their object
99 # files.
100
101 # The following array is special and is treated separately from the rest of
102 # the lib_ variables.
103 our @lib_cppincludes = (@{$target{lib_includes}}, @{$target{shared_includes}},
104 @{$config{lib_includes}}, @{$config{shared_includes}},
105 @cnf_includes);
106
107 our $lib_cppdefines =
108 join(',', @{$target{lib_defines}}, @{$target{shared_defines}},
109 @{$config{lib_defines}}, @{$config{shared_defines}},
110 @cnf_defines,
111 'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
112 'ENGINESDIR="""$(ENGINESDIR_C)"""',
113 'MODULESDIR="""$(MODULESDIR_C)"""'
114 )
115 . '$(DEFINES)'
116 . "'extradefines'";
117 our $lib_asflags =
118 join(' ', $target{lib_asflags} || (), @{$config{lib_asflags}},
119 @cnf_asflags, '$(ASFLAGS)');
120 our $lib_cppflags =
121 join('', $target{lib_cppflags} || (), $target{shared_cppflags} || (),
122 @{$config{lib_cppflags}}, @{$config{shared_cppflag}},
123 @cnf_cppflags, '/DEFINE=('.$lib_cppdefines.')', '$(CPPFLAGS)');
124 my @lib_cflags = ( $target{lib_cflags} // () );
125 my @lib_cflags_no_inst = ( $target{no_inst_lib_cflags} // @lib_cflags );
126 my @lib_cflags_cont = ( $target{shared_cflag} || (),
127 @{$config{lib_cflags}}, @{$config{shared_cflag}},
128 $cnf_cflags, '$(CFLAGS)');
129 our $lib_cflags = join('', @lib_cflags, @lib_cflags_cont );
130 our $lib_cflags_no_inst = join('', @lib_cflags_no_inst, @lib_cflags_cont );
131 our $lib_ldflags =
132 join('', $target{lib_lflags} || (), $target{shared_ldflag} || (),
133 @{$config{lib_lflags}}, @{$config{shared_ldflag}},
134 @cnf_ldflags, '$(LDFLAGS)');
135 our $lib_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
136
137 # The following array is special and is treated separately from the rest of
138 # the dso_ variables.
139 our @dso_cppincludes = (@{$target{dso_includes}}, @{$target{module_includes}},
140 @{$config{dso_includes}}, @{$config{module_includes}},
141 @cnf_includes);
142
143 our $dso_cppdefines =
144 join(',', @{$target{dso_defines}}, @{$target{module_defines}},
145 @{$config{dso_defines}}, @{$config{module_defines}},
146 @cnf_defines,
147 )
148 . '$(DEFINES)'
149 . "'extradefines'";
150 our $dso_asflags =
151 join(' ', $target{dso_asflags} || (), $target{module_asflags} || (),
152 @{$config{dso_asflags}}, @{$config{module_asflags}},
153 @cnf_asflags, '$(ASFLAGS)');
154 our $dso_cppflags =
155 join('', $target{dso_cppflags} || (), $target{module_cppflags} || (),
156 @{$config{dso_cppflags}}, @{$config{module_cppflag}},
157 @cnf_cppflags,
158 '/DEFINE=('.$dso_cppdefines.')',
159 '$(CPPFLAGS)');
160 my @dso_cflags = ( $target{dso_cflags} // () );
161 my @dso_cflags_no_inst = ( $target{no_inst_dso_cflags} // @dso_cflags );
162 my @dso_cflags_cont = ( $target{module_cflag} || (),
163 @{$config{dso_cflags}}, @{$config{module_cflag}},
164 $cnf_cflags, '$(CFLAGS)');
165 our $dso_cflags = join('', @dso_cflags, @dso_cflags_cont );
166 our $dso_cflags_no_inst = join('', @dso_cflags_no_inst, @dso_cflags_cont );
167 our $dso_ldflags =
168 join('', $target{dso_lflags} || (), $target{module_ldflag} || (),
169 @{$config{dso_lflags}}, @{$config{module_ldflag}},
170 @cnf_ldflags, '$(LDFLAGS)');
171 our $dso_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
172
173 # The following array is special and is treated separately from the rest of
174 # the bin_ variables.
175 our @bin_cppincludes = (@{$target{bin_includes}},
176 @{$config{bin_includes}},
177 @cnf_includes);
178
179 our $bin_cppdefines =
180 join(',', @{$target{bin_defines}},
181 @{$config{bin_defines}},
182 @cnf_defines,
183 )
184 . '$(DEFINES)'
185 . "'extradefines'";
186 our $bin_asflags =
187 join(' ', $target{bin_asflags} || (),
188 @{$config{bin_asflags}},
189 @cnf_asflags, '$(ASFLAGS)');
190 our $bin_cppflags =
191 join('', $target{bin_cppflags} || (),
192 @{$config{bin_cppflags}},
193 @cnf_cppflags,
194 '/DEFINE=('.$bin_cppdefines.')',
195 '$(CPPFLAGS)');
196 my @bin_cflags = ( $target{bin_cflags} // () );
197 my @bin_cflags_no_inst = ( $target{no_inst_bin_cflags} // @bin_cflags );
198 my @bin_cflags_cont = ( @{$config{bin_cflags}},
199 $cnf_cflags, '$(CFLAGS)');
200 our $bin_cflags = join('', @bin_cflags, @bin_cflags_cont );
201 our $bin_cflags_no_inst = join('', @bin_cflags_no_inst, @bin_cflags_cont );
202 our $bin_cflags =
203 join('', $target{bin_cflags} || (),
204 @{$config{bin_cflags}},
205 @cnf_cflags, '$(CFLAGS)');
206 our $bin_ldflags =
207 join('', $target{bin_lflags} || (),
208 @{$config{bin_lflags}},
209 @cnf_ldflags, '$(LDFLAGS)');
210 our $bin_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
211
212 # These are horrible hacks, but are needed because recursive inclusion of
213 # files in different directories does not work well with VMS C. We try to
214 # help by specifying extra relative directories. They must always be in Unix
215 # format, relative to the directory where the .c file is located. The logic
216 # is that any inclusion, merged with one of these relative directories, will
217 # find the requested inclusion file.
218 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
219 my $obj = platform->obj($_);
220 push @{$unified_info{includes_extra}->{$obj}}, qw(../);
221 }
222 foreach (grep /\[\.crypto\.ec\.curve448\].*?\.o$/, keys %{$unified_info{sources}}) {
223 my $obj = platform->obj($_);
224 push @{$unified_info{includes_extra}->{$obj}}, qw(./arch_32 ./arch64);
225 }
226 foreach (grep /\[\.crypto\.ec\.curve448.arch_(?:32|64)\].*?\.o$/, keys %{$unified_info{sources}}) {
227 my $obj = platform->obj($_);
228 push @{$unified_info{includes_extra}->{$obj}}, qw(../);
229 }
230 foreach (grep /\[\.ssl\].*?\.o$/, keys %{$unified_info{sources}}) {
231 my $obj = platform->obj($_);
232 # Most of the files in [.ssl.record.methods] include "ssl_local.h"
233 # which includes things like "record/record.h". Adding "./" as an
234 # inclusion directory helps making this sort of header from these
235 # directories.
236 push @{$unified_info{includes_extra}->{$obj}}, qw(./);
237 }
238 foreach (grep /\[\.ssl\.(?:record|statem)\].*?\.o$/, keys %{$unified_info{sources}}) {
239 my $obj = platform->obj($_);
240 # Most of the files in [.ssl.record] and [.ssl.statem] include
241 # "../ssl_local.h", which includes things like "record/record.h".
242 # Adding "../" as an inclusion directory helps making this sort of header
243 # from these directories.
244 push @{$unified_info{includes_extra}->{$obj}}, qw(../);
245
246 }
247 foreach (grep /\[\.ssl\.record\.methods\].*?\.o$/, keys %{$unified_info{sources}}) {
248 my $obj = platform->obj($_);
249 # Most of the files in [.ssl.record.methods] include "../../ssl_local.h"
250 # which includes things like "record/record.h". Adding "../../" as an
251 # inclusion directory helps making this sort of header from these
252 # directories.
253 push @{$unified_info{includes_extra}->{$obj}}, qw(../../);
254 }
255 foreach (grep /\[\.test\].*?\.o$/, keys %{$unified_info{sources}}) {
256 my $obj = platform->obj($_);
257 push @{$unified_info{includes_extra}->{$obj}}, qw(../ssl ./helpers);
258 # Some of the sources in [.test] also include headers like
259 # "../ssl/record/methods/recmethod_local.h", which in turn might include
260 # "../../ssl_local.h", so these object files need yet another hack.
261 # We could make this specific to just the object files that are affected
262 # directly, but that would end up with more whack-a-mole of this sort, so
263 # nah, we do it broadly.
264 push @{$unified_info{includes_extra}->{$obj}}, qw(../ssl/record/methods);
265 }
266 foreach (grep /\[\.test\.helpers\].*?\.o$/, keys %{$unified_info{sources}}) {
267 my $obj = platform->obj($_);
268 push @{$unified_info{includes_extra}->{$obj}}, qw(../../ssl);
269 }
270
271 # This makes sure things get built in the order they need
272 # to. You're welcome.
273 sub dependmagic {
274 my $target = shift;
275
276 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
277 }
278 "";
279 -}
280 PLATFORM={- $config{target} -}
281 OPTIONS={- $config{options} -}
282 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
283 SRCDIR={- $config{sourcedir} -}
284 BLDDIR={- $config{builddir} -}
285 FIPSKEY={- $config{FIPSKEY} -}
286
287 # Allow both V and VERBOSE to indicate verbosity. This only applies
288 # to testing.
289 VERBOSE=$(V)
290 VERBOSE_FAILURE=$(VF)
291
292 VERSION={- "$config{full_version}" -}
293 VERSION_NUMBER={- "$config{version}" -}
294 MAJOR={- $config{major} -}
295 MINOR={- $config{minor} -}
296 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
297 SHLIB_TARGET={- $target{shared_target} -}
298
299 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
300 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
301 MODULES={- join(", ", map { "-\n\t".$_.".EXE" }
302 # Drop all modules that are dependencies, they will
303 # be processed through their dependents
304 grep { my $x = $_;
305 !grep { grep { $_ eq $x } @$_ }
306 values %{$unified_info{depends}} }
307 @{$unified_info{modules}}) -}
308 FIPSMODULE={- # We do some extra checking here, as there should be only one
309 use File::Basename;
310 our @fipsmodules =
311 grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
312 && $unified_info{attributes}->{modules}->{$_}->{fips} }
313 @{$unified_info{modules}};
314 die "More that one FIPS module" if scalar @fipsmodules > 1;
315 join(" ", map { platform->dso($_) } @fipsmodules) -}
316 FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1;
317 join(", ", map { basename(platform->dso($_)) } @fipsmodules) -}
318 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
319 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
320 {- output_off() if $disabled{makedepend}; "" -}
321 DEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ }
322 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
323 keys %{$unified_info{sources}};
324 join(", ", map { "-\n\t".$_ } @deps); -}
325 {- output_on() if $disabled{makedepend}; "" -}
326 GENERATED_MANDATORY={- join(", ",
327 map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
328 GENERATED_PODS={- # common0.tmpl provides @generated
329 join(", ",
330 map { my $x = $_;
331 (
332 grep {
333 $unified_info{attributes}->{depends}
334 ->{$x}->{$_}->{pod} // 0
335 }
336 keys %{$unified_info{attributes}->{depends}->{$x}}
337 ) ? "-\n\t".$x : ();
338 }
339 @generated) -}
340 GENERATED={- # common0.tmpl provides @generated
341 join(", ", map { platform->convertext($_) } @generated) -}
342
343 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
344 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
345 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
346 INSTALL_MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @install_modules) -}
347 INSTALL_FIPSMODULE={- join(", ", map { "-\n\t".$_.".EXE" } @install_fipsmodules) -}
348 INSTALL_FIPSMODULECONF=[.providers]fipsmodule.cnf
349 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
350 BIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
351 MISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
352 HTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
353 HTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
354 HTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
355 HTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
356
357 APPS_OPENSSL="{- use File::Spec::Functions;
358 catfile("apps","openssl") -}"
359
360 # DESTDIR is for package builders so that they can configure for, say,
361 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
362 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
363 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
364 # STAGING:[USER.OPENSSL].
365 # Normally it is left empty.
366 DESTDIR=
367
368 # Do not edit this manually. Use Configure --prefix=DIR to change this!
369 INSTALLTOP={- our $installtop =
370 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
371 $installtop -}
372 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
373 # This is the standard central area to store certificates, private keys...
374 OPENSSLDIR={- catdir($config{openssldir}) or
375 $config{prefix} ? catdir($config{prefix},"COMMON")
376 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
377 # The same, but for C
378 OPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000]
379 # Where installed ENGINE modules reside, for C
380 ENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
381 # Where modules reside, for C
382 MODULESDIR_C={- platform->osslprefix() -}MODULES{- $target{pointer_size} -}:
383
384 ##### User defined commands and flags ################################
385
386 CC={- $config{CC} -}
387 CPP={- $config{CPP} -}
388 DEFINES={- our $defines = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
389 #INCLUDES={- our $includes = join(',', @{$config{CPPINCLUDES}}) -}
390 CPPFLAGS={- our $cppflags = join('', @{$config{CPPFLAGS}}) -}
391 CFLAGS={- join('', @{$config{CFLAGS}}) -}
392 LDFLAGS={- join('', @{$config{LFLAGS}}) -}
393 EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
394
395 PERL={- $config{PERL} -}
396
397 AS={- $config{AS} -}
398 ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
399
400 ##### Special command flags ##########################################
401
402 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
403
404 PERLASM_SCHEME={- $target{perlasm_scheme} -}
405
406 # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
407 CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags) =~ s|"|""|g;
408 (my $d = $lib_cppdefines) =~ s|"|""|g;
409 my $i = join(',', @lib_cppincludes || (), '$(INCLUDES)');
410 my $x = $c;
411 $x .= "/INCLUDE=($i)" if $i;
412 $x .= "/DEFINE=($d)" if $d;
413 $x; -}
414
415 # .FIRST and .LAST are special targets with MMS and MMK.
416 NODEBUG=@
417 .FIRST :
418 {- join( "\n \$(NODEBUG) ", @{ $target{setup_commands} // [] },
419 '!' ) -}
420 $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
421 $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop'
422 $(NODEBUG) !
423 $(NODEBUG) staging_dir = "$(DESTDIR)"
424 $(NODEBUG) staging_instdir = ""
425 $(NODEBUG) staging_datadir = ""
426 $(NODEBUG) IF staging_dir .NES. "" THEN -
427 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
428 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
429 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
430 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
431 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
432 $(NODEBUG) IF staging_dir .NES. "" THEN -
433 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
434 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
435 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
436 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
437 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
438 $(NODEBUG) !
439 $(NODEBUG) ! Installation logical names
440 $(NODEBUG) !
441 $(NODEBUG) ! This also creates a few DCL variables that are used for
442 $(NODEBUG) ! the "install_msg" target.
443 $(NODEBUG) !
444 $(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
445 $(NODEBUG) installtop = installroot + ".]"
446 $(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
447 $(NODEBUG) datatop = dataroot + ".]"
448 $(NODEBUG) DEFINE ossl_installroot 'installtop'
449 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
450 $(NODEBUG) !
451 $(NODEBUG) ! Override disturbing system logicals. We can't deassign
452 $(NODEBUG) ! them, so we create it instead. This is an unfortunate
453 $(NODEBUG) ! necessity.
454 $(NODEBUG) !
455 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
456 $(NODEBUG) openssl_inc2 = F$PARSE("sourcetop:[include.openssl]","A.;",,,"SYNTAX_ONLY") - "A.;"
457 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
458 $(NODEBUG) !
459 $(NODEBUG) ! Figure out the architecture
460 $(NODEBUG) !
461 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
462 $(NODEBUG) !
463 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
464 $(NODEBUG) ! running programs can use them.
465 $(NODEBUG) !
466 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
467
468 .LAST :
469 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
470 $(NODEBUG) DEASSIGN openssl
471 $(NODEBUG) DEASSIGN ossl_dataroot
472 $(NODEBUG) DEASSIGN ossl_installroot
473 $(NODEBUG) DEASSIGN ossl_sourceroot
474 .DEFAULT :
475 @ ! MMS cannot handle no actions...
476
477 # The main targets ###################################################
478
479 {- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
480 {- dependmagic('build_libs'); -} : build_libs_nodep
481 {- dependmagic('build_modules'); -} : build_modules_nodep
482 {- dependmagic('build_programs'); -} : build_programs_nodep
483
484 build_generated_pods : $(GENERATED_PODS)
485 build_docs : build_html_docs
486 build_html_docs : $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
487
488 build_generated : $(GENERATED_MANDATORY)
489 build_libs_nodep : $(LIBS), $(SHLIBS)
490 build_modules_nodep : $(MODULES)
491 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
492
493 # Kept around for backward compatibility
494 build_apps build_tests : build_programs
495
496 # Convenience target to prebuild all generated files, not just the mandatory
497 # ones
498 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
499 @ ! {- output_off() if $disabled{makedepend}; "" -}
500 @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
501 @ WRITE SYS$OUTPUT " target system doesn't have $(PERL),"
502 @ WRITE SYS$OUTPUT " then make will fail..."
503 @ ! {- output_on() if $disabled{makedepend}; "" -}
504
505 all : build_sw build_docs
506
507 test : tests
508 {- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep run_tests
509 run_tests :
510 @ ! {- output_off() if $disabled{tests}; "" -}
511 DEFINE SRCTOP "$(SRCDIR)"
512 DEFINE BLDTOP "$(BLDDIR)"
513 DEFINE FIPSKEY "$(FIPSKEY)"
514 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
515 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
516 DEASSIGN BLDTOP
517 DEASSIGN SRCTOP
518 DEASSIGN FIPSKEY
519 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
520 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
521 @ ! {- output_on() if !$disabled{tests}; "" -}
522
523 list-tests :
524 @ ! {- output_off() if $disabled{tests}; "" -}
525 @ DEFINE SRCTOP "$(SRCDIR)"
526 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
527 @ DEASSIGN SRCTOP
528 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
529 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
530 @ ! {- output_on() if !$disabled{tests}; "" -}
531
532 install : install_sw install_ssldirs install_docs {- $disabled{fips} ? "" : "install_fips" -} install_msg
533
534 install_msg :
535 @ WRITE SYS$OUTPUT ""
536 @ WRITE SYS$OUTPUT "######################################################################"
537 @ WRITE SYS$OUTPUT ""
538 @ IF "$(DESTDIR)" .EQS. "" THEN -
539 @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}"
540 @ IF "$(DESTDIR)" .NES. "" THEN -
541 @{- sourcefile("VMS", "msg_staging.com") -} -
542 "''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" -
543 "$(SYSTARTUP)" "{- $osslver -}"
544
545 check_install :
546 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
547
548 uninstall : uninstall_docs uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -}
549
550 # Because VMS wants the generation number (or *) to delete files, we can't
551 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
552 libclean :
553 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
554 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
555
556 clean : libclean
557 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
558 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
559 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
560 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
561 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
562 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
563 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
564 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
565 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
566 - DELETE [...]*.MAP;*
567 - DELETE [...]*.D;*
568 - DELETE [...]*.OBJ;*,*.LIS;*
569 - DELETE []CXX$DEMANGLER_DB.;*
570 - DELETE [.VMS]openssl_startup.com;*
571 - DELETE [.VMS]openssl_shutdown.com;*
572 - DELETE []vmsconfig.pm;*
573
574 distclean : clean
575 - DELETE [.include.openssl]configuration.h;*
576 - DELETE configdata.pm;*
577 - DELETE descrip.mms;*
578
579 depend : descrip.mms
580 @ ! {- output_off() if $disabled{makedepend}; "" -}
581 @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "{- $config{makedep_scheme} -}"
582 @ ! {- output_on() if $disabled{makedepend}; "" -}
583
584 # Install helper targets #############################################
585
586 install_sw : install_dev install_engines install_modules -
587 install_runtime install_startup install_ivp
588
589 uninstall_sw : uninstall_dev uninstall_modules uninstall_engines -
590 uninstall_runtime uninstall_startup uninstall_ivp
591
592 install_docs : install_html_docs
593
594 uninstall_docs : uninstall_html_docs
595
596 {- output_off() if $disabled{fips}; "" -}
597 install_fips : build_sw $(INSTALL_FIPSMODULECONF)
598 @ WRITE SYS$OUTPUT "*** Installing FIPS module"
599 - CREATE/DIR ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']
600 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
601 COPY/PROT=W:RE $(INSTALL_FIPSMODULES) -
602 ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']$(FIPSMODULENAME)
603 @ WRITE SYS$OUTPUT "*** Installing FIPS module configuration"
604 COPY/PROT=W:RE $(INSTALL_FIPSMODULECONF) OSSL_DATAROOT:[000000]
605
606 uninstall_fips :
607 @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module configuration"
608 DELETE OSSL_DATAROOT:[000000]fipsmodule.cnf;*
609 @ WRITE SYS$OUTPUT "*** Uninstalling FIPS module"
610 DELETE ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']$(FIPSMODULENAME);*
611 {- output_on() if $disabled{fips}; "" -}
612
613 install_ssldirs : check_INSTALLTOP
614 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
615 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
616 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
617 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
618 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
619 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
620 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
621 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
622 @ ! Install configuration file
623 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
624 ossl_dataroot:[000000]openssl.cnf-dist
625 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
626 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
627 ossl_dataroot:[000000]openssl.cnf
628 @ ! Install CTLOG configuration file
629 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
630 ossl_dataroot:[000000]ct_log_list.cnf-dist
631 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
632 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
633 ossl_dataroot:[000000]ct_log_list.cnf
634
635 install_dev : check_INSTALLTOP install_runtime_libs
636 @ WRITE SYS$OUTPUT "*** Installing development files"
637 @ ! Install header files
638 - CREATE/DIR ossl_installroot:[include.openssl]
639 COPY/PROT=W:R ossl_sourceroot:[include.openssl]*.h -
640 ossl_installroot:[include.openssl]
641 COPY/PROT=W:R [.include.openssl]*.h ossl_installroot:[include.openssl]
642 @ ! Install static (development) libraries
643 - CREATE/DIR ossl_installroot:[LIB.'arch']
644 {- join("\n ",
645 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
646 @install_libs) -}
647
648 install_engines : check_INSTALLTOP install_runtime_libs build_modules
649 @ {- output_off() unless scalar @install_engines; "" -} !
650 @ WRITE SYS$OUTPUT "*** Installing engines"
651 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
652 {- join("\n ",
653 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
654 @install_engines) -}
655 @ {- output_on() unless scalar @install_engines; "" -} !
656
657 install_modules : check_INSTALLTOP install_runtime_libs build_modules
658 @ {- output_off() unless scalar @install_modules; "" -} !
659 @ WRITE SYS$OUTPUT "*** Installing modules"
660 - CREATE/DIR ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']
661 {- join("\n ",
662 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$target{pointer_size}.'arch']" }
663 @install_modules) -}
664 @ {- output_on() unless scalar @install_modules; "" -} !
665
666 install_runtime : install_programs
667
668 install_runtime_libs : check_INSTALLTOP build_libs
669 @ {- output_off() if $disabled{shared}; "" -} !
670 @ WRITE SYS$OUTPUT "*** Installing shareable images"
671 @ ! Install shared (runtime) libraries
672 - CREATE/DIR ossl_installroot:[LIB.'arch']
673 {- join("\n ",
674 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
675 @install_shlibs) -}
676 @ {- output_on() if $disabled{shared}; "" -} !
677
678 install_programs : check_INSTALLTOP install_runtime_libs build_programs
679 @ {- output_off() if $disabled{apps}; "" -} !
680 @ ! Install the main program
681 - CREATE/DIR ossl_installroot:[EXE.'arch']
682 COPY/PROT=W:RE [.APPS]openssl.EXE -
683 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
684 @ ! Install scripts
685 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
686 @ ! {- output_on() if $disabled{apps}; "" -}
687
688 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
689 [.VMS]openssl_utils.com, check_INSTALLTOP
690 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
691 COPY/PROT=W:RE [.VMS]openssl_startup.com -
692 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
693 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
694 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
695 COPY/PROT=W:RE [.VMS]openssl_utils.com -
696 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
697
698 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
699 - CREATE/DIR ossl_installroot:[SYSTEST]
700 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
701 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
702
703 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
704 - CREATE/DIR [.VMS]
705 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
706 {- sourcefile("VMS", "openssl_startup.com.in") -} -
707 > [.VMS]openssl_startup.com
708
709 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
710 - CREATE/DIR [.VMS]
711 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
712 {- sourcefile("VMS", "openssl_utils.com.in") -} -
713 > [.VMS]openssl_utils.com
714
715 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
716 - CREATE/DIR [.VMS]
717 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
718 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
719 > [.VMS]openssl_shutdown.com
720
721 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
722 - CREATE/DIR [.VMS]
723 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
724 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
725 > [.VMS]openssl_ivp.com
726
727 vmsconfig.pm : configdata.pm
728 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
729 WRITE CONFIG "package vmsconfig;"
730 WRITE CONFIG "use strict; use warnings;"
731 WRITE CONFIG "use Exporter;"
732 WRITE CONFIG "our @ISA = qw(Exporter);"
733 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
734 WRITE CONFIG "our %config = ("
735 WRITE CONFIG " target => '","{- $config{target} -}","',"
736 WRITE CONFIG " version => '","{- $config{version} -}","',"
737 WRITE CONFIG " shlib_version => '","{- $config{shlib_version} -}","',"
738 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
739 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
740 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
741 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
742 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
743 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
744 WRITE CONFIG ");"
745 WRITE CONFIG "our %target = ();"
746 WRITE CONFIG "our %disabled = ();"
747 WRITE CONFIG "our %withargs = ();"
748 WRITE CONFIG "our %unified_info = ();"
749 WRITE CONFIG "1;"
750 CLOSE CONFIG
751
752 install_html_docs : check_INSTALLTOP build_html_docs
753 @ WRITE SYS$OUTPUT "*** Installing HTML docs"
754 - CREATE/DIR ossl_installroot:[HTML.MAN1]
755 - CREATE/DIR ossl_installroot:[HTML.MAN3]
756 - CREATE/DIR ossl_installroot:[HTML.MAN5]
757 - CREATE/DIR ossl_installroot:[HTML.MAN7]
758 {- join("\n ",
759 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
760 @{$unified_info{htmldocs}->{man1}} ),
761 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
762 @{$unified_info{htmldocs}->{man3}} ),
763 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
764 @{$unified_info{htmldocs}->{man5}} ),
765 ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
766 @{$unified_info{htmldocs}->{man7}} )) -}
767
768 check_INSTALLTOP :
769 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
770 WRITE SYS$ERROR "INSTALLTOP should not be empty"
771 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
772 EXIT %x10000002
773
774 # Developer targets ##################################################
775
776 debug_logicals :
777 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
778
779 # Building targets ###################################################
780
781 descrip.mms : configdata.pm {- join(" ", @{$config{build_file_templates}}) -}
782 perl configdata.pm
783 @ WRITE SYS$OUTPUT "*************************************************"
784 @ WRITE SYS$OUTPUT "*** ***"
785 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
786 @ WRITE SYS$OUTPUT "*** ***"
787 @ WRITE SYS$OUTPUT "*************************************************"
788 @ PIPE ( EXIT %X10000000 )
789
790 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_infos}}, @{$config{conf_files}}) -}
791 perl configdata.pm -r
792 @ WRITE SYS$OUTPUT "*************************************************"
793 @ WRITE SYS$OUTPUT "*** ***"
794 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
795 @ WRITE SYS$OUTPUT "*** ***"
796 @ WRITE SYS$OUTPUT "*************************************************"
797 @ PIPE ( EXIT %X10000000 )
798
799 reconfigure reconf :
800 perl configdata.pm -r
801
802 {-
803 use File::Basename;
804 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
805 use File::Spec::Unix;
806
807 # Helper function to convert dependencies in platform agnostic form to
808 # dependencies in platform form.
809 sub compute_platform_depends {
810 map { my $x = $_;
811
812 grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
813 or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
814 or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
815 or platform->convertext($x); } @_;
816 }
817
818 # Helper function to figure out dependencies on libraries
819 # It takes a list of library names and outputs a list of dependencies
820 sub compute_lib_depends {
821 # Depending on shared libraries:
822 # On Windows POSIX layers, we depend on {libname}.dll.a
823 # On Unix platforms, we depend on {shlibname}.so
824 return map {
825 { lib => platform->sharedlib($_) // platform->staticlib($_),
826 attrs => $unified_info{attributes}->{libraries}->{$_} }
827 } @_;
828 }
829
830 # Helper function to deal with inclusion directory specs.
831 # We're dealing with two issues:
832 # 1. A lot of include directory specs take up a lot of command line real
833 # estate, and the DCL command line is very limited (2KiB).
834 # 2. For optimal usage, include directory paths must be in Unix form,
835 # that's the only way the C compiler can merge multiple include paths
836 # in a sane way (we can stop worrying about 1.h including foo/2.h
837 # including ../3.h).
838 #
839 # To resolve 1, we need to create a file with include directory pragmas,
840 # and let the compiler use it with /FIRST_INCLUDE=.
841 # To resolve 2, we convert all include directory specs we get to Unix,
842 # with available File::Spec functions.
843 #
844 # We use CRC-24 from https://tools.ietf.org/html/rfc4880#section-6,
845 # reimplemented in Perl to get a workable and constant file name for each
846 # combination of include directory specs. It is assumed that the order of
847 # these directories don't matter.
848 #
849 # This function takes as input a list of include directories
850 # This function returns a list two things:
851 # 1. The file name to use with /FIRST_INCLUDE=
852 # 2. Text to insert into descrip.mms (may be the empty string)
853 sub crc24 {
854 my $input = shift;
855
856 my $init_value = 0x00B704CE;
857 my $poly_value = 0x01864CFB;
858
859 my $crc = $init_value;
860
861 foreach my $x (unpack ('C*', $input)) {
862 $crc ^= $x << 16;
863
864 for (my $i; $i < 8; $i++) {
865 $crc <<= 1;
866 if ($crc & 0x01000000) {
867 $crc ^= $poly_value;
868 }
869 }
870 }
871 $crc &= 0xFFFFFF;
872
873 return $crc;
874 }
875 my %includefile_cache;
876 sub make_includefile {
877 my %dirs = map {
878 my $udir = make_unix_path(rel2abs($_));
879
880 $udir => 1;
881 } @_;
882 my @dirs = sort keys %dirs;
883 my $filename = sprintf 'incdirs_%x.h', crc24(join(',', @dirs));
884
885 if ($includefile_cache{$filename}) {
886 return ($filename, "");
887 }
888
889 my $scripture = <<"EOF";
890 $filename :
891 open/write inc_output $filename
892 EOF
893 foreach (@dirs) {
894 $scripture .= <<"EOF";
895 write inc_output "#pragma include_directory ""$_"""
896 EOF
897 }
898 $scripture .= <<"EOF";
899 close inc_output
900 EOF
901 $includefile_cache{$filename} = $scripture;
902
903 return ($filename, $scripture);
904 }
905
906 # On VMS, (some) header file directories include the files
907 # __DECC_INCLUDE_EPILOGUE.H and __DECC_INCLUDE_PROLOGUE.H.
908 # When header files are generated, and the build directory
909 # isn't the same as the source directory, these files must
910 # be copied alongside the generated header file, or their
911 # effect will be lost.
912 # We use the same include file cache as make_includefile
913 # to check if the scripture to copy these files has already
914 # been generated.
915 sub make_decc_include_files {
916 my $outd = shift;
917 my $ind = shift;
918
919 # If the build directory and the source directory are the
920 # same, there's no need to copy the prologue and epilogue
921 # files.
922 return ('') if $outd eq $ind;
923
924 my $outprologue = catfile($outd, '__DECC_INCLUDE_PROLOGUE.H');
925 my $outepilogue = catfile($outd, '__DECC_INCLUDE_EPILOGUE.H');
926 my $inprologue = catfile($ind, '__DECC_INCLUDE_PROLOGUE.H');
927 my $inepilogue = catfile($ind, '__DECC_INCLUDE_EPILOGUE.H');
928 my @filenames = ();
929 my $scripture = '';
930
931 if ($includefile_cache{$outprologue}) {
932 push @filenames, $outprologue;
933 } elsif (-f $inprologue) {
934 my $local_scripture .= <<"EOF";
935 $outprologue : $inprologue
936 COPY $inprologue $outprologue
937 EOF
938 $includefile_cache{$outprologue} = $local_scripture;
939
940 push @filenames, $outprologue;
941 $scripture .= $local_scripture;
942 }
943 if ($includefile_cache{$outepilogue}) {
944 push @filenames, $outepilogue;
945 } elsif (-f $inepilogue) {
946 my $local_scripture .= <<"EOF";
947 $outepilogue : $inepilogue
948 COPY $inepilogue $outepilogue
949 EOF
950 $includefile_cache{$outepilogue} = $local_scripture;
951
952 push @filenames, $outepilogue;
953 $scripture .= $local_scripture;
954 }
955
956 return (@filenames, $scripture);
957 }
958
959 sub generatetarget {
960 my %args = @_;
961 my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
962 return <<"EOF";
963 $args{target} : $deps
964 EOF
965 }
966
967 sub generatesrc {
968 my %args = @_;
969 my $gen0 = $args{generator}->[0];
970 my $gen_args = join('', map { " $_" }
971 @{$args{generator}}[1..$#{$args{generator}}]);
972 my $gen_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
973 my $deps = join(", -\n\t\t",
974 compute_platform_depends(@{$args{generator_deps}},
975 @{$args{deps}}));
976
977 if ($args{src} =~ /\.html$/) {
978 #
979 # HTML generator
980 #
981 my $title = basename($args{src}, ".html");
982 my $pod = $gen0;
983 my $mkpod2html = sourcefile('util', 'mkpod2html.pl');
984 my $srcdoc = sourcedir('doc');
985 return <<"EOF";
986 $args{src} : $pod
987 \$(PERL) $mkpod2html -i $pod -o \$\@ -t "$title" -r "$srcdoc"
988 EOF
989 } elsif ($args{src} =~ /\.(\d)$/) {
990 #
991 # Man-page generator, on VMS we simply ignore man-pages
992 #
993 return "";
994 } elsif (platform->isdef($args{src})) {
995 #
996 # Linker script-ish generator
997 #
998 my $target = platform->def($args{src});
999 my $mkdef = sourcefile('util', 'mkdef.pl');
1000 my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
1001 my $ord_name =
1002 $args{generator}->[1] || basename($args{product}, '.EXE');
1003 my $case_insensitive =
1004 $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
1005 ? '' : ' --case-insensitive';
1006 return <<"EOF";
1007 $target : $gen0 $deps $mkdef
1008 \$(PERL) $mkdef$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name "--OS" "VMS"$case_insensitive > $target
1009 EOF
1010 } elsif (platform->isasm($args{src})
1011 || platform->iscppasm($args{src})) {
1012 #
1013 # Assembler generator
1014 #
1015 my $cppflags =
1016 { shlib => "$lib_cflags $lib_cppflags",
1017 lib => "$lib_cflags $lib_cppflags",
1018 dso => "$dso_cflags $dso_cppflags",
1019 bin => "$bin_cflags $bin_cppflags" } -> {$args{intent}};
1020 my $defs = join("", map { ",".$_ } @{$args{defs}});
1021 my $target = platform->isasm($args{src})
1022 ? platform->asm($args{src})
1023 : $args{src};
1024
1025 my $generator;
1026 if ($gen0 =~ /\.pl$/) {
1027 $generator = '$(PERL)'.$gen_incs.' '.$gen0.$gen_args
1028 .' '.$cppflags;
1029 } elsif ($gen0 =~ /\.S$/) {
1030 $generator = undef;
1031 } else {
1032 die "Generator type for $src unknown: $gen0.$gen_args\n";
1033 }
1034
1035 if (defined($generator)) {
1036 return <<"EOF";
1037 $target : $gen0 $deps
1038 \@ extradefines = "$defs"
1039 $generator \$\@
1040 \@ DELETE/SYMBOL/LOCAL extradefines
1041 EOF
1042 }
1043 return <<"EOF";
1044 $target : $gen0 $deps
1045 \@ extradefines = "$defs"
1046 PIPE \$(CPP) $cppflags $gen0 | -
1047 \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
1048 \@ DELETE/SYMBOL/LOCAL extradefines
1049 EOF
1050 } elsif ($gen0 =~ m|^.*\.in$|) {
1051 #
1052 # "dofile" generator (file.in -> file)
1053 #
1054 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1055 "util", "dofile.pl")),
1056 rel2abs($config{builddir}));
1057 my @perlmodules = ( 'configdata.pm',
1058 grep { $_ =~ m|\.pm$| } @{$args{deps}} );
1059 my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules;
1060 my @decc_include_data
1061 = make_decc_include_files(dirname($args{src}), dirname($gen0));
1062 my $decc_include_scripture = pop @decc_include_data;
1063 $deps = join(' ', $deps, @decc_include_data,
1064 compute_platform_depends(@perlmodules));
1065 @perlmodules = map { '"-M'.basename($_, '.pm').'"' } @perlmodules;
1066 my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @perlmodules);
1067
1068 return <<"EOF";
1069 $args{src} : $gen0 $deps
1070 \$(PERL)$perlmodules $dofile "-o$target{build_file}" $gen0$gen_args > \$\@
1071 $decc_include_scripture
1072 EOF
1073 } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
1074 #
1075 # Generic generator using OpenSSL programs
1076 #
1077
1078 # Redo $gen0, to ensure that we have the proper extension
1079 $gen0 = platform->bin($gen0);
1080 return <<"EOF";
1081 $args{src} : $gen0 $deps
1082 PIPE MCR $gen0$gen_args > \$@
1083 EOF
1084 } else {
1085 #
1086 # Generic generator using Perl
1087 #
1088 return <<"EOF";
1089 $args{src} : $gen0 $deps
1090 \$(PERL)$gen_incs $gen0$gen_args > \$\@
1091 EOF
1092 }
1093 }
1094
1095 sub src2obj {
1096 my $asmext = platform->asmext();
1097 my %args = @_;
1098 my @srcs =
1099 map { my $x = $_;
1100 (platform->isasm($x) && grep { $x eq $_ } @generated)
1101 ? platform->asm($x) : $x }
1102 ( @{$args{srcs}} );
1103 my $obj = platform->obj($args{obj});
1104 my $dep = platform->dep($args{obj});
1105 my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
1106
1107 # Because VMS C isn't very good at combining a /INCLUDE path with
1108 # #includes having a relative directory (like '#include "../foo.h"),
1109 # the best choice is to move to the first source file's intended
1110 # directory before compiling, and make sure to write the object file
1111 # in the correct position (important when the object tree is other
1112 # than the source tree).
1113 my $forward = dirname($args{srcs}->[0]);
1114 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
1115 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
1116 my $objn = basename($obj);
1117 my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
1118 my $depn = basename($dep);
1119 my $srcs =
1120 join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
1121 my $incextra = join(',', map { "\"$_\"" }
1122 @{$unified_info{includes_extra}->{$obj}});
1123 $incextra = "/INCLUDE=($incextra)" if $incextra;
1124
1125 my $cflags;
1126 if ($args{attrs}->{noinst}) {
1127 $cflags .= { shlib => $lib_cflags_no_inst,
1128 lib => $lib_cflags_no_inst,
1129 dso => $dso_cflags_no_inst,
1130 bin => $bin_cflags_no_inst } -> {$args{intent}};
1131 } else {
1132 $cflags .= { shlib => $lib_cflags,
1133 lib => $lib_cflags,
1134 dso => $dso_cflags,
1135 bin => $bin_cflags } -> {$args{intent}};
1136 }
1137 $cflags .= { shlib => $lib_cppflags,
1138 lib => $lib_cppflags,
1139 dso => $dso_cppflags,
1140 bin => $bin_cppflags } -> {$args{intent}};
1141 $cflags .= $incextra;
1142 my $defs = join("", map { ",".$_ } @{$args{defs}});
1143 my $asflags = { shlib => $lib_asflags,
1144 lib => $lib_asflags,
1145 dso => $dso_asflags,
1146 bin => $bin_asflags } -> {$args{intent}};
1147
1148 if ($srcs[0] =~ /\Q${asmext}\E$/) {
1149 return <<"EOF";
1150 $obj : $deps
1151 SET DEFAULT $forward
1152 \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn} $srcs
1153 SET DEFAULT $backward
1154 - PURGE $obj
1155 EOF
1156 } elsif ($srcs[0] =~ /.S$/) {
1157 return <<"EOF";
1158 $obj : $deps
1159 SET DEFAULT $forward
1160 \@ $incs_on
1161 \@ extradefines = "$defs"
1162 PIPE \$(CPP) ${cflags} $srcs | -
1163 \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
1164 > ${objd}${objn}-asm
1165 \@ DELETE/SYMBOL/LOCAL extradefines
1166 \@ $incs_off
1167 SET DEFAULT $backward
1168 \$(AS) $asflags \$(ASOUTFLAG)$obj $obj-asm
1169 - PURGE $obj
1170 EOF
1171 }
1172
1173 my ($incdir_filename, $incdir_scripture) =
1174 make_includefile(@{ { shlib => [ @lib_cppincludes ],
1175 lib => [ @lib_cppincludes ],
1176 dso => [ @dso_cppincludes ],
1177 bin => [ @bin_cppincludes ] } -> {$args{intent}} },
1178 @{$args{incs}});
1179 $deps .= ", -\n\t\t$incdir_filename";
1180 $cflags =
1181 $target{cflag_incfirst}
1182 . '"'.make_unix_path(rel2abs($incdir_filename)).'"'
1183 . $cflags;
1184
1185 my $depbuild = $disabled{makedepend} ? ""
1186 : " /MMS=(FILE=${depd}${depn},TARGET=$obj)";
1187
1188 return <<"EOF";
1189 $obj : $deps
1190 SET DEFAULT $forward
1191 \@ $incs_on
1192 \@ extradefines = "$defs"
1193 \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn} /REPOSITORY=$backward $srcs
1194 \@ DELETE/SYMBOL/LOCAL extradefines
1195 \@ $incs_off
1196 SET DEFAULT $backward
1197 - PURGE $obj
1198 $incdir_scripture
1199 EOF
1200 }
1201 sub obj2shlib {
1202 my %args = @_;
1203 my $shlibname = platform->sharedname($args{lib});
1204 my $shlib = platform->sharedlib($args{lib});
1205 my @objs = map { platform->convertext($_) }
1206 grep { platform->isobj($_) }
1207 @{$args{objs}};
1208 my @defs = map { platform->convertext($_) }
1209 grep { platform->isdef($_) }
1210 @{$args{objs}};
1211 my @deps = compute_lib_depends(@{$args{deps}});
1212 die "More than one symbol vector" if scalar @defs > 1;
1213 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1214 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1215 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
1216 "VMS", "translatesyms.pl")),
1217 rel2abs($config{builddir}));
1218 # The "[]" hack is because in .OPT files, each line inherits the
1219 # previous line's file spec as default, so if no directory spec
1220 # is present in the current line and the previous line has one that
1221 # doesn't apply, you're in for a surprise.
1222 my $write_opt1 =
1223 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1224 "WRITE OPT_FILE \"$x" } @objs).
1225 "\"";
1226 my $write_opt2 =
1227 join("\n\t", map { my $x = $_->{lib} =~ /\[/
1228 ? $_->{lib} : "[]".$_->{lib};
1229 $x =~ s|(\.EXE)|$1/SHARE|;
1230 $x =~ s|(\.OLB)|$1/LIB|;
1231 "WRITE OPT_FILE \"$x\"" } @deps)
1232 || "\@ !";
1233 return <<"EOF"
1234 $shlib : $deps
1235 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
1236 OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
1237 $write_opt1
1238 $write_opt2
1239 CLOSE OPT_FILE
1240 LINK ${lib_ldflags}/SHARE=\$\@ $defs[0]-translated/OPT,-
1241 $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1242 DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1243 PURGE $shlibname.EXE,$shlibname.MAP
1244 EOF
1245 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1246 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1247 EOF
1248 );
1249 }
1250 sub obj2dso {
1251 my %args = @_;
1252 my $dsoname = platform->dsoname($args{module});
1253 my $dso = platform->dso($args{module});
1254 my @objs = map { platform->convertext($_) }
1255 grep { platform->isobj($_) }
1256 @{$args{objs}};
1257 my @defs = map { platform->convertext($_) }
1258 grep { platform->isdef($_) }
1259 @{$args{objs}};
1260 my @deps = compute_lib_depends(@{$args{deps}});
1261 my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1262 die "More than one symbol vector" if scalar @defs > 1;
1263 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1264 # The "[]" hack is because in .OPT files, each line inherits the
1265 # previous line's file spec as default, so if no directory spec
1266 # is present in the current line and the previous line has one that
1267 # doesn't apply, you're in for a surprise.
1268 # Furthermore, we collect all object files and static libraries in
1269 # an explicit cluster, to make it clear to the linker that these files
1270 # shall be processed before shareable images.
1271 # The shareable images are used with /SELECTIVE, to avoid warnings of
1272 # multiply defined symbols when the module object files override some
1273 # symbols that are present in the shareable image.
1274 my $write_opt1 =
1275 join(",-\"\n\t",
1276 "\@ WRITE OPT_FILE \"CLUSTER=_,,",
1277 (map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1278 "\@ WRITE OPT_FILE \"$x" } @objs),
1279 (map { my $x = ($_->{lib} =~ /\[/) ? $_->{lib} : "[]".$_->{lib};
1280 "\@ WRITE OPT_FILE \"$x/LIB" }
1281 grep { $_->{lib} =~ m|\.OLB$| }
1282 @deps))
1283 ."\"";
1284 my $write_opt2 =
1285 join("\n\t",
1286 (map { my $x = ($_->{lib} =~ /\[/) ? $_->{lib} : "[]".$_->{lib};
1287 "\@ WRITE OPT_FILE \"$x/SHARE/SELECTIVE\"" }
1288 grep { $_->{lib} =~ m|\.EXE$| }
1289 @deps))
1290 || "\@ !";
1291 return <<"EOF"
1292 $dso : $deps
1293 OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1294 $write_opt1
1295 $write_opt2
1296 CLOSE OPT_FILE
1297 LINK ${dso_ldflags}/SHARE=\$\@ $defs[0]/OPT,-
1298 $dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1299 - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1300 EOF
1301 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1302 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1303 EOF
1304 );
1305 }
1306 sub obj2lib {
1307 my %args = @_;
1308 my $lib = platform->staticlib($args{lib});
1309 my @objs = map { platform->convertext($_) }
1310 grep { platform->isobj($_) }
1311 @{$args{objs}};
1312 my $objs = join(", -\n\t\t", @objs);
1313 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1314 return <<"EOF";
1315 $lib : $objs
1316 LIBRARY/CREATE/OBJECT $lib
1317 $fill_lib
1318 - PURGE $lib
1319 EOF
1320 }
1321 sub obj2bin {
1322 my %args = @_;
1323 my $bin = platform->bin($args{bin});
1324 my $binname = platform->binname($args{bin});
1325 my @objs = map { platform->convertext($_) }
1326 grep { platform->isobj($_) }
1327 @{$args{objs}};
1328 my $objs = join(",", @objs);
1329 my @deps = compute_lib_depends(@{$args{deps}});
1330 my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1331
1332 my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1333 my $analyse_objs = "@ !";
1334 if ($olb_count > 0) {
1335 my $analyse_quals =
1336 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1337 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1338 }
1339 # The "[]" hack is because in .OPT files, each line inherits the
1340 # previous line's file spec as default, so if no directory spec
1341 # is present in the current line and the previous line has one that
1342 # doesn't apply, you're in for a surprise.
1343 my $write_opt1 =
1344 "\@ WRITE OPT_FILE \"CASE_SENSITIVE=YES\"\n\t"
1345 .join(",-\"\n\t",
1346 "\@ WRITE OPT_FILE \"CLUSTER=_,,",
1347 (map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1348 "\@ WRITE OPT_FILE \"$x" } @objs),
1349 (map { my $x = ($_->{lib} =~ /\[/) ? $_->{lib} : "[]".$_->{lib};
1350 # Special hack to include the MAIN object module
1351 # explicitly, if it's known that there is one.
1352 # |incmain| is defined in the rule generation further
1353 # down, with the necessary /INCLUDE=main option unless
1354 # the program has been determined to have a main function
1355 # already.
1356 $_->{attrs}->{has_main}
1357 ? "\@ WRITE OPT_FILE \"$x/LIB''incmain'"
1358 : "\@ WRITE OPT_FILE \"$x/LIB" }
1359 grep { $_->{lib} =~ m|\.OLB$| }
1360 @deps))
1361 ."\"";
1362 my $write_opt2 =
1363 join("\n\t",
1364 (map { my $x = $_->{lib} =~ /\[/ ? $_->{lib} : "[]".$_->{lib};
1365 "\@ WRITE OPT_FILE \"$x/SHARE/SELECTIVE\"" }
1366 grep { $_->{lib} =~ m|\.EXE$| }
1367 @deps))
1368 || "\@ !";
1369 # The linking commands looks a bit complex, but it's for good reason.
1370 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1371 # bar.obj happens to have a symbol that also exists in libsomething.exe,
1372 # the linker will warn about it, loudly, and will then choose to pick
1373 # the first copy encountered (the one in bar.obj in this example).
1374 # On Unix and on Windows, the corresponding maneuver goes through
1375 # silently with the same effect.
1376 # With some test programs, made for checking the internals of OpenSSL,
1377 # we do this kind of linking deliberately, picking a few specific object
1378 # files from within [.crypto] or [.ssl] so we can reach symbols that are
1379 # otherwise unreachable (since the shareable images only exports the
1380 # symbols listed in [.util]*.num), and then with the shared libraries
1381 # themselves. So we need to silence the warning about multiply defined
1382 # symbols, to mimic the way linking work on Unix and Windows, and so
1383 # the build isn't interrupted (MMS stops when warnings are signaled,
1384 # by default), and so someone building doesn't have to worry where it
1385 # isn't necessary. If there are other warnings, however, we show them
1386 # and let it break the build.
1387 return <<"EOF"
1388 $bin : $deps
1389 $analyse_objs
1390 @ incmain = "/INCLUDE=main"
1391 @ IF .NOT. nomain THEN incmain = ""
1392 @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1393 $write_opt1
1394 $write_opt2
1395 @ CLOSE OPT_FILE
1396 TYPE $binname.OPT ! For debugging
1397 - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1398 LINK ${bin_ldflags}/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1399 link_status = \$status ; link_severity = link_status .AND. 7
1400 @ search_severity = 1
1401 -@ IF link_severity .EQ. 0 THEN -
1402 pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1403 SPAWN/WAIT/NOLOG/OUT=NLA0: -
1404 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1405 search_severity = \$severity
1406 @ ! search_severity is 3 when the last search didn't find any matching
1407 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1408 @ ! If that was the result, we pretend linking got through without
1409 @ ! fault or warning.
1410 @ IF search_severity .EQ. 3 THEN link_severity = 1
1411 @ ! At this point, if link_severity shows that there was a fault
1412 @ ! or warning, make sure to restore the linking status.
1413 -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1414 -@ DELETE $binname.LINKLOG;*
1415 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1416 - PURGE $bin,$binname.OPT
1417 EOF
1418 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1419 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1420 EOF
1421 );
1422 }
1423 sub in2script {
1424 my %args = @_;
1425 my $script = $args{script};
1426 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1427 my $sources = join(" ", @{$args{sources}});
1428 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1429 "util", "dofile.pl")),
1430 rel2abs($config{builddir}));
1431 return <<"EOF";
1432 $script : $sources configdata.pm
1433 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1434 "-o$target{build_file}" $sources > $script
1435 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1436 PURGE $script
1437 EOF
1438 }
1439 "" # Important! This becomes part of the template result.
1440 -}