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, $(LIBS), $(ENGINES), $(PROGRAMS), $(SCRIPTS), $(TESTPROGS)
205 test tests : $(TESTPROGS), rehash
206 SET DEFAULT [.test]{- move("test") -}
207 DEFINE SRCTOP {- sourcedir() -}
208 DEFINE BLDTOP {- builddir() -}
209 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
212 SET DEFAULT [-]{- move("..") -}
215 @ TOP=$(SRCDIR) PERL=$(PERL) $(PERL) {- catfile($config{sourcedir},"test", "run_tests.pl") -} list
217 # Because VMS wants the generation number (or *) to delete files, we can't
218 # use $(LIBS), $(PROGRAMS) and $(TESTPROGS) directly.
220 - DELETE []OSSL$LIB*.OLB;*,OSSL$LIB*.LIS;*
221 - DELETE [.crypto...]*.OBJ;*,*.LIS;*
222 - DELETE [.ssl...]*.OBJ;*,*.LIS;*
223 - DELETE [.engines...]*.OBJ;*,*.LIS;*
224 - DELETE []CXX$DEMANGLER_DB.;*
226 install : install_sw install_docs
228 uninstall : uninstall_docs uninstall_sw
231 - DELETE []OSSL$LIB*.EXE;*,OSSL$LIB*.MAP;*,OSSL$LIB*.OPT;*
232 - DELETE [.engines...]LIB*.EXE;*,LIB*.MAP;*,LIB*.OPT;*
233 - DELETE [.apps]*.EXE;*,*.MAP;*,*.OPT;*
234 - DELETE [.apps]*.OBJ;*,*.LIS;*
235 - DELETE [.test]*.EXE;*,*.MAP;*,*.OPT;*
236 - DELETE [.test]*.OBJ;*,*.LIS;*
237 - DELETE [.test]*.LOG;*
240 DCLEAN_CMD=$(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }"
242 $(DCLEAN_CMD) < descrip.mms > descrip.mms.new
243 RENAME descrip.mms.new descrip.mms
246 {- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
247 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
248 keys %{$unified_info{sources}};
250 depend : {- join(",-\n\t", @deps); -}
251 $(DCLEAN_CMD) < descrip.mms > descrip.mms.new
252 OPEN/APPEND DESCRIP descrip.mms.new
253 WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
254 {- join("\n\t", map { "TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
256 RENAME descrip.mms.new descrip.mms
259 # Install helper targets #############################################
261 install_sw : all install_dev install_engines install_runtime install_config
262 @ WRITE SYS$OUTPUT ""
263 @ WRITE SYS$OUTPUT "######################################################################"
264 @ WRITE SYS$OUTPUT ""
265 @ WRITE SYS$OUTPUT "Installation complete"
266 @ WRITE SYS$OUTPUT ""
267 @ IF "$(DESTDIR)" .NES. "" THEN EXIT 1
268 @ WRITE SYS$OUTPUT "Run @$(INSTALLTOP)openssl_startup to set up logical names"
269 @ WRITE SYS$OUTPUT "then run @$(INSTALLTOP)openssl_setup to define commands"
270 @ WRITE SYS$OUTPUT ""
272 uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime uninstall_config
274 install_docs : install_man_docs install_html_docs
276 uninstall_docs : uninstall_man_docs uninstall_html_docs
278 install_dev : check_INSTALLTOP
279 @ WRITE SYS$OUTPUT "*** Installing development files"
280 @ ! Install header files
281 CREATE/DIR ossl_installroot:[include.openssl]
282 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
283 @ ! Install libraries
284 CREATE/DIR ossl_installroot:['arch'.LIB]
286 map { "COPY/PROT=W:R $_.OLB ossl_installroot:['arch'.LIB]" }
287 @{$unified_info{libraries}}) -}
288 @ {- output_off() if $config{no_shared}; "" -} !
290 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:['arch'.LIB]" }
291 map { $unified_info{sharednames}->{$_} || () }
292 @{$unified_info{libraries}}) -}
293 @ {- output_on() if $config{no_shared}; "" -} !
295 install_runtime : check_INSTALLTOP
296 @ WRITE SYS$OUTPUT "*** Installing runtime files"
297 @ ! Install the main program
298 CREATE/DIR ossl_installroot:['arch'.EXE]
299 COPY/PROT=W:RE [.APPS]openssl.EXE ossl_installroot:['arch'.EXE]
301 CREATE/DIR ossl_installroot:[EXE]
302 COPY/PROT=W:RE [.APPS]CA.pl ossl_installroot:[EXE]
303 COPY/PROT=W:RE [.TOOLS]c_rehash. ossl_installroot:[EXE]c_rehash.pl
304 @ ! Install configuration file
305 COPY/PROT=W:RE {- sourcefile("apps", "openssl-vms.cnf") -} -
306 ossl_installroot:[000000]openssl.cnf
308 install_engines : check_INSTALLTOP
309 @ {- output_off() if $config{no_shared}; "" -} !
310 @ WRITE SYS$OUTPUT "*** Installing engines"
311 CREATE/DIR ossl_installroot:['arch'.ENGINES]
312 COPY/PROT=W:RE [.ENGINES]*.EXE ossl_installroot:['arch'.ENGINES]
313 @ {- output_on() if $config{no_shared}; "" -} !
315 install_config : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
317 IF "$(DESTDIR)" .EQS. "" THEN -
318 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
319 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
320 IF "$(DESTDIR)" .EQS. "" THEN -
321 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
322 CREATE/DIR/PROT=(S:RWED,O:RWE,G:,W:) OSSL_DATAROOT:[PRIVATE]
323 CREATE/DIR ossl_installroot:[SYS$STARTUP]
325 [.VMS]openssl_startup.com,openssl_shutdown.com -
326 ossl_installroot:[SYS$STARTUP]
328 {- sourcefile("VMS", "openssl_utils.com") -} -
329 ossl_installroot:[SYS$STARTUP]
331 [.VMS]openssl_startup.com : vmsconfig.pm
333 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
334 {- sourcefile("VMS", "openssl_startup.com.in") -} -
335 > [.VMS]openssl_startup.com
337 [.VMS]openssl_shutdown.com : vmsconfig.pm
339 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
340 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
341 > [.VMS]openssl_shutdown.com
343 vmsconfig.pm : descrip.mms
344 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
345 WRITE CONFIG "package vmsconfig;"
346 WRITE CONFIG "use strict; use warnings;"
347 WRITE CONFIG "use Exporter;"
348 WRITE CONFIG "our @ISA = qw(Exporter);"
349 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info);"
350 WRITE CONFIG "our %config = ("
351 WRITE CONFIG " target => '{- $config{target} -}',"
352 WRITE CONFIG " version => '$(MAJOR).$(MINOR)',"
353 WRITE CONFIG " no_shared => '","{- $config{no_shared} -}","',"
354 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
355 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
356 WRITE CONFIG " pointersize => '","{- $target{pointersize} -}","',"
357 WRITE CONFIG " shared_libs => ["
358 {- join("\n ", map { "WRITE CONFIG \" '$_'," } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "\@ !" -}
361 WRITE CONFIG "our %target = ();"
362 WRITE CONFIG "our %withargs = ();"
363 WRITE CONFIG "our %unified_info = ();"
368 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
369 WRITE SYS$ERROR "INSTALLTOP should not be empty"
370 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
373 # Helper targets #####################################################
375 rehash : [.apps]openssl.exe, copy-certs
376 !MCR [.apps]openssl.exe rehash {- builddir("certs", "demo") -}
377 $(PERL) [.tools]c_rehash. [.certs.demo]
380 @ IF F$SEARCH("{- buildfile("certs.dir") -}") .EQS. "" THEN -
381 CREATE/DIR {- builddir("certs") -}
382 -@ IF "{- sourcedir("certs") -}" .NES. "{- builddir("certs") -}" THEN -
383 COPY {- tree(sourcedir("certs")) -}*.* {- tree(builddir("certs")) -}
385 # Developer targets ##################################################
388 SH LOGICAL/PROC openssl,internal,ossl_installroot
389 IF "$(DESTDIR)" .EQS. "" THEN -
390 SH LOGICAL/PROC ossl_dataroot
392 # Building targets ###################################################
394 descrip.mms : {- sourcefile("Configurations", "descrip.mms.tmpl") -} $(SRCDIR)Configure ! $(SRCDIR)config.com
395 @ WRITE SYS$OUTPUT "descrip.mms is older than $?."
396 @ WRITE SYS$OUTPUT "Reconfiguring..."
397 perl $(SRCDIR)Configure reconf
398 @ WRITE SYS$OUTPUT "*************************************************"
399 @ WRITE SYS$OUTPUT "*** ***"
400 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
401 @ WRITE SYS$OUTPUT "*** ***"
402 @ WRITE SYS$OUTPUT "*************************************************"
407 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
410 my $dep = $args{obj};
411 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
413 # Because VMS C isn't very good at combining a /INCLUDE path with
414 # #includes having a relative directory (like '#include "../foo.h"),
415 # the best choice is to move to the first source file's intended
416 # directory before compiling, and make sure to write the object file
417 # in the correct position (important when the object tree is other
418 # than the source tree).
419 my $forward = dirname($args{srcs}->[0]);
420 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
421 my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
422 my $depn = basename($dep);
425 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
427 "/INCLUDE=(".join(",",
429 file_name_is_absolute($_)
430 ? $_ : catdir($backward,$_)
431 } @{$args{incs}}).")";
432 my $before = $unified_info{before}->{$dep.".OBJ"} || "\@ !";
433 my $after = $unified_info{after}->{$dep.".OBJ"} || "\@ !";
439 \$(CC) \$(CFLAGS)${incs} /MMS=(TARGET=.OBJ)/OBJECT=${depd}${depn}.MMS $srcs
440 SET DEFAULT $backward
447 my $obj = $args{obj};
448 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
450 # Because VMS C isn't very good at combining a /INCLUDE path with
451 # #includes having a relative directory (like '#include "../foo.h"),
452 # the best choice is to move to the first source file's intended
453 # directory before compiling, and make sure to write the object file
454 # in the correct position (important when the object tree is other
455 # than the source tree).
456 my $forward = dirname($args{srcs}->[0]);
457 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
458 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
459 my $objn = basename($obj);
462 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
464 "/INCLUDE=(".join(",",
466 file_name_is_absolute($_)
467 ? $_ : catdir($backward,$_)
468 } @{$args{incs}}).")";
469 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
470 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
476 \$(CC) \$(CFLAGS)${incs} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
477 SET DEFAULT $backward
484 my $lib = $args{lib};
485 my $shlib = $args{shlib};
486 my $libd = dirname($lib);
487 my $libn = basename($lib);
488 (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib//i;
490 $config{no_shared} ? $_.".OLB"
491 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
492 my $deps = join(", -\n\t\t", @deps);
493 my $shlib_target = $config{no_shared} ? "" : $target{shared_target};
494 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
495 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
496 "VMS", "engine.opt")),
497 rel2abs($config{builddir}));
498 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
499 "util", "mkdef.pl")),
500 rel2abs($config{builddir}));
501 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
502 "VMS", "translatesyms.pl")),
503 rel2abs($config{builddir}));
504 # The "[]" hack is because in .OPT files, each line inherits the
505 # previous line's file spec as default, so if no directory spec
506 # is present in the current line and the previous line has one that
507 # doesn't apply, you're in for a surprise.
509 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
510 $x =~ s|(\.EXE)|$1/SHARE|;
511 $x =~ s|(\.LIB)|$1/LIB|;
512 "WRITE OPT_FILE \"$x\"" } @deps)
515 $shlib.EXE : $lib.OLB $deps $ordinalsfile
516 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
517 \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
518 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
519 \$(PERL) $translatesyms_pl \$(BUILDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
520 OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
521 WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
522 IF "$mkdef_key" .NES. "ssl" .AND. "$mkdef_key" .NES. "crypto" THEN -
523 TYPE $engine_opt /OUTPUT=OPT_FILE:
524 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
525 TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
526 WRITE OPT_FILE "$lib.OLB/LIBRARY"
527 $write_opt ! Comment to protect from empty line
529 LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS)
530 - DELETE $shlib.SYMVEC;*
531 - PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
536 my $lib = $args{lib};
537 my $libd = dirname($lib);
538 my $libn = basename($lib);
539 (my $libn_nolib = $libn) =~ s/^lib//;
540 my @objs = map { "$_.OBJ" } @{$args{objs}};
542 $config{no_shared} ? $_.".OLB"
543 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
544 my $deps = join(", -\n\t\t", @objs, @deps);
545 my $shlib_target = $config{no_shared} ? "" : $target{shared_target};
546 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
547 "VMS", "engine.opt")),
548 rel2abs($config{builddir}));
549 # The "[]" hack is because in .OPT files, each line inherits the
550 # previous line's file spec as default, so if no directory spec
551 # is present in the current line and the previous line has one that
552 # doesn't apply, you're in for a surprise.
554 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
555 "WRITE OPT_FILE \"$x" } @objs).
557 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
558 $x =~ s|(\.EXE)|$1/SHARE|;
559 $x =~ s|(\.LIB)|$1/LIB|;
560 "WRITE OPT_FILE \"$x\"" } @deps)
564 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
565 TYPE $engine_opt /OUTPUT=OPT_FILE:
568 LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS)
569 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
574 my $lib = $args{lib};
575 my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
576 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
580 LIBRARY/CREATE/OBJECT $lib
587 my $bin = $args{bin};
588 my $bind = dirname($bin);
589 my $binn = basename($bin);
590 my @objs = map { "$_.OBJ" } @{$args{objs}};
592 $config{no_shared} ? $_.".OLB"
593 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
594 my $deps = join(", -\n\t\t", @objs, @deps);
595 # The "[]" hack is because in .OPT files, each line inherits the
596 # previous line's file spec as default, so if no directory spec
597 # is present in the current line and the previous line has one that
598 # doesn't apply, you're in for a surprise.
600 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
601 "WRITE OPT_FILE \"$x" } @objs).
603 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
604 $x =~ s|(\.EXE)|$1/SHARE|;
605 $x =~ s|(\.OLB)|$1/LIB|;
606 "WRITE OPT_FILE \"$x\"" } @deps)
610 OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
613 LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS)
614 - PURGE $bin.EXE,$bin.OPT
619 my $script = $args{script};
620 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
621 my $sources = join(" ", @{$args{sources}});
622 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
623 "util", "dofile.pl")),
624 rel2abs($config{builddir}));
627 \$(PERL) "-I\$(BUILDDIR)" "-Mconfigdata" $dofile $sources > $script
628 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
632 "" # Important! This becomes part of the template result.