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