1 ## descrip.mms to build OpenSSL on OpenVMS
3 ## {- join("\n## ", @autowarntext) -}
5 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
7 # Our prefix, claimed when speaking with the VSI folks Tuesday
9 our $osslprefix = 'OSSL$';
10 (our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/;
12 our $sourcedir = $config{sourcedir};
13 our $builddir = $config{builddir};
15 catfile($sourcedir, @_);
18 catfile($builddir, @_);
21 catdir($sourcedir, @_);
24 catdir($builddir, @_);
27 (my $x = shift) =~ s|\]$|...]|;
32 my $b = abs2rel(rel2abs("."),rel2abs($f));
33 $sourcedir = catdir($b,$sourcedir)
34 if !file_name_is_absolute($sourcedir);
35 $builddir = catdir($b,$builddir)
36 if !file_name_is_absolute($builddir);
40 # This is a horrible hack, but is needed because recursive inclusion of files
41 # in different directories does not work well with HP C.
42 my $sd = sourcedir("crypto", "async", "arch");
43 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
44 (my $x = $_) =~ s|\.o$|.OBJ|;
45 $unified_info{before}->{$x}
46 = qq(arch = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
48 $unified_info{after}->{$x}
51 my $sd1 = sourcedir("ssl","record");
52 my $sd2 = sourcedir("ssl","statem");
53 $unified_info{before}->{"[.crypto.ct]ct_lib.OBJ"}
54 = $unified_info{before}->{"[.test]heartbeat_test.OBJ"}
55 = $unified_info{before}->{"[.test]ssltest.OBJ"}
56 = qq(record = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
57 define record 'record'
58 statem = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
59 define statem 'statem');
60 $unified_info{after}->{"[.crypto.ct]ct_lib.OBJ"}
61 = $unified_info{after}->{"[.test]heartbeat_test.OBJ"}
62 = $unified_info{after}->{"[.test]ssltest.OBJ"}
65 foreach (grep /^\[\.ssl\.(?:record|statem)\].*\.o$/, keys %{$unified_info{sources}}) {
66 (my $x = $_) =~ s|\.o$|.OBJ|;
67 $unified_info{before}->{$x}
68 = qq(record = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
69 define record 'record'
70 statem = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
71 define statem 'statem');
72 $unified_info{after}->{$x}
77 #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
78 #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
81 PLATFORM={- $config{target} -}
82 OPTIONS={- $config{options} -}
83 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
84 SRCDIR={- $config{sourcedir} -}
85 BUILDDIR={- $config{builddir} -}
87 VERSION={- $config{version} -}
88 MAJOR={- $config{major} -}
89 MINOR={- $config{minor} -}
90 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
91 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
92 SHLIB_MAJOR={- $config{shlib_major} -}
93 SHLIB_MINOR={- $config{shlib_minor} -}
94 SHLIB_TARGET={- $target{shared_target} -}
102 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{libraries}}) -}
103 SHLIBS={- join(" ", map { $_."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -}
104 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
105 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } grep { !m|^\[\.test\]| } @{$unified_info{programs}}) -}
106 TESTPROGS={- join(", ", map { "-\n\t".$_.".EXE" } grep { m|^\[\.test\]| } @{$unified_info{programs}}) -}
107 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
109 # DESTDIR is for package builders so that they can configure for, say,
110 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
111 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
112 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
113 # STAGING:[USER.OPENSSL].
114 # Normally it is left empty.
117 # Do not edit this manually. Use Configure --prefix=DIR to change this!
118 INSTALLTOP={- catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL-\$(MAJOR).\$(MINOR)]" -}
119 # This is the standard central area to store certificates, private keys...
120 OPENSSLDIR={- catdir($config{openssldir}) ||
121 $config{prefix} ? catdir($config{prefix},"SSL")
122 : "SYS\$COMMON:[SSL]" -}
123 # Where installed engines reside
124 ENGINESDIR={- $osslprefix -}ENGINES:
126 CC= {- $target{cc} -}
127 CFLAGS= /DEFINE=({- join(",", @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR)\"\"\"") -}) {- $config{cflags} -}
128 DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -})
129 LDFLAGS= {- $config{lflags} -}
130 EX_LIBS= {- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
132 PERL={- $config{perl} -}
134 # We let the C compiler driver to take care of .s files. This is done in
135 # order to be excused from maintaining a separate set of architecture
136 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
137 # gcc, then the driver will automatically translate it to -xarch=v8plus
138 # and pass it down to assembler.
140 ASFLAG={- $target{asflags} -}
142 # .FIRST and .LAST are special targets with MMS and MMK.
143 # The defines in there are for C. includes that look like
146 # #include <openssl/foo.h>
147 # #include "internal/bar.h"
149 # will use the logical names to find the files. Expecting
150 # DECompHP C to find files in subdirectories of whatever was
151 # given with /INCLUDE is a fantasy, unfortunately.
154 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
155 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","a.;",,,"SYNTAX_ONLY") - "A.;"
156 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
157 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
158 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
159 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
160 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
161 $(NODEBUG) staging_dir = "$(DESTDIR)"
162 $(NODEBUG) IF staging_dir .NES. "" THEN -
163 staging_dir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY") - "A.;"
165 $(NODEBUG) ! Installation logical names
167 $(NODEBUG) installtop_dev = F$PARSE(staging_dir,"$(INSTALLTOP)",,"DEVICE","SYNTAX_ONLY")
168 $(NODEBUG) ! Because there are no routines to merge directories, we have to
169 $(NODEBUG) ! do it ourselves
170 $(NODEBUG) IF staging_dir .NES. "" THEN -
171 staging_dir = F$PARSE(staging_dir,"[000000]",,"DIRECTORY","SYNTAX_ONLY")
172 $(NODEBUG) installtop_dir = F$PARSE("$(INSTALLTOP)","[000000]",,"DIRECTORY","SYNTAX_ONLY")
173 $(NODEBUG) IF staging_dir .NES. "" .AND. staging_dir .NES. "[000000]" THEN -
174 installtop_dir = staging_dir - "]" + "." + (installtop_dir - "[")
175 $(NODEBUG) installtop_dir = installtop_dir - "]" + ".]"
176 $(NODEBUG) DEFINE ossl_installroot 'installtop_dev''installtop_dir'
178 $(NODEBUG) datatop = F$PARSE("$(OPENSSLDIR)","[000000]A.;",,,"SYNTAX_ONLY") -
180 $(NODEBUG) IF "$(DESTDIR)" .EQS. "" THEN -
181 DEFINE ossl_dataroot 'datatop'
183 $(NODEBUG) ! Figure out the architecture
185 $(NODEBUG) arch == f$edit( f$getsyi( "arch_name"), "upcase")
187 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
188 $(NODEBUG) ! running programs can use them.
190 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
193 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
194 $(NODEBUG) IF "$(DESTDIR)" .EQS. "" THEN DEASSIGN ossl_dataroot
195 $(NODEBUG) DEASSIGN ossl_installroot
196 $(NODEBUG) DEASSIGN internal
197 $(NODEBUG) DEASSIGN openssl
199 @ ! MMS cannot handle no actions...
201 # The main targets ###################################################
203 all : descrip.mms, build_libs, build_engines, build_apps
206 build_engines : $(ENGINES)
207 build_apps : $(PROGRAMS), $(SCRIPTS)
208 build_tests : $(TESTPROGS)
210 test tests : build_tests, rehash
211 SET DEFAULT [.test]{- move("test") -}
212 DEFINE SRCTOP {- sourcedir() -}
213 DEFINE BLDTOP {- builddir() -}
214 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
217 SET DEFAULT [-]{- move("..") -}
220 @ TOP=$(SRCDIR) PERL=$(PERL) $(PERL) {- catfile($config{sourcedir},"test", "run_tests.pl") -} list
222 # Because VMS wants the generation number (or *) to delete files, we can't
223 # use $(LIBS), $(PROGRAMS) and $(TESTPROGS) directly.
225 - DELETE []OSSL$LIB*.OLB;*,OSSL$LIB*.LIS;*
226 - DELETE [.crypto...]*.OBJ;*,*.LIS;*
227 - DELETE [.ssl...]*.OBJ;*,*.LIS;*
228 - DELETE [.engines...]*.OBJ;*,*.LIS;*
229 - DELETE []CXX$DEMANGLER_DB.;*
231 install : install_sw install_docs
233 uninstall : uninstall_docs uninstall_sw
236 - DELETE []OSSL$LIB*.EXE;*,OSSL$LIB*.MAP;*,OSSL$LIB*.OPT;*
237 - DELETE [.engines...]LIB*.EXE;*,LIB*.MAP;*,LIB*.OPT;*
238 - DELETE [.apps]*.EXE;*,*.MAP;*,*.OPT;*
239 - DELETE [.apps]*.OBJ;*,*.LIS;*
240 - DELETE [.test]*.EXE;*,*.MAP;*,*.OPT;*
241 - DELETE [.test]*.OBJ;*,*.LIS;*
242 - DELETE [.test]*.LOG;*
245 DCLEAN_CMD=$(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }"
247 $(DCLEAN_CMD) < descrip.mms > descrip.mms.new
248 RENAME descrip.mms.new descrip.mms
251 {- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
252 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
253 keys %{$unified_info{sources}};
255 depend : {- join(",-\n\t", @deps); -}
256 $(DCLEAN_CMD) < descrip.mms > descrip.mms.new
257 OPEN/APPEND DESCRIP descrip.mms.new
258 WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
259 {- join("\n\t", map { "TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
261 RENAME descrip.mms.new descrip.mms
264 # Install helper targets #############################################
266 install_sw : all install_dev install_engines install_runtime install_config
267 @ WRITE SYS$OUTPUT ""
268 @ WRITE SYS$OUTPUT "######################################################################"
269 @ WRITE SYS$OUTPUT ""
270 @ WRITE SYS$OUTPUT "Installation complete"
271 @ WRITE SYS$OUTPUT ""
272 @ IF "$(DESTDIR)" .NES. "" THEN EXIT 1
273 @ WRITE SYS$OUTPUT "Run @$(INSTALLTOP)openssl_startup to set up logical names"
274 @ WRITE SYS$OUTPUT "then run @$(INSTALLTOP)openssl_setup to define commands"
275 @ WRITE SYS$OUTPUT ""
277 uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime uninstall_config
279 install_docs : install_man_docs install_html_docs
281 uninstall_docs : uninstall_man_docs uninstall_html_docs
283 install_dev : check_INSTALLTOP
284 @ WRITE SYS$OUTPUT "*** Installing development files"
285 @ ! Install header files
286 CREATE/DIR ossl_installroot:[include.openssl]
287 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
288 @ ! Install libraries
289 CREATE/DIR ossl_installroot:['arch'.LIB]
291 map { "COPY/PROT=W:R $_.OLB ossl_installroot:['arch'.LIB]" }
292 @{$unified_info{libraries}}) -}
293 @ {- output_off() if $config{no_shared}; "" -} !
295 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:['arch'.LIB]" }
296 map { $unified_info{sharednames}->{$_} || () }
297 @{$unified_info{libraries}}) -}
298 @ {- output_on() if $config{no_shared}; "" -} !
300 install_runtime : check_INSTALLTOP
301 @ WRITE SYS$OUTPUT "*** Installing runtime files"
302 @ ! Install the main program
303 CREATE/DIR ossl_installroot:['arch'.EXE]
304 COPY/PROT=W:RE [.APPS]openssl.EXE ossl_installroot:['arch'.EXE]
306 CREATE/DIR ossl_installroot:[EXE]
307 COPY/PROT=W:RE [.APPS]CA.pl ossl_installroot:[EXE]
308 COPY/PROT=W:RE [.TOOLS]c_rehash. ossl_installroot:[EXE]c_rehash.pl
309 @ ! Install configuration file
310 COPY/PROT=W:RE {- sourcefile("apps", "openssl-vms.cnf") -} -
311 ossl_installroot:[000000]openssl.cnf
313 install_engines : check_INSTALLTOP
314 @ {- output_off() if $config{no_shared}; "" -} !
315 @ WRITE SYS$OUTPUT "*** Installing engines"
316 CREATE/DIR ossl_installroot:['arch'.ENGINES]
317 COPY/PROT=W:RE [.ENGINES]*.EXE ossl_installroot:['arch'.ENGINES]
318 @ {- output_on() if $config{no_shared}; "" -} !
320 install_config : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
322 IF "$(DESTDIR)" .EQS. "" THEN -
323 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
324 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
325 IF "$(DESTDIR)" .EQS. "" THEN -
326 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
327 CREATE/DIR/PROT=(S:RWED,O:RWE,G:,W:) OSSL_DATAROOT:[PRIVATE]
328 CREATE/DIR ossl_installroot:[SYS$STARTUP]
330 [.VMS]openssl_startup.com,openssl_shutdown.com -
331 ossl_installroot:[SYS$STARTUP]
333 {- sourcefile("VMS", "openssl_utils.com") -} -
334 ossl_installroot:[SYS$STARTUP]
336 [.VMS]openssl_startup.com : vmsconfig.pm
338 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
339 {- sourcefile("VMS", "openssl_startup.com.in") -} -
340 > [.VMS]openssl_startup.com
342 [.VMS]openssl_shutdown.com : vmsconfig.pm
344 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
345 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
346 > [.VMS]openssl_shutdown.com
348 vmsconfig.pm : descrip.mms
349 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
350 WRITE CONFIG "package vmsconfig;"
351 WRITE CONFIG "use strict; use warnings;"
352 WRITE CONFIG "use Exporter;"
353 WRITE CONFIG "our @ISA = qw(Exporter);"
354 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info);"
355 WRITE CONFIG "our %config = ("
356 WRITE CONFIG " target => '{- $config{target} -}',"
357 WRITE CONFIG " version => '$(MAJOR).$(MINOR)',"
358 WRITE CONFIG " no_shared => '","{- $config{no_shared} -}","',"
359 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
360 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
361 WRITE CONFIG " pointersize => '","{- $target{pointersize} -}","',"
362 WRITE CONFIG " shared_libs => ["
363 {- join("\n ", map { "WRITE CONFIG \" '$_'," } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "\@ !" -}
366 WRITE CONFIG "our %target = ();"
367 WRITE CONFIG "our %withargs = ();"
368 WRITE CONFIG "our %unified_info = ();"
373 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
374 WRITE SYS$ERROR "INSTALLTOP should not be empty"
375 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
378 # Helper targets #####################################################
380 rehash : [.apps]openssl.exe, copy-certs
381 !MCR [.apps]openssl.exe rehash {- builddir("certs", "demo") -}
382 $(PERL) [.tools]c_rehash. [.certs.demo]
385 @ IF F$SEARCH("{- buildfile("certs.dir") -}") .EQS. "" THEN -
386 CREATE/DIR {- builddir("certs") -}
387 -@ IF "{- sourcedir("certs") -}" .NES. "{- builddir("certs") -}" THEN -
388 COPY {- tree(sourcedir("certs")) -}*.* {- tree(builddir("certs")) -}
390 # Developer targets ##################################################
393 SH LOGICAL/PROC openssl,internal,ossl_installroot
394 IF "$(DESTDIR)" .EQS. "" THEN -
395 SH LOGICAL/PROC ossl_dataroot
397 # Building targets ###################################################
399 descrip.mms : {- sourcefile("Configurations", "descrip.mms.tmpl") -} $(SRCDIR)Configure ! $(SRCDIR)config.com
400 @ WRITE SYS$OUTPUT "descrip.mms is older than $?."
401 @ WRITE SYS$OUTPUT "Reconfiguring..."
402 perl $(SRCDIR)Configure reconf
403 @ WRITE SYS$OUTPUT "*************************************************"
404 @ WRITE SYS$OUTPUT "*** ***"
405 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
406 @ WRITE SYS$OUTPUT "*** ***"
407 @ WRITE SYS$OUTPUT "*************************************************"
412 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
415 my $dep = $args{obj};
416 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
418 # Because VMS C isn't very good at combining a /INCLUDE path with
419 # #includes having a relative directory (like '#include "../foo.h"),
420 # the best choice is to move to the first source file's intended
421 # directory before compiling, and make sure to write the object file
422 # in the correct position (important when the object tree is other
423 # than the source tree).
424 my $forward = dirname($args{srcs}->[0]);
425 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
426 my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
427 my $depn = basename($dep);
430 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
432 "/INCLUDE=(".join(",",
434 file_name_is_absolute($_)
435 ? $_ : catdir($backward,$_)
436 } @{$args{incs}}).")";
437 my $before = $unified_info{before}->{$dep.".OBJ"} || "\@ !";
438 my $after = $unified_info{after}->{$dep.".OBJ"} || "\@ !";
444 \$(CC) \$(CFLAGS)${incs} /MMS=(TARGET=.OBJ)/OBJECT=${depd}${depn}.MMS $srcs
445 SET DEFAULT $backward
452 my $obj = $args{obj};
453 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
455 # Because VMS C isn't very good at combining a /INCLUDE path with
456 # #includes having a relative directory (like '#include "../foo.h"),
457 # the best choice is to move to the first source file's intended
458 # directory before compiling, and make sure to write the object file
459 # in the correct position (important when the object tree is other
460 # than the source tree).
461 my $forward = dirname($args{srcs}->[0]);
462 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
463 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
464 my $objn = basename($obj);
467 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
469 "/INCLUDE=(".join(",",
471 file_name_is_absolute($_)
472 ? $_ : catdir($backward,$_)
473 } @{$args{incs}}).")";
474 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
475 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
481 \$(CC) \$(CFLAGS)${incs} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
482 SET DEFAULT $backward
489 my $lib = $args{lib};
490 my $shlib = $args{shlib};
491 my $libd = dirname($lib);
492 my $libn = basename($lib);
493 (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib//i;
495 $config{no_shared} ? $_.".OLB"
496 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
497 my $deps = join(", -\n\t\t", @deps);
498 my $shlib_target = $config{no_shared} ? "" : $target{shared_target};
499 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
500 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
501 "VMS", "engine.opt")),
502 rel2abs($config{builddir}));
503 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
504 "util", "mkdef.pl")),
505 rel2abs($config{builddir}));
506 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
507 "VMS", "translatesyms.pl")),
508 rel2abs($config{builddir}));
509 # The "[]" hack is because in .OPT files, each line inherits the
510 # previous line's file spec as default, so if no directory spec
511 # is present in the current line and the previous line has one that
512 # doesn't apply, you're in for a surprise.
514 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
515 $x =~ s|(\.EXE)|$1/SHARE|;
516 $x =~ s|(\.LIB)|$1/LIB|;
517 "WRITE OPT_FILE \"$x\"" } @deps)
520 $shlib.EXE : $lib.OLB $deps $ordinalsfile
521 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
522 \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
523 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
524 \$(PERL) $translatesyms_pl \$(BUILDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
525 OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
526 WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
527 IF "$mkdef_key" .NES. "ssl" .AND. "$mkdef_key" .NES. "crypto" THEN -
528 TYPE $engine_opt /OUTPUT=OPT_FILE:
529 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
530 TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
531 WRITE OPT_FILE "$lib.OLB/LIBRARY"
532 $write_opt ! Comment to protect from empty line
534 LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS)
535 - DELETE $shlib.SYMVEC;*
536 - PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
541 my $lib = $args{lib};
542 my $libd = dirname($lib);
543 my $libn = basename($lib);
544 (my $libn_nolib = $libn) =~ s/^lib//;
545 my @objs = map { "$_.OBJ" } @{$args{objs}};
547 $config{no_shared} ? $_.".OLB"
548 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
549 my $deps = join(", -\n\t\t", @objs, @deps);
550 my $shlib_target = $config{no_shared} ? "" : $target{shared_target};
551 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
552 "VMS", "engine.opt")),
553 rel2abs($config{builddir}));
554 # The "[]" hack is because in .OPT files, each line inherits the
555 # previous line's file spec as default, so if no directory spec
556 # is present in the current line and the previous line has one that
557 # doesn't apply, you're in for a surprise.
559 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
560 "WRITE OPT_FILE \"$x" } @objs).
562 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
563 $x =~ s|(\.EXE)|$1/SHARE|;
564 $x =~ s|(\.LIB)|$1/LIB|;
565 "WRITE OPT_FILE \"$x\"" } @deps)
569 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
570 TYPE $engine_opt /OUTPUT=OPT_FILE:
573 LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS)
574 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
579 my $lib = $args{lib};
580 my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
581 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
585 LIBRARY/CREATE/OBJECT $lib
592 my $bin = $args{bin};
593 my $bind = dirname($bin);
594 my $binn = basename($bin);
595 my @objs = map { "$_.OBJ" } @{$args{objs}};
597 $config{no_shared} ? $_.".OLB"
598 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
599 my $deps = join(", -\n\t\t", @objs, @deps);
600 # The "[]" hack is because in .OPT files, each line inherits the
601 # previous line's file spec as default, so if no directory spec
602 # is present in the current line and the previous line has one that
603 # doesn't apply, you're in for a surprise.
605 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
606 "WRITE OPT_FILE \"$x" } @objs).
608 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
609 $x =~ s|(\.EXE)|$1/SHARE|;
610 $x =~ s|(\.OLB)|$1/LIB|;
611 "WRITE OPT_FILE \"$x\"" } @deps)
615 OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
618 LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS)
619 - PURGE $bin.EXE,$bin.OPT
624 my $script = $args{script};
625 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
626 my $sources = join(" ", @{$args{sources}});
627 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
628 "util", "dofile.pl")),
629 rel2abs($config{builddir}));
632 \$(PERL) "-I\$(BUILDDIR)" "-Mconfigdata" $dofile -
633 "-o$target{build_file}" $sources > $script
634 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
638 "" # Important! This becomes part of the template result.