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