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 # Allow both V and VERBOSE to indicate verbosity. This only applies
89 VERSION={- $config{version} -}
90 MAJOR={- $config{major} -}
91 MINOR={- $config{minor} -}
92 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
93 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
94 SHLIB_MAJOR={- $config{shlib_major} -}
95 SHLIB_MINOR={- $config{shlib_minor} -}
96 SHLIB_TARGET={- $target{shared_target} -}
104 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{libraries}}) -}
105 SHLIBS={- join(" ", map { $_."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -}
106 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
107 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } grep { !m|^\[\.test\]| } @{$unified_info{programs}}) -}
108 TESTPROGS={- join(", ", map { "-\n\t".$_.".EXE" } grep { m|^\[\.test\]| } @{$unified_info{programs}}) -}
109 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
110 {- output_off() if $disabled{makedepend}; "" -}
111 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
112 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
113 keys %{$unified_info{sources}};
114 join(", ", map { "-\n\t".$_ } @deps); -}
115 {- output_on() if $disabled{makedepend}; "" -}
116 GENERATED_MANDATORY={- join(",", @{$unified_info{depends}->{""}} ) -}
118 {- output_off() if $disabled{apps}; "" -}
119 BIN_SCRIPTS=[.tools]c_rehash.pl
120 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
121 {- output_on() if $disabled{apps}; "" -}
123 # DESTDIR is for package builders so that they can configure for, say,
124 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
125 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
126 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
127 # STAGING:[USER.OPENSSL].
128 # Normally it is left empty.
131 # Do not edit this manually. Use Configure --prefix=DIR to change this!
132 INSTALLTOP={- (my $x = $config{version}) =~ s|\.|_|g;
134 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL-$x]";
136 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
137 # This is the standard central area to store certificates, private keys...
138 OPENSSLDIR={- catdir($config{openssldir}) ||
139 $config{prefix} ? catdir($config{prefix},"COMMON")
140 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
141 # Where installed engines reside
142 ENGINESDIR={- $osslprefix -}ENGINES:
144 CC= {- $target{cc} -}
145 CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -}
147 DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -})
148 LDFLAGS= {- $target{lflags} -}
149 EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
150 LIB_CFLAGS={- $target{lib_cflags} || "" -}
151 DSO_CFLAGS={- $target{dso_cflags} || "" -}
152 BIN_CFLAGS={- $target{bin_cflags} || "" -}
154 PERL={- $config{perl} -}
156 # We let the C compiler driver to take care of .s files. This is done in
157 # order to be excused from maintaining a separate set of architecture
158 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
159 # gcc, then the driver will automatically translate it to -xarch=v8plus
160 # and pass it down to assembler.
162 ASFLAG={- $target{asflags} -}
164 # .FIRST and .LAST are special targets with MMS and MMK.
165 # The defines in there are for C. includes that look like
168 # #include <openssl/foo.h>
169 # #include "internal/bar.h"
171 # will use the logical names to find the files. Expecting
172 # DECompHP C to find files in subdirectories of whatever was
173 # given with /INCLUDE is a fantasy, unfortunately.
176 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
177 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
178 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
179 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
180 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
181 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
182 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
183 $(NODEBUG) staging_dir = "$(DESTDIR)"
184 $(NODEBUG) staging_instdir = ""
185 $(NODEBUG) staging_datadir = ""
186 $(NODEBUG) IF staging_dir .NES. "" THEN -
187 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
188 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
189 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
190 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
191 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
192 $(NODEBUG) IF staging_dir .NES. "" THEN -
193 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
194 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
195 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
196 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
197 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
199 $(NODEBUG) ! Installation logical names
201 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
202 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
203 $(NODEBUG) DEFINE ossl_installroot 'installtop'
204 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
206 $(NODEBUG) ! Figure out the architecture
208 $(NODEBUG) arch == f$edit( f$getsyi( "arch_name"), "upcase")
210 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
211 $(NODEBUG) ! running programs can use them.
213 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
216 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
217 $(NODEBUG) DEASSIGN ossl_dataroot
218 $(NODEBUG) DEASSIGN ossl_installroot
219 $(NODEBUG) DEASSIGN internal
220 $(NODEBUG) DEASSIGN openssl
222 @ ! MMS cannot handle no actions...
224 # The main targets ###################################################
226 all : build_generated, -
227 build_libs_nodep, build_engines_nodep, build_apps_nodep, -
230 build_libs : build_generated, build_libs_nodep, depend
231 build_libs_nodep : $(LIBS)
232 build_engines : build_generated, build_engines_nodep, depend
233 build_engines_nodep : $(ENGINES)
234 build_apps : build_generated, build_apps_nodep, depend
235 build_apps_nodep : $(PROGRAMS), $(SCRIPTS)
236 build_tests : build_generated, build_tests_nodep, depend
237 build_tests_nodep : $(TESTPROGS)
239 build_generated : $(GENERATED_MANDATORY)
241 test tests : build_generated, -
242 build_apps_nodep, build_engines_nodep, build_tests_nodep, -
244 @ ! {- output_off() if $disabled{tests}; "" -}
245 SET DEFAULT [.test]{- move("test") -}
246 DEFINE SRCTOP {- sourcedir() -}
247 DEFINE BLDTOP {- builddir() -}
248 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
249 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
250 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
251 DEASSIGN OPENSSL_ENGINES
254 SET DEFAULT [-]{- move("..") -}
255 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
256 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
257 @ ! {- output_on() if !$disabled{tests}; "" -}
260 @ TOP=$(SRCDIR) PERL=$(PERL) $(PERL) {- catfile($config{sourcedir},"test", "run_tests.pl") -} list
262 # Because VMS wants the generation number (or *) to delete files, we can't
263 # use $(LIBS), $(PROGRAMS) and $(TESTPROGS) directly.
265 - DELETE []OSSL$LIB*.OLB;*,OSSL$LIB*.LIS;*
266 - DELETE [.crypto...]*.OBJ;*,*.LIS;*
267 - DELETE [.ssl...]*.OBJ;*,*.LIS;*
268 - DELETE [.engines...]*.OBJ;*,*.LIS;*
269 - DELETE []CXX$DEMANGLER_DB.;*
271 install : install_sw install_docs
272 @ WRITE SYS$OUTPUT ""
273 @ WRITE SYS$OUTPUT "######################################################################"
274 @ WRITE SYS$OUTPUT ""
275 @ IF "$(DESTDIR)" .EQS. "" THEN -
276 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
277 WRITE SYS$OUTPUT "" ; -
278 WRITE SYS$OUTPUT "Run @$(INSTALLTOP)openssl_startup to set up logical names" ; -
279 WRITE SYS$OUTPUT "then run @$(INSTALLTOP)openssl_setup to define commands" ; -
280 WRITE SYS$OUTPUT "" )
281 @ IF "$(DESTDIR)" .NES. "" THEN -
282 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
283 WRITE SYS$OUTPUT "" ; -
284 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
285 WRITE SYS$OUTPUT staging_instdir ; -
286 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
287 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
288 WRITE SYS$OUTPUT staging_datadir ; -
289 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
290 WRITE SYS$OUTPUT "" ; -
291 WRITE SYS$OUTPUT "When in its final destination," ; -
292 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup to set up logical names" ; -
293 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils to define commands" ; -
294 WRITE SYS$OUTPUT "" )
296 uninstall : uninstall_docs uninstall_sw
299 - DELETE {- join(",", map { "$_;*" } @{$unified_info{depends}->{""}} ) -}
300 - DELETE []OSSL$LIB*.EXE;*,OSSL$LIB*.MAP;*,OSSL$LIB*.OPT;*
301 - DELETE [.engines...]LIB*.EXE;*,LIB*.MAP;*,LIB*.OPT;*
302 - DELETE [.apps]*.EXE;*,*.MAP;*,*.OPT;*
303 - DELETE [.apps]*.OBJ;*,*.LIS;*
304 - DELETE [.test]*.EXE;*,*.MAP;*,*.OPT;*
305 - DELETE [.test]*.OBJ;*,*.LIS;*
306 - DELETE [.test]*.LOG;*
310 - DELETE configdata.pm;*
311 - DELETE descrip.mms;*
315 @ ! {- output_off() if $disabled{makedepend}; "" -}
316 @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
317 < descrip.mms > descrip.mms-new
318 @ OPEN/APPEND DESCRIP descrip.mms-new
319 @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
320 {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
322 @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
323 RENAME descrip.mms-new descrip.mms )
324 @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
325 -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
326 @ ! {- output_on() if $disabled{makedepend}; "" -}
328 # Install helper targets #############################################
330 install_sw : all install_dev install_engines install_runtime install_config
332 uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime uninstall_config
334 install_docs : install_man_docs install_html_docs
336 uninstall_docs : uninstall_man_docs uninstall_html_docs
338 install_dev : check_INSTALLTOP
339 @ WRITE SYS$OUTPUT "*** Installing development files"
340 @ ! Install header files
341 - CREATE/DIR ossl_installroot:[include.openssl]
342 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
343 @ ! Install libraries
344 - CREATE/DIR ossl_installroot:[LIB.'arch']
346 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
347 @{$unified_info{libraries}}) -}
348 @ {- output_off() if $disabled{shared}; "" -} !
350 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[LIB.'arch']" }
351 map { $unified_info{sharednames}->{$_} || () }
352 @{$unified_info{libraries}}) -}
353 @ {- output_on() if $disabled{shared}; "" -} !
355 install_runtime : check_INSTALLTOP
356 @ ! {- output_off() if $disabled{apps}; "" -}
357 @ WRITE SYS$OUTPUT "*** Installing runtime files"
358 @ ! Install the main program
359 - CREATE/DIR ossl_installroot:[EXE.'arch']
360 COPY/PROT=W:RE [.APPS]openssl.EXE ossl_installroot:[EXE.'arch']
362 - CREATE/DIR ossl_installroot:[EXE]
363 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
364 @ ! {- output_on() if $disabled{apps}; "" -}
365 @ ! Install configuration file
366 - CREATE/DIR ossl_dataroot:[000000]
367 COPY/PROT=W:RE {- sourcefile("apps", "openssl-vms.cnf") -} -
368 ossl_dataroot:[000000]openssl.cnf
370 install_engines : check_INSTALLTOP
371 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
372 @ WRITE SYS$OUTPUT "*** Installing engines"
373 - CREATE/DIR ossl_installroot:[ENGINES.'arch']
375 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES.'arch']" }
376 grep(!m|ossltest$|i, @{$unified_info{engines}})) -}
377 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
379 install_config : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
381 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
382 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
383 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
384 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
385 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
386 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
387 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
389 [.VMS]openssl_startup.com,openssl_shutdown.com -
390 ossl_installroot:[SYS$STARTUP]
392 {- sourcefile("VMS", "openssl_utils.com") -} -
393 ossl_installroot:[SYS$STARTUP]
394 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
396 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
398 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
399 {- sourcefile("VMS", "openssl_startup.com.in") -} -
400 > [.VMS]openssl_startup.com
402 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
404 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
405 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
406 > [.VMS]openssl_shutdown.com
408 vmsconfig.pm : configdata.pm
409 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
410 WRITE CONFIG "package vmsconfig;"
411 WRITE CONFIG "use strict; use warnings;"
412 WRITE CONFIG "use Exporter;"
413 WRITE CONFIG "our @ISA = qw(Exporter);"
414 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
415 WRITE CONFIG "our %config = ("
416 WRITE CONFIG " target => '{- $config{target} -}',"
417 WRITE CONFIG " version => '$(MAJOR).$(MINOR)',"
418 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
419 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
420 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
421 WRITE CONFIG " pointersize => '","{- $target{pointersize} -}","',"
422 WRITE CONFIG " shared_libs => ["
425 : join("\n ", map { "WRITE CONFIG \" '$_'," } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}})
429 WRITE CONFIG "our %target = ();"
430 WRITE CONFIG "our %disabled = ();"
431 WRITE CONFIG "our %withargs = ();"
432 WRITE CONFIG "our %unified_info = ();"
436 install_html_docs : check_INSTALLTOP
437 @ $(PERL) {- sourcefile("util", "process_docs.pl") -} -
438 --destdir=ossl_installroot:[HTML] --type=html
441 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
442 WRITE SYS$ERROR "INSTALLTOP should not be empty"
443 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
446 # Helper targets #####################################################
448 # Developer targets ##################################################
451 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
453 # Building targets ###################################################
455 configdata.pm : {- join(" ", sourcefile("Configurations", "descrip.mms.tmpl"), sourcefile("Configurations", "common.tmpl")) -} $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_infos}}) -}
456 @ WRITE SYS$OUTPUT "Reconfiguring..."
457 perl $(SRCDIR)Configure reconf
458 @ WRITE SYS$OUTPUT "*************************************************"
459 @ WRITE SYS$OUTPUT "*** ***"
460 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
461 @ WRITE SYS$OUTPUT "*** ***"
462 @ WRITE SYS$OUTPUT "*************************************************"
463 @ PIPE ( EXIT %X10000000 )
467 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
471 my $generator = join(" ", @{$args{generator}});
472 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
473 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
475 if ($args{src} !~ /\.[sS]$/) {
476 if ($args{generator}->[0] =~ m|^.*\.in$|) {
477 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
478 "util", "dofile.pl")),
479 rel2abs($config{builddir}));
481 $args{src} : $args{generator}->[0] $deps
482 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
483 "-o$target{build_file}" $generator > \$@
487 $args{src} : $args{generator}->[0] $deps
488 \$(PERL)$generator_incs $generator > \$@
492 die "No method to generate assembler source present.\n";
498 my $obj = $args{obj};
499 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
501 # Because VMS C isn't very good at combining a /INCLUDE path with
502 # #includes having a relative directory (like '#include "../foo.h"),
503 # the best choice is to move to the first source file's intended
504 # directory before compiling, and make sure to write the object file
505 # in the correct position (important when the object tree is other
506 # than the source tree).
507 my $forward = dirname($args{srcs}->[0]);
508 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
509 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
510 my $objn = basename($obj);
513 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
514 my $ecflags = { lib => '$(LIB_CFLAGS)',
515 dso => '$(DSO_CFLAGS)',
516 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
517 my $incs_on = "\@ !";
518 my $incs_off = "\@ !";
521 push @incs, @{$args{incs}} if @{$args{incs}};
522 unless ($disabled{zlib}) {
523 # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
525 push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
529 "DEFINE tmp_includes "
530 .join(",-\n\t\t\t", map {
531 file_name_is_absolute($_)
532 ? $_ : catdir($backward,$_)
534 $incs_off = "DEASSIGN tmp_includes";
535 $incs = " /INCLUDE=(tmp_includes:)";
537 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
538 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
539 my $depbuild = $disabled{makedepend} ? ""
540 : " /MMS=(FILE=${objd}${objn}.tmp-MMS,TARGET=$obj.OBJ)";
547 \$(CC) \$(CFLAGS)${ecflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
549 SET DEFAULT $backward
551 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.MMS"",""$obj.tmp-MMS""); exit(0x10000000 + (\$x == 0));" || -
552 RENAME $obj.tmp-MMS $obj.mms )
553 \@ IF F\$SEARCH("$obj.tmp-MMS") .NES. "" THEN DELETE $obj.tmp-MMS;*
559 my $lib = $args{lib};
560 my $shlib = $args{shlib};
561 my $libd = dirname($lib);
562 my $libn = basename($lib);
563 (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib//i;
565 $disabled{shared} ? $_.".OLB"
566 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
567 my $deps = join(", -\n\t\t", @deps);
568 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
569 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
570 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
571 "VMS", "engine.opt")),
572 rel2abs($config{builddir}));
573 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
574 "util", "mkdef.pl")),
575 rel2abs($config{builddir}));
576 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
577 "VMS", "translatesyms.pl")),
578 rel2abs($config{builddir}));
579 # The "[]" hack is because in .OPT files, each line inherits the
580 # previous line's file spec as default, so if no directory spec
581 # is present in the current line and the previous line has one that
582 # doesn't apply, you're in for a surprise.
584 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
585 $x =~ s|(\.EXE)|$1/SHARE|;
586 $x =~ s|(\.OLB)|$1/LIB|;
587 "WRITE OPT_FILE \"$x\"" } @deps)
590 $shlib.EXE : $lib.OLB $deps $ordinalsfile
591 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
592 \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
593 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
594 \$(PERL) $translatesyms_pl \$(BUILDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
595 OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
596 WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
597 IF "$mkdef_key" .NES. "ssl" .AND. "$mkdef_key" .NES. "crypto" THEN -
598 TYPE $engine_opt /OUTPUT=OPT_FILE:
599 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
600 TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
601 WRITE OPT_FILE "$lib.OLB/LIBRARY"
602 $write_opt ! Comment to protect from empty line
604 LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS)
605 - DELETE $shlib.SYMVEC;*
606 - PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
611 my $lib = $args{lib};
612 my $libd = dirname($lib);
613 my $libn = basename($lib);
614 (my $libn_nolib = $libn) =~ s/^lib//;
615 my @objs = map { "$_.OBJ" } @{$args{objs}};
617 $disabled{shared} ? $_.".OLB"
618 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
619 my $deps = join(", -\n\t\t", @objs, @deps);
620 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
621 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
622 "VMS", "engine.opt")),
623 rel2abs($config{builddir}));
624 # The "[]" hack is because in .OPT files, each line inherits the
625 # previous line's file spec as default, so if no directory spec
626 # is present in the current line and the previous line has one that
627 # doesn't apply, you're in for a surprise.
629 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
630 "WRITE OPT_FILE \"$x" } @objs).
632 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
633 $x =~ s|(\.EXE)|$1/SHARE|;
634 $x =~ s|(\.OLB)|$1/LIB|;
635 "WRITE OPT_FILE \"$x\"" } @deps)
639 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
640 TYPE $engine_opt /OUTPUT=OPT_FILE:
643 LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS)
644 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
649 my $lib = $args{lib};
650 my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
651 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
655 LIBRARY/CREATE/OBJECT $lib
662 my $bin = $args{bin};
663 my $bind = dirname($bin);
664 my $binn = basename($bin);
665 my @objs = map { "$_.OBJ" } @{$args{objs}};
667 $disabled{shared} ? $_.".OLB"
668 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
669 my $deps = join(", -\n\t\t", @objs, @deps);
670 # The "[]" hack is because in .OPT files, each line inherits the
671 # previous line's file spec as default, so if no directory spec
672 # is present in the current line and the previous line has one that
673 # doesn't apply, you're in for a surprise.
675 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
676 "WRITE OPT_FILE \"$x" } @objs).
678 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
679 $x =~ s|(\.EXE)|$1/SHARE|;
680 $x =~ s|(\.OLB)|$1/LIB|;
681 "WRITE OPT_FILE \"$x\"" } @deps)
685 OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
688 LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS)
689 - PURGE $bin.EXE,$bin.OPT
694 my $script = $args{script};
695 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
696 my $sources = join(" ", @{$args{sources}});
697 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
698 "util", "dofile.pl")),
699 rel2abs($config{builddir}));
702 \$(PERL) "-I\$(BUILDDIR)" "-Mconfigdata" $dofile -
703 "-o$target{build_file}" $sources > $script
704 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
708 "" # Important! This becomes part of the template result.