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