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