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}->{"[.test]heartbeat_test.OBJ"}
54 = $unified_info{before}->{"[.test]ssltest_old.OBJ"}
55 = qq(record = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
56 define record 'record'
57 statem = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
58 define statem 'statem');
59 $unified_info{after}->{"[.test]heartbeat_test.OBJ"}
60 = $unified_info{after}->{"[.test]ssltest.OBJ"}
63 foreach (grep /^\[\.ssl\.(?:record|statem)\].*\.o$/, keys %{$unified_info{sources}}) {
64 (my $x = $_) =~ s|\.o$|.OBJ|;
65 $unified_info{before}->{$x}
66 = qq(record = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
67 define record 'record'
68 statem = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
69 define statem 'statem');
70 $unified_info{after}->{$x}
75 #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
76 #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
79 PLATFORM={- $config{target} -}
80 OPTIONS={- $config{options} -}
81 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
82 SRCDIR={- $config{sourcedir} -}
83 BUILDDIR={- $config{builddir} -}
85 VERSION={- $config{version} -}
86 MAJOR={- $config{major} -}
87 MINOR={- $config{minor} -}
88 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
89 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
90 SHLIB_MAJOR={- $config{shlib_major} -}
91 SHLIB_MINOR={- $config{shlib_minor} -}
92 SHLIB_TARGET={- $target{shared_target} -}
100 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{libraries}}) -}
101 SHLIBS={- join(" ", map { $_."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -}
102 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
103 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } grep { !m|^\[\.test\]| } @{$unified_info{programs}}) -}
104 TESTPROGS={- join(", ", map { "-\n\t".$_.".EXE" } grep { m|^\[\.test\]| } @{$unified_info{programs}}) -}
105 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
106 {- output_off() if $disabled{makedepend}; "" -}
107 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
108 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
109 keys %{$unified_info{sources}};
110 join(", ", map { "-\n\t".$_ } @deps); -}
111 {- output_on() if $disabled{makedepend}; "" -}
113 # DESTDIR is for package builders so that they can configure for, say,
114 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
115 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
116 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
117 # STAGING:[USER.OPENSSL].
118 # Normally it is left empty.
121 # Do not edit this manually. Use Configure --prefix=DIR to change this!
122 INSTALLTOP={- (my $x = $config{version}) =~ s|\.|_|g;
124 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL-$x]";
126 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
127 # This is the standard central area to store certificates, private keys...
128 OPENSSLDIR={- catdir($config{openssldir}) ||
129 $config{prefix} ? catdir($config{prefix},"COMMON")
130 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
131 # Where installed engines reside
132 ENGINESDIR={- $osslprefix -}ENGINES:
134 CC= {- $target{cc} -}
135 CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -}
137 DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -})
138 LDFLAGS= {- $target{lflags} -}
139 EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
141 PERL={- $config{perl} -}
143 # We let the C compiler driver to take care of .s files. This is done in
144 # order to be excused from maintaining a separate set of architecture
145 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
146 # gcc, then the driver will automatically translate it to -xarch=v8plus
147 # and pass it down to assembler.
149 ASFLAG={- $target{asflags} -}
151 # .FIRST and .LAST are special targets with MMS and MMK.
152 # The defines in there are for C. includes that look like
155 # #include <openssl/foo.h>
156 # #include "internal/bar.h"
158 # will use the logical names to find the files. Expecting
159 # DECompHP C to find files in subdirectories of whatever was
160 # given with /INCLUDE is a fantasy, unfortunately.
163 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
164 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
165 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
166 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
167 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
168 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
169 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
170 $(NODEBUG) staging_dir = "$(DESTDIR)"
171 $(NODEBUG) staging_instdir = ""
172 $(NODEBUG) staging_datadir = ""
173 $(NODEBUG) IF staging_dir .NES. "" THEN -
174 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
175 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
176 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
177 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
178 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
179 $(NODEBUG) IF staging_dir .NES. "" THEN -
180 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
181 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
182 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
183 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
184 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
186 $(NODEBUG) ! Installation logical names
188 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
189 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
190 $(NODEBUG) DEFINE ossl_installroot 'installtop'
191 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
193 $(NODEBUG) ! Figure out the architecture
195 $(NODEBUG) arch == f$edit( f$getsyi( "arch_name"), "upcase")
197 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
198 $(NODEBUG) ! running programs can use them.
200 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
203 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
204 $(NODEBUG) DEASSIGN ossl_dataroot
205 $(NODEBUG) DEASSIGN ossl_installroot
206 $(NODEBUG) DEASSIGN internal
207 $(NODEBUG) DEASSIGN openssl
209 @ ! MMS cannot handle no actions...
211 # The main targets ###################################################
213 all : configdata.pm, -
214 build_libs_nodep, build_engines_nodep, build_apps_nodep, -
217 build_libs : configdata.pm, build_libs_nodep, depend
218 build_libs_nodep : $(LIBS)
219 build_engines : configdata.pm, build_engines_nodep, depend
220 build_engines_nodep : $(ENGINES)
221 build_apps : configdata.pm, build_apps_nodep, depend
222 build_apps_nodep : $(PROGRAMS), $(SCRIPTS)
223 build_tests : configdata.pm, build_tests_nodep, depend
224 build_tests_nodep : $(TESTPROGS)
226 test tests : configdata.pm, -
227 build_apps_nodep, build_engines_nodep, build_tests_nodep, -
229 @ ! {- output_off() if $disabled{tests}; "" -}
230 SET DEFAULT [.test]{- move("test") -}
231 DEFINE SRCTOP {- sourcedir() -}
232 DEFINE BLDTOP {- builddir() -}
233 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
234 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
235 DEASSIGN OPENSSL_ENGINES
238 SET DEFAULT [-]{- move("..") -}
239 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
240 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
241 @ ! {- output_on() if !$disabled{tests}; "" -}
244 @ TOP=$(SRCDIR) PERL=$(PERL) $(PERL) {- catfile($config{sourcedir},"test", "run_tests.pl") -} list
246 # Because VMS wants the generation number (or *) to delete files, we can't
247 # use $(LIBS), $(PROGRAMS) and $(TESTPROGS) directly.
249 - DELETE []OSSL$LIB*.OLB;*,OSSL$LIB*.LIS;*
250 - DELETE [.crypto...]*.OBJ;*,*.LIS;*
251 - DELETE [.ssl...]*.OBJ;*,*.LIS;*
252 - DELETE [.engines...]*.OBJ;*,*.LIS;*
253 - DELETE []CXX$DEMANGLER_DB.;*
255 install : install_sw install_docs
256 @ WRITE SYS$OUTPUT ""
257 @ WRITE SYS$OUTPUT "######################################################################"
258 @ WRITE SYS$OUTPUT ""
259 @ IF "$(DESTDIR)" .EQS. "" THEN -
260 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
261 WRITE SYS$OUTPUT "" ; -
262 WRITE SYS$OUTPUT "Run @$(INSTALLTOP)openssl_startup to set up logical names" ; -
263 WRITE SYS$OUTPUT "then run @$(INSTALLTOP)openssl_setup to define commands" ; -
264 WRITE SYS$OUTPUT "" )
265 @ IF "$(DESTDIR)" .NES. "" THEN -
266 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
267 WRITE SYS$OUTPUT "" ; -
268 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
269 WRITE SYS$OUTPUT staging_instdir ; -
270 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
271 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
272 WRITE SYS$OUTPUT staging_datadir ; -
273 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
274 WRITE SYS$OUTPUT "" ; -
275 WRITE SYS$OUTPUT "When in its final destination," ; -
276 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup to set up logical names" ; -
277 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils to define commands" ; -
278 WRITE SYS$OUTPUT "" )
280 uninstall : uninstall_docs uninstall_sw
283 - DELETE []OSSL$LIB*.EXE;*,OSSL$LIB*.MAP;*,OSSL$LIB*.OPT;*
284 - DELETE [.engines...]LIB*.EXE;*,LIB*.MAP;*,LIB*.OPT;*
285 - DELETE [.apps]*.EXE;*,*.MAP;*,*.OPT;*
286 - DELETE [.apps]*.OBJ;*,*.LIS;*
287 - DELETE [.test]*.EXE;*,*.MAP;*,*.OPT;*
288 - DELETE [.test]*.OBJ;*,*.LIS;*
289 - DELETE [.test]*.LOG;*
294 @ ! {- output_off() if $disabled{makedepend}; "" -}
295 @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
296 < descrip.mms > descrip.mms-new
297 @ OPEN/APPEND DESCRIP descrip.mms-new
298 @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
299 {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
301 @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
302 RENAME descrip.mms-new descrip.mms )
303 @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
304 -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
305 @ ! {- output_on() if $disabled{makedepend}; "" -}
307 # Install helper targets #############################################
309 install_sw : all install_dev install_engines install_runtime install_config
311 uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime uninstall_config
313 install_docs : install_man_docs install_html_docs
315 uninstall_docs : uninstall_man_docs uninstall_html_docs
317 install_dev : check_INSTALLTOP
318 @ WRITE SYS$OUTPUT "*** Installing development files"
319 @ ! Install header files
320 - CREATE/DIR ossl_installroot:[include.openssl]
321 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
322 @ ! Install libraries
323 - CREATE/DIR ossl_installroot:[LIB.'arch']
325 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
326 @{$unified_info{libraries}}) -}
327 @ {- output_off() if $disabled{shared}; "" -} !
329 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[LIB.'arch']" }
330 map { $unified_info{sharednames}->{$_} || () }
331 @{$unified_info{libraries}}) -}
332 @ {- output_on() if $disabled{shared}; "" -} !
334 install_runtime : check_INSTALLTOP
335 @ ! {- output_off() if $disabled{apps}; "" -}
336 @ WRITE SYS$OUTPUT "*** Installing runtime files"
337 @ ! Install the main program
338 - CREATE/DIR ossl_installroot:[EXE.'arch']
339 COPY/PROT=W:RE [.APPS]openssl.EXE ossl_installroot:[EXE.'arch']
341 - CREATE/DIR ossl_installroot:[EXE]
342 COPY/PROT=W:RE [.APPS]CA.pl ossl_installroot:[EXE]
343 COPY/PROT=W:RE [.TOOLS]c_rehash. ossl_installroot:[EXE]c_rehash.pl
344 @ ! {- output_on() if $disabled{apps}; "" -}
345 @ ! Install configuration file
346 - CREATE/DIR ossl_dataroot:[000000]
347 COPY/PROT=W:RE {- sourcefile("apps", "openssl-vms.cnf") -} -
348 ossl_dataroot:[000000]openssl.cnf
350 install_engines : check_INSTALLTOP
351 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
352 @ WRITE SYS$OUTPUT "*** Installing engines"
353 - CREATE/DIR ossl_installroot:[ENGINES.'arch']
355 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES.'arch']" }
356 grep(!m|ossltest$|i, @{$unified_info{engines}})) -}
357 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
359 install_config : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
361 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
362 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
363 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
364 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
365 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
367 [.VMS]openssl_startup.com,openssl_shutdown.com -
368 ossl_installroot:[SYS$STARTUP]
370 {- sourcefile("VMS", "openssl_utils.com") -} -
371 ossl_installroot:[SYS$STARTUP]
373 [.VMS]openssl_startup.com : vmsconfig.pm
375 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
376 {- sourcefile("VMS", "openssl_startup.com.in") -} -
377 > [.VMS]openssl_startup.com
379 [.VMS]openssl_shutdown.com : vmsconfig.pm
381 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
382 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
383 > [.VMS]openssl_shutdown.com
385 vmsconfig.pm : configdata.pm
386 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
387 WRITE CONFIG "package vmsconfig;"
388 WRITE CONFIG "use strict; use warnings;"
389 WRITE CONFIG "use Exporter;"
390 WRITE CONFIG "our @ISA = qw(Exporter);"
391 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
392 WRITE CONFIG "our %config = ("
393 WRITE CONFIG " target => '{- $config{target} -}',"
394 WRITE CONFIG " version => '$(MAJOR).$(MINOR)',"
395 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
396 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
397 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
398 WRITE CONFIG " pointersize => '","{- $target{pointersize} -}","',"
399 WRITE CONFIG " shared_libs => ["
400 {- join("\n ", map { "WRITE CONFIG \" '$_'," } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "\@ !" -}
403 WRITE CONFIG "our %target = ();"
404 WRITE CONFIG "our %disabled = ();"
405 WRITE CONFIG "our %withargs = ();"
406 WRITE CONFIG "our %unified_info = ();"
411 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
412 WRITE SYS$ERROR "INSTALLTOP should not be empty"
413 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
416 # Helper targets #####################################################
418 # Developer targets ##################################################
421 SH LOGICAL/PROC openssl,internal,ossl_installroot
422 IF "$(DESTDIR)" .EQS. "" THEN -
423 SH LOGICAL/PROC ossl_dataroot
425 # Building targets ###################################################
427 configdata.pm : {- join(" ", sourcefile("Configurations", "descrip.mms.tmpl"), sourcefile("Configurations", "common.tmpl")) -} $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_infos}}) -}
428 @ WRITE SYS$OUTPUT "Reconfiguring..."
429 perl $(SRCDIR)Configure reconf
430 @ WRITE SYS$OUTPUT "*************************************************"
431 @ WRITE SYS$OUTPUT "*** ***"
432 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
433 @ WRITE SYS$OUTPUT "*** ***"
434 @ WRITE SYS$OUTPUT "*************************************************"
435 @ PIPE ( EXIT %X10000000 )
439 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
443 my $generator = join(" ", @{$args{generator}});
444 my $deps = join(", -\n\t\t", @{$args{deps}});
446 if ($args{src} !~ /\.[sS]$/) {
448 $args{src} : $args{generator}->[0] $deps
449 \$(PERL) $generator > \$@
452 die "No method to generate assembler source present.\n";
458 my $obj = $args{obj};
459 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
461 # Because VMS C isn't very good at combining a /INCLUDE path with
462 # #includes having a relative directory (like '#include "../foo.h"),
463 # the best choice is to move to the first source file's intended
464 # directory before compiling, and make sure to write the object file
465 # in the correct position (important when the object tree is other
466 # than the source tree).
467 my $forward = dirname($args{srcs}->[0]);
468 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
469 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
470 my $objn = basename($obj);
473 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
474 my $incs_on = "\@ !";
475 my $incs_off = "\@ !";
478 push @incs, @{$args{incs}} if @{$args{incs}};
479 unless ($disabled{zlib}) {
480 # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
482 push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
486 "DEFINE tmp_includes "
487 .join(",-\n\t\t\t", map {
488 file_name_is_absolute($_)
489 ? $_ : catdir($backward,$_)
491 $incs_off = "DEASSIGN tmp_includes";
492 $incs = " /INCLUDE=(tmp_includes:)";
494 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
495 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
496 my $depbuild = $disabled{makedepend} ? ""
497 : " /MMS=(FILE=${objd}${objn}.tmp-MMS,TARGET=$obj.OBJ)";
504 \$(CC) \$(CFLAGS)${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
506 SET DEFAULT $backward
508 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.MMS"",""$obj.tmp-MMS""); exit(0x10000000 + (\$x == 0));" || -
509 RENAME $obj.tmp-MMS $obj.mms )
510 \@ IF F\$SEARCH("$obj.tmp-MMS") .NES. "" THEN DELETE $obj.tmp-MMS;*
516 my $lib = $args{lib};
517 my $shlib = $args{shlib};
518 my $libd = dirname($lib);
519 my $libn = basename($lib);
520 (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib//i;
522 $disabled{shared} ? $_.".OLB"
523 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
524 my $deps = join(", -\n\t\t", @deps);
525 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
526 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
527 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
528 "VMS", "engine.opt")),
529 rel2abs($config{builddir}));
530 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
531 "util", "mkdef.pl")),
532 rel2abs($config{builddir}));
533 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
534 "VMS", "translatesyms.pl")),
535 rel2abs($config{builddir}));
536 # The "[]" hack is because in .OPT files, each line inherits the
537 # previous line's file spec as default, so if no directory spec
538 # is present in the current line and the previous line has one that
539 # doesn't apply, you're in for a surprise.
541 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
542 $x =~ s|(\.EXE)|$1/SHARE|;
543 $x =~ s|(\.OLB)|$1/LIB|;
544 "WRITE OPT_FILE \"$x\"" } @deps)
547 $shlib.EXE : $lib.OLB $deps $ordinalsfile
548 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
549 \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
550 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
551 \$(PERL) $translatesyms_pl \$(BUILDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
552 OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
553 WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
554 IF "$mkdef_key" .NES. "ssl" .AND. "$mkdef_key" .NES. "crypto" THEN -
555 TYPE $engine_opt /OUTPUT=OPT_FILE:
556 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
557 TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
558 WRITE OPT_FILE "$lib.OLB/LIBRARY"
559 $write_opt ! Comment to protect from empty line
561 LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS)
562 - DELETE $shlib.SYMVEC;*
563 - PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
568 my $lib = $args{lib};
569 my $libd = dirname($lib);
570 my $libn = basename($lib);
571 (my $libn_nolib = $libn) =~ s/^lib//;
572 my @objs = map { "$_.OBJ" } @{$args{objs}};
574 $disabled{shared} ? $_.".OLB"
575 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
576 my $deps = join(", -\n\t\t", @objs, @deps);
577 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
578 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
579 "VMS", "engine.opt")),
580 rel2abs($config{builddir}));
581 # The "[]" hack is because in .OPT files, each line inherits the
582 # previous line's file spec as default, so if no directory spec
583 # is present in the current line and the previous line has one that
584 # doesn't apply, you're in for a surprise.
586 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
587 "WRITE OPT_FILE \"$x" } @objs).
589 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
590 $x =~ s|(\.EXE)|$1/SHARE|;
591 $x =~ s|(\.OLB)|$1/LIB|;
592 "WRITE OPT_FILE \"$x\"" } @deps)
596 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
597 TYPE $engine_opt /OUTPUT=OPT_FILE:
600 LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS)
601 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
606 my $lib = $args{lib};
607 my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
608 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
612 LIBRARY/CREATE/OBJECT $lib
619 my $bin = $args{bin};
620 my $bind = dirname($bin);
621 my $binn = basename($bin);
622 my @objs = map { "$_.OBJ" } @{$args{objs}};
624 $disabled{shared} ? $_.".OLB"
625 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
626 my $deps = join(", -\n\t\t", @objs, @deps);
627 # The "[]" hack is because in .OPT files, each line inherits the
628 # previous line's file spec as default, so if no directory spec
629 # is present in the current line and the previous line has one that
630 # doesn't apply, you're in for a surprise.
632 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
633 "WRITE OPT_FILE \"$x" } @objs).
635 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
636 $x =~ s|(\.EXE)|$1/SHARE|;
637 $x =~ s|(\.OLB)|$1/LIB|;
638 "WRITE OPT_FILE \"$x\"" } @deps)
642 OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
645 LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS)
646 - PURGE $bin.EXE,$bin.OPT
651 my $script = $args{script};
652 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
653 my $sources = join(" ", @{$args{sources}});
654 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
655 "util", "dofile.pl")),
656 rel2abs($config{builddir}));
659 \$(PERL) "-I\$(BUILDDIR)" "-Mconfigdata" $dofile -
660 "-o$target{build_file}" $sources > $script
661 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
665 "" # Important! This becomes part of the template result.