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