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 : $(GENERATED_MANDATORY), -
227 build_libs_nodep, build_engines_nodep, build_apps_nodep, -
230 build_libs : $(GENERATED_MANDATORY), build_libs_nodep, depend
231 build_libs_nodep : $(LIBS)
232 build_engines : $(GENERATED_MANDATORY), build_engines_nodep, depend
233 build_engines_nodep : $(ENGINES)
234 build_apps : $(GENERATED_MANDATORY), build_apps_nodep, depend
235 build_apps_nodep : $(PROGRAMS), $(SCRIPTS)
236 build_tests : $(GENERATED_MANDATORY), build_tests_nodep, depend
237 build_tests_nodep : $(TESTPROGS)
239 test tests : $(GENERATED_MANDATORY), -
240 build_apps_nodep, build_engines_nodep, build_tests_nodep, -
242 @ ! {- output_off() if $disabled{tests}; "" -}
243 SET DEFAULT [.test]{- move("test") -}
244 DEFINE SRCTOP {- sourcedir() -}
245 DEFINE BLDTOP {- builddir() -}
246 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
247 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
248 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
249 DEASSIGN OPENSSL_ENGINES
252 SET DEFAULT [-]{- move("..") -}
253 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
254 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
255 @ ! {- output_on() if !$disabled{tests}; "" -}
258 @ TOP=$(SRCDIR) PERL=$(PERL) $(PERL) {- catfile($config{sourcedir},"test", "run_tests.pl") -} list
260 # Because VMS wants the generation number (or *) to delete files, we can't
261 # use $(LIBS), $(PROGRAMS) and $(TESTPROGS) directly.
263 - DELETE []OSSL$LIB*.OLB;*,OSSL$LIB*.LIS;*
264 - DELETE [.crypto...]*.OBJ;*,*.LIS;*
265 - DELETE [.ssl...]*.OBJ;*,*.LIS;*
266 - DELETE [.engines...]*.OBJ;*,*.LIS;*
267 - DELETE []CXX$DEMANGLER_DB.;*
269 install : install_sw install_docs
270 @ WRITE SYS$OUTPUT ""
271 @ WRITE SYS$OUTPUT "######################################################################"
272 @ WRITE SYS$OUTPUT ""
273 @ IF "$(DESTDIR)" .EQS. "" THEN -
274 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
275 WRITE SYS$OUTPUT "" ; -
276 WRITE SYS$OUTPUT "Run @$(INSTALLTOP)openssl_startup to set up logical names" ; -
277 WRITE SYS$OUTPUT "then run @$(INSTALLTOP)openssl_setup to define commands" ; -
278 WRITE SYS$OUTPUT "" )
279 @ IF "$(DESTDIR)" .NES. "" THEN -
280 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
281 WRITE SYS$OUTPUT "" ; -
282 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
283 WRITE SYS$OUTPUT staging_instdir ; -
284 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
285 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
286 WRITE SYS$OUTPUT staging_datadir ; -
287 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
288 WRITE SYS$OUTPUT "" ; -
289 WRITE SYS$OUTPUT "When in its final destination," ; -
290 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup to set up logical names" ; -
291 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils to define commands" ; -
292 WRITE SYS$OUTPUT "" )
294 uninstall : uninstall_docs uninstall_sw
297 - DELETE {- join(",", map { "$_;*" } @{$unified_info{depends}->{""}} ) -}
298 - DELETE []OSSL$LIB*.EXE;*,OSSL$LIB*.MAP;*,OSSL$LIB*.OPT;*
299 - DELETE [.engines...]LIB*.EXE;*,LIB*.MAP;*,LIB*.OPT;*
300 - DELETE [.apps]*.EXE;*,*.MAP;*,*.OPT;*
301 - DELETE [.apps]*.OBJ;*,*.LIS;*
302 - DELETE [.test]*.EXE;*,*.MAP;*,*.OPT;*
303 - DELETE [.test]*.OBJ;*,*.LIS;*
304 - DELETE [.test]*.LOG;*
308 - DELETE configdata.pm;*
309 - DELETE descrip.mms;*
313 @ ! {- output_off() if $disabled{makedepend}; "" -}
314 @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
315 < descrip.mms > descrip.mms-new
316 @ OPEN/APPEND DESCRIP descrip.mms-new
317 @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
318 {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
320 @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
321 RENAME descrip.mms-new descrip.mms )
322 @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
323 -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
324 @ ! {- output_on() if $disabled{makedepend}; "" -}
326 # Install helper targets #############################################
328 install_sw : all install_dev install_engines install_runtime install_config
330 uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime uninstall_config
332 install_docs : install_man_docs install_html_docs
334 uninstall_docs : uninstall_man_docs uninstall_html_docs
336 install_dev : check_INSTALLTOP
337 @ WRITE SYS$OUTPUT "*** Installing development files"
338 @ ! Install header files
339 - CREATE/DIR ossl_installroot:[include.openssl]
340 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
341 @ ! Install libraries
342 - CREATE/DIR ossl_installroot:[LIB.'arch']
344 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
345 @{$unified_info{libraries}}) -}
346 @ {- output_off() if $disabled{shared}; "" -} !
348 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[LIB.'arch']" }
349 map { $unified_info{sharednames}->{$_} || () }
350 @{$unified_info{libraries}}) -}
351 @ {- output_on() if $disabled{shared}; "" -} !
353 install_runtime : check_INSTALLTOP
354 @ ! {- output_off() if $disabled{apps}; "" -}
355 @ WRITE SYS$OUTPUT "*** Installing runtime files"
356 @ ! Install the main program
357 - CREATE/DIR ossl_installroot:[EXE.'arch']
358 COPY/PROT=W:RE [.APPS]openssl.EXE ossl_installroot:[EXE.'arch']
360 - CREATE/DIR ossl_installroot:[EXE]
361 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
362 @ ! {- output_on() if $disabled{apps}; "" -}
363 @ ! Install configuration file
364 - CREATE/DIR ossl_dataroot:[000000]
365 COPY/PROT=W:RE {- sourcefile("apps", "openssl-vms.cnf") -} -
366 ossl_dataroot:[000000]openssl.cnf
368 install_engines : check_INSTALLTOP
369 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
370 @ WRITE SYS$OUTPUT "*** Installing engines"
371 - CREATE/DIR ossl_installroot:[ENGINES.'arch']
373 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES.'arch']" }
374 grep(!m|ossltest$|i, @{$unified_info{engines}})) -}
375 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
377 install_config : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
379 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
380 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
381 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
382 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
383 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
384 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
385 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
387 [.VMS]openssl_startup.com,openssl_shutdown.com -
388 ossl_installroot:[SYS$STARTUP]
390 {- sourcefile("VMS", "openssl_utils.com") -} -
391 ossl_installroot:[SYS$STARTUP]
392 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
394 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
396 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
397 {- sourcefile("VMS", "openssl_startup.com.in") -} -
398 > [.VMS]openssl_startup.com
400 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
402 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
403 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
404 > [.VMS]openssl_shutdown.com
406 vmsconfig.pm : configdata.pm
407 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
408 WRITE CONFIG "package vmsconfig;"
409 WRITE CONFIG "use strict; use warnings;"
410 WRITE CONFIG "use Exporter;"
411 WRITE CONFIG "our @ISA = qw(Exporter);"
412 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
413 WRITE CONFIG "our %config = ("
414 WRITE CONFIG " target => '{- $config{target} -}',"
415 WRITE CONFIG " version => '$(MAJOR).$(MINOR)',"
416 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
417 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
418 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
419 WRITE CONFIG " pointersize => '","{- $target{pointersize} -}","',"
420 WRITE CONFIG " shared_libs => ["
423 : join("\n ", map { "WRITE CONFIG \" '$_'," } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}})
427 WRITE CONFIG "our %target = ();"
428 WRITE CONFIG "our %disabled = ();"
429 WRITE CONFIG "our %withargs = ();"
430 WRITE CONFIG "our %unified_info = ();"
434 install_html_docs : check_INSTALLTOP
435 @ $(PERL) {- sourcefile("util", "process_docs.pl") -} -
436 --destdir=ossl_installroot:[HTML] --type=html
439 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
440 WRITE SYS$ERROR "INSTALLTOP should not be empty"
441 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
444 # Helper targets #####################################################
446 # Developer targets ##################################################
449 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
451 # Building targets ###################################################
453 configdata.pm : {- join(" ", sourcefile("Configurations", "descrip.mms.tmpl"), sourcefile("Configurations", "common.tmpl")) -} $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_infos}}) -}
454 @ WRITE SYS$OUTPUT "Reconfiguring..."
455 perl $(SRCDIR)Configure reconf
456 @ WRITE SYS$OUTPUT "*************************************************"
457 @ WRITE SYS$OUTPUT "*** ***"
458 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
459 @ WRITE SYS$OUTPUT "*** ***"
460 @ WRITE SYS$OUTPUT "*************************************************"
461 @ PIPE ( EXIT %X10000000 )
465 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
469 my $generator = join(" ", @{$args{generator}});
470 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
471 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
473 if ($args{src} !~ /\.[sS]$/) {
474 if ($args{generator}->[0] =~ m|^.*\.in$|) {
475 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
476 "util", "dofile.pl")),
477 rel2abs($config{builddir}));
479 $args{src} : $args{generator}->[0] $deps
480 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
481 "-o$target{build_file}" $generator > \$@
485 $args{src} : $args{generator}->[0] $deps
486 \$(PERL)$generator_incs $generator > \$@
490 die "No method to generate assembler source present.\n";
496 my $obj = $args{obj};
497 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
499 # Because VMS C isn't very good at combining a /INCLUDE path with
500 # #includes having a relative directory (like '#include "../foo.h"),
501 # the best choice is to move to the first source file's intended
502 # directory before compiling, and make sure to write the object file
503 # in the correct position (important when the object tree is other
504 # than the source tree).
505 my $forward = dirname($args{srcs}->[0]);
506 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
507 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
508 my $objn = basename($obj);
511 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
512 my $ecflags = { lib => '$(LIB_CFLAGS)',
513 dso => '$(DSO_CFLAGS)',
514 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
515 my $incs_on = "\@ !";
516 my $incs_off = "\@ !";
519 push @incs, @{$args{incs}} if @{$args{incs}};
520 unless ($disabled{zlib}) {
521 # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
523 push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
527 "DEFINE tmp_includes "
528 .join(",-\n\t\t\t", map {
529 file_name_is_absolute($_)
530 ? $_ : catdir($backward,$_)
532 $incs_off = "DEASSIGN tmp_includes";
533 $incs = " /INCLUDE=(tmp_includes:)";
535 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
536 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
537 my $depbuild = $disabled{makedepend} ? ""
538 : " /MMS=(FILE=${objd}${objn}.tmp-MMS,TARGET=$obj.OBJ)";
545 \$(CC) \$(CFLAGS)${ecflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
547 SET DEFAULT $backward
549 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.MMS"",""$obj.tmp-MMS""); exit(0x10000000 + (\$x == 0));" || -
550 RENAME $obj.tmp-MMS $obj.mms )
551 \@ IF F\$SEARCH("$obj.tmp-MMS") .NES. "" THEN DELETE $obj.tmp-MMS;*
557 my $lib = $args{lib};
558 my $shlib = $args{shlib};
559 my $libd = dirname($lib);
560 my $libn = basename($lib);
561 (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib//i;
563 $disabled{shared} ? $_.".OLB"
564 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
565 my $deps = join(", -\n\t\t", @deps);
566 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
567 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
568 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
569 "VMS", "engine.opt")),
570 rel2abs($config{builddir}));
571 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
572 "util", "mkdef.pl")),
573 rel2abs($config{builddir}));
574 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
575 "VMS", "translatesyms.pl")),
576 rel2abs($config{builddir}));
577 # The "[]" hack is because in .OPT files, each line inherits the
578 # previous line's file spec as default, so if no directory spec
579 # is present in the current line and the previous line has one that
580 # doesn't apply, you're in for a surprise.
582 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
583 $x =~ s|(\.EXE)|$1/SHARE|;
584 $x =~ s|(\.OLB)|$1/LIB|;
585 "WRITE OPT_FILE \"$x\"" } @deps)
588 $shlib.EXE : $lib.OLB $deps $ordinalsfile
589 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
590 \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
591 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
592 \$(PERL) $translatesyms_pl \$(BUILDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
593 OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
594 WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
595 IF "$mkdef_key" .NES. "ssl" .AND. "$mkdef_key" .NES. "crypto" THEN -
596 TYPE $engine_opt /OUTPUT=OPT_FILE:
597 IF "$mkdef_key" .EQS. "ssl" .OR. "$mkdef_key" .EQS. "crypto" THEN -
598 TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
599 WRITE OPT_FILE "$lib.OLB/LIBRARY"
600 $write_opt ! Comment to protect from empty line
602 LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS)
603 - DELETE $shlib.SYMVEC;*
604 - PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
609 my $lib = $args{lib};
610 my $libd = dirname($lib);
611 my $libn = basename($lib);
612 (my $libn_nolib = $libn) =~ s/^lib//;
613 my @objs = map { "$_.OBJ" } @{$args{objs}};
615 $disabled{shared} ? $_.".OLB"
616 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
617 my $deps = join(", -\n\t\t", @objs, @deps);
618 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
619 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
620 "VMS", "engine.opt")),
621 rel2abs($config{builddir}));
622 # The "[]" hack is because in .OPT files, each line inherits the
623 # previous line's file spec as default, so if no directory spec
624 # is present in the current line and the previous line has one that
625 # doesn't apply, you're in for a surprise.
627 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
628 "WRITE OPT_FILE \"$x" } @objs).
630 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
631 $x =~ s|(\.EXE)|$1/SHARE|;
632 $x =~ s|(\.OLB)|$1/LIB|;
633 "WRITE OPT_FILE \"$x\"" } @deps)
637 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
638 TYPE $engine_opt /OUTPUT=OPT_FILE:
641 LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS)
642 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
647 my $lib = $args{lib};
648 my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
649 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
653 LIBRARY/CREATE/OBJECT $lib
660 my $bin = $args{bin};
661 my $bind = dirname($bin);
662 my $binn = basename($bin);
663 my @objs = map { "$_.OBJ" } @{$args{objs}};
665 $disabled{shared} ? $_.".OLB"
666 : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
667 my $deps = join(", -\n\t\t", @objs, @deps);
668 # The "[]" hack is because in .OPT files, each line inherits the
669 # previous line's file spec as default, so if no directory spec
670 # is present in the current line and the previous line has one that
671 # doesn't apply, you're in for a surprise.
673 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
674 "WRITE OPT_FILE \"$x" } @objs).
676 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
677 $x =~ s|(\.EXE)|$1/SHARE|;
678 $x =~ s|(\.OLB)|$1/LIB|;
679 "WRITE OPT_FILE \"$x\"" } @deps)
683 OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
686 LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS)
687 - PURGE $bin.EXE,$bin.OPT
692 my $script = $args{script};
693 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
694 my $sources = join(" ", @{$args{sources}});
695 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
696 "util", "dofile.pl")),
697 rel2abs($config{builddir}));
700 \$(PERL) "-I\$(BUILDDIR)" "-Mconfigdata" $dofile -
701 "-o$target{build_file}" $sources > $script
702 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
706 "" # Important! This becomes part of the template result.