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