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