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 $sover_dirname = sprintf "%02d%02d", split(/\./, $config{shlib_version_number});
13 our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
15 our $sourcedir = $config{sourcedir};
16 our $builddir = $config{builddir};
18 catfile($sourcedir, @_);
21 catfile($builddir, @_);
24 catdir($sourcedir, @_);
27 catdir($builddir, @_);
30 (my $x = shift) =~ s|\]$|...]|;
35 my $b = abs2rel(rel2abs("."),rel2abs($f));
36 $sourcedir = catdir($b,$sourcedir)
37 if !file_name_is_absolute($sourcedir);
38 $builddir = catdir($b,$builddir)
39 if !file_name_is_absolute($builddir);
43 # Because we need to make two computations of these data,
44 # we store them in arrays for reuse
46 map { (my $x = $_) =~ s/\.a$//; $x }
47 @{$unified_info{libraries}};
49 map { $unified_info{sharednames}->{$_} || () }
50 grep(!/\.a$/, @{$unified_info{libraries}});
52 map { (my $x = $_) =~ s/\.a$//; $x }
53 @{$unified_info{install}->{libraries}};
55 map { $unified_info{sharednames}->{$_} || () }
56 grep(!/\.a$/, @{$unified_info{install}->{libraries}});
57 our @generated = ( ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
58 grep { defined $unified_info{generate}->{$_} }
59 map { @{$unified_info{sources}->{$_}} }
60 grep { /\.o$/ } keys %{$unified_info{sources}} ),
61 ( grep { /\.h$/ } keys %{$unified_info{generate}} ) );
63 # This is a horrible hack, but is needed because recursive inclusion of files
64 # in different directories does not work well with HP C.
65 my $sd = sourcedir("crypto", "async", "arch");
66 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
67 (my $x = $_) =~ s|\.o$|.OBJ|;
68 $unified_info{before}->{$x}
69 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
70 define arch 'arch_include');
71 $unified_info{after}->{$x}
74 my $sd1 = sourcedir("ssl","record");
75 my $sd2 = sourcedir("ssl","statem");
76 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
77 keys %{$unified_info{sources}});
78 foreach (@ssl_locl_users) {
79 (my $x = $_) =~ s|\.o$|.OBJ|;
80 $unified_info{before}->{$x}
81 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
82 define record 'record_include'
83 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
84 define statem 'statem_include');
85 $unified_info{after}->{$x}
89 # This makes sure things get built in the order they need
94 return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
97 #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
98 #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
101 PLATFORM={- $config{target} -}
102 OPTIONS={- $config{options} -}
103 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
104 SRCDIR={- $config{sourcedir} -}
105 BLDDIR={- $config{builddir} -}
107 # Allow both V and VERBOSE to indicate verbosity. This only applies
111 VERSION={- $config{version} -}
112 MAJOR={- $config{major} -}
113 MINOR={- $config{minor} -}
114 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
115 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
116 SHLIB_MAJOR={- $config{shlib_major} -}
117 SHLIB_MINOR={- $config{shlib_minor} -}
118 SHLIB_TARGET={- $target{shared_target} -}
126 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
127 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
128 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
129 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
130 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
131 {- output_off() if $disabled{makedepend}; "" -}
132 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
133 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
134 keys %{$unified_info{sources}};
135 join(", ", map { "-\n\t".$_ } @deps); -}
136 {- output_on() if $disabled{makedepend}; "" -}
137 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
138 GENERATED={- join(", ", map { "-\n\t".$_ } @generated) -}
140 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
141 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
142 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -}
143 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -}
144 {- output_off() if $disabled{apps}; "" -}
145 BIN_SCRIPTS=[.tools]c_rehash.pl
146 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
147 {- output_on() if $disabled{apps}; "" -}
149 APPS_OPENSSL={- use File::Spec::Functions;
150 catfile("apps","openssl") -}
152 # DESTDIR is for package builders so that they can configure for, say,
153 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
154 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
155 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
156 # STAGING:[USER.OPENSSL].
157 # Normally it is left empty.
160 # Do not edit this manually. Use Configure --prefix=DIR to change this!
161 INSTALLTOP={- our $installtop =
162 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
164 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
165 # This is the standard central area to store certificates, private keys...
166 OPENSSLDIR={- catdir($config{openssldir}) or
167 $config{prefix} ? catdir($config{prefix},"COMMON")
168 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
169 # The same, but for C
170 OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
171 # Where installed engines reside, for C
172 ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
174 CC= {- $target{cc} -}
175 CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR_C)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR_C)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -}
177 DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -})
178 LDFLAGS= {- $target{lflags} -}
179 EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
180 LIB_CFLAGS={- $target{lib_cflags} // "" -}
181 DSO_CFLAGS={- $target{dso_cflags} // "" -}
182 BIN_CFLAGS={- $target{bin_cflags} // "" -}
183 NO_INST_LIB_CFLAGS={- $target{no_inst_lib_cflags} // '$(LIB_CFLAGS)' -}
184 NO_INST_DSO_CFLAGS={- $target{no_inst_dso_cflags} // '$(DSO_CFLAGS)' -}
185 NO_INST_BIN_CFLAGS={- $target{no_inst_bin_cflags} // '$(BIN_CFLAGS)' -}
187 PERL={- $config{perl} -}
189 # We let the C compiler driver to take care of .s files. This is done in
190 # order to be excused from maintaining a separate set of architecture
191 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
192 # gcc, then the driver will automatically translate it to -xarch=v8plus
193 # and pass it down to assembler.
195 ASFLAG={- $target{asflags} -}
197 # .FIRST and .LAST are special targets with MMS and MMK.
198 # The defines in there are for C. includes that look like
201 # #include <openssl/foo.h>
202 # #include "internal/bar.h"
204 # will use the logical names to find the files. Expecting
205 # DECompHP C to find files in subdirectories of whatever was
206 # given with /INCLUDE is a fantasy, unfortunately.
209 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
210 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
211 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
212 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
213 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
214 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
215 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
216 $(NODEBUG) staging_dir = "$(DESTDIR)"
217 $(NODEBUG) staging_instdir = ""
218 $(NODEBUG) staging_datadir = ""
219 $(NODEBUG) IF staging_dir .NES. "" THEN -
220 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
221 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
222 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
223 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
224 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
225 $(NODEBUG) IF staging_dir .NES. "" THEN -
226 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
227 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
228 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
229 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
230 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
232 $(NODEBUG) ! Installation logical names
234 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
235 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
236 $(NODEBUG) DEFINE ossl_installroot 'installtop'
237 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
239 $(NODEBUG) ! Figure out the architecture
241 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
243 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
244 $(NODEBUG) ! running programs can use them.
246 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
249 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
250 $(NODEBUG) DEASSIGN ossl_dataroot
251 $(NODEBUG) DEASSIGN ossl_installroot
252 $(NODEBUG) DEASSIGN internal
253 $(NODEBUG) DEASSIGN openssl
255 @ ! MMS cannot handle no actions...
257 # The main targets ###################################################
259 {- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep
260 {- dependmagic('build_libs'); -} : build_libs_nodep
261 {- dependmagic('build_engines'); -} : build_engines_nodep
262 {- dependmagic('build_programs'); -} : build_programs_nodep
264 build_generated : $(GENERATED_MANDATORY)
265 build_libs_nodep : $(LIBS), $(SHLIBS)
266 build_engines_nodep : $(ENGINES)
267 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
269 # Kept around for backward compatibility
270 build_apps build_tests : build_programs
272 # Convenience target to prebuild all generated files, not just the mandatory
274 build_all_generated : $(GENERATED_MANDATORY) $(GENERATED)
277 {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep
278 @ ! {- output_off() if $disabled{tests}; "" -}
279 SET DEFAULT [.test]{- move("test") -}
280 CREATE/DIR [.test-runs]
281 DEFINE SRCTOP {- sourcedir() -}
282 DEFINE BLDTOP {- builddir() -}
283 DEFINE RESULT_D {- builddir(qw(test test-runs)) -}
284 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
285 DEFINE OPENSSL_DEBUG_MEMORY "on"
286 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
287 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
288 DEASSIGN OPENSSL_DEBUG_MEMORY
289 DEASSIGN OPENSSL_ENGINES
292 SET DEFAULT [-]{- move("..") -}
293 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
294 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
295 @ ! {- output_on() if !$disabled{tests}; "" -}
298 @ ! {- output_off() if $disabled{tests}; "" -}
299 @ DEFINE SRCTOP {- sourcedir() -}
300 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
302 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
303 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
304 @ ! {- output_on() if !$disabled{tests}; "" -}
306 install : install_sw install_ssldirs install_docs
307 @ WRITE SYS$OUTPUT ""
308 @ WRITE SYS$OUTPUT "######################################################################"
309 @ WRITE SYS$OUTPUT ""
310 @ IF "$(DESTDIR)" .EQS. "" THEN -
311 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
312 WRITE SYS$OUTPUT "" ; -
313 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
314 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
315 WRITE SYS$OUTPUT "" )
316 @ IF "$(DESTDIR)" .NES. "" THEN -
317 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
318 WRITE SYS$OUTPUT "" ; -
319 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
320 WRITE SYS$OUTPUT staging_instdir ; -
321 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
322 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
323 WRITE SYS$OUTPUT staging_datadir ; -
324 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
325 WRITE SYS$OUTPUT "" ; -
326 WRITE SYS$OUTPUT "When in its final destination," ; -
327 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
328 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
329 WRITE SYS$OUTPUT "" )
332 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
334 uninstall : uninstall_docs uninstall_sw
336 # Because VMS wants the generation number (or *) to delete files, we can't
337 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
339 {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
340 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
343 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
344 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
345 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
346 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
347 - DELETE [...]*.MAP;*
349 - DELETE [...]*.OBJ;*,*.LIS;*
350 - DELETE []CXX$DEMANGLER_DB.;*
351 - DELETE [.VMS]openssl_startup.com;*
352 - DELETE [.VMS]openssl_shutdown.com;*
353 - DELETE []vmsconfig.pm;*
356 - DELETE configdata.pm;*
357 - DELETE descrip.mms;*
361 @ ! {- output_off() if $disabled{makedepend}; "" -}
362 @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
363 < descrip.mms > descrip.mms-new
364 @ OPEN/APPEND DESCRIP descrip.mms-new
365 @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
366 {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
368 @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
369 RENAME descrip.mms-new descrip.mms )
370 @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
371 -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
372 @ ! {- output_on() if $disabled{makedepend}; "" -}
374 # Install helper targets #############################################
376 install_sw : all install_shared _install_dev_ns -
377 install_engines _install_runtime_ns -
378 install_startup install_ivp
380 uninstall_sw : uninstall_shared _uninstall_dev_ns -
381 uninstall_engines _uninstall_runtime_ns -
382 uninstall_startup uninstall_ivp
384 install_docs : install_html_docs
386 uninstall_docs : uninstall_html_docs
388 install_ssldirs : check_INSTALLTOP
389 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
390 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
391 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
392 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
393 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
394 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
395 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
396 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
397 @ ! Install configuration file
398 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
399 ossl_dataroot:[000000]openssl.cnf-dist
400 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
401 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
402 ossl_dataroot:[000000]openssl.cnf
403 @ ! Install CTLOG configuration file
404 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
405 ossl_dataroot:[000000]ct_log_list.cnf-dist
406 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
407 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
408 ossl_dataroot:[000000]ct_log_list.cnf
410 install_shared : check_INSTALLTOP
411 @ {- output_off() if $disabled{shared}; "" -} !
412 @ WRITE SYS$OUTPUT "*** Installing shareable images"
413 @ ! Install shared (runtime) libraries
414 - CREATE/DIR ossl_installroot:[LIB.'arch']
416 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
418 @ {- output_on() if $disabled{shared}; "" -} !
420 _install_dev_ns : check_INSTALLTOP
421 @ WRITE SYS$OUTPUT "*** Installing development files"
422 @ ! Install header files
423 - CREATE/DIR ossl_installroot:[include.openssl]
424 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
425 @ ! Install static (development) libraries
426 - CREATE/DIR ossl_installroot:[LIB.'arch']
428 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
431 install_dev : install_shared _install_dev_ns
433 _install_runtime_ns : check_INSTALLTOP
434 @ ! Install the main program
435 - CREATE/DIR ossl_installroot:[EXE.'arch']
436 COPY/PROT=W:RE [.APPS]openssl.EXE -
437 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
439 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
440 @ ! {- output_on() if $disabled{apps}; "" -}
442 install_runtime : install_shared _install_runtime_ns
444 install_engines : check_INSTALLTOP
445 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
446 @ WRITE SYS$OUTPUT "*** Installing engines"
447 - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
449 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
450 @{$unified_info{install}->{engines}}) -}
451 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
453 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
454 [.VMS]openssl_utils.com, check_INSTALLTOP
455 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
456 COPY/PROT=W:RE [.VMS]openssl_startup.com -
457 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
458 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
459 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
460 COPY/PROT=W:RE [.VMS]openssl_utils.com -
461 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
463 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
464 - CREATE/DIR ossl_installroot:[SYSTEST]
465 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
466 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
468 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
470 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
471 {- sourcefile("VMS", "openssl_startup.com.in") -} -
472 > [.VMS]openssl_startup.com
474 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
476 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
477 {- sourcefile("VMS", "openssl_utils.com.in") -} -
478 > [.VMS]openssl_utils.com
480 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
482 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
483 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
484 > [.VMS]openssl_shutdown.com
486 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
488 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
489 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
490 > [.VMS]openssl_ivp.com
492 vmsconfig.pm : configdata.pm
493 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
494 WRITE CONFIG "package vmsconfig;"
495 WRITE CONFIG "use strict; use warnings;"
496 WRITE CONFIG "use Exporter;"
497 WRITE CONFIG "our @ISA = qw(Exporter);"
498 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
499 WRITE CONFIG "our %config = ("
500 WRITE CONFIG " target => '","{- $config{target} -}","',"
501 WRITE CONFIG " version => '","{- $config{version} -}","',"
502 WRITE CONFIG " shlib_version_number => '","{- $config{shlib_version_number} -}","',"
503 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
504 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
505 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
506 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
507 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
508 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
510 WRITE CONFIG "our %target = ();"
511 WRITE CONFIG "our %disabled = ();"
512 WRITE CONFIG "our %withargs = ();"
513 WRITE CONFIG "our %unified_info = ();"
517 install_html_docs : check_INSTALLTOP
518 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
519 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
520 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
524 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
525 WRITE SYS$ERROR "INSTALLTOP should not be empty"
526 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
529 # Helper targets #####################################################
531 # Developer targets ##################################################
534 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
536 # Building targets ###################################################
538 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
539 @ WRITE SYS$OUTPUT "Reconfiguring..."
540 perl $(SRCDIR)Configure reconf
541 @ WRITE SYS$OUTPUT "*************************************************"
542 @ WRITE SYS$OUTPUT "*** ***"
543 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
544 @ WRITE SYS$OUTPUT "*** ***"
545 @ WRITE SYS$OUTPUT "*************************************************"
546 @ PIPE ( EXIT %X10000000 )
550 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
552 # Helper function to figure out dependencies on libraries
553 # It takes a list of library names and outputs a list of dependencies
554 sub compute_lib_depends {
555 if ($disabled{shared}) {
556 return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_;
558 return map { $_ =~ /\.a$/
560 : $unified_info{sharednames}->{$_}.".EXE" } @_;
565 my $generator = join(" ", @{$args{generator}});
566 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
567 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
569 if ($args{src} !~ /\.[sS]$/) {
570 if ($args{generator}->[0] =~ m|^.*\.in$|) {
571 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
572 "util", "dofile.pl")),
573 rel2abs($config{builddir}));
575 $args{src} : $args{generator}->[0] $deps
576 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
577 "-o$target{build_file}" $generator > \$@
581 $args{src} : $args{generator}->[0] $deps
582 \$(PERL)$generator_incs $generator > \$@
586 die "No method to generate assembler source present.\n";
592 (my $obj = $args{obj}) =~ s|\.o$||;
593 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
595 # Because VMS C isn't very good at combining a /INCLUDE path with
596 # #includes having a relative directory (like '#include "../foo.h"),
597 # the best choice is to move to the first source file's intended
598 # directory before compiling, and make sure to write the object file
599 # in the correct position (important when the object tree is other
600 # than the source tree).
601 my $forward = dirname($args{srcs}->[0]);
602 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
603 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
604 my $objn = basename($obj);
607 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
609 if ($args{installed}) {
610 $ecflags = { lib => '$(LIB_CFLAGS)',
611 dso => '$(DSO_CFLAGS)',
612 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
614 $ecflags = { lib => '$(NO_INST_LIB_CFLAGS)',
615 dso => '$(NO_INST_DSO_CFLAGS)',
616 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
618 my $incs_on = "\@ !";
619 my $incs_off = "\@ !";
622 push @incs, @{$args{incs}} if @{$args{incs}};
623 unless ($disabled{zlib}) {
624 # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
626 push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
630 "DEFINE tmp_includes "
631 .join(",-\n\t\t\t", map {
632 file_name_is_absolute($_)
633 ? $_ : catdir($backward,$_)
635 $incs_off = "DEASSIGN tmp_includes";
636 $incs = " /INCLUDE=(tmp_includes:)";
638 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
639 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
640 my $depbuild = $disabled{makedepend} ? ""
641 : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
648 \$(CC) \$(CFLAGS)${ecflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
650 SET DEFAULT $backward
652 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
653 RENAME $obj.tmp-D $obj.d )
654 \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
660 my $lib = $args{lib};
661 my $shlib = $args{shlib};
662 my $libd = dirname($lib);
663 my $libn = basename($lib);
664 my @defs = grep { $_ =~ /\.opt$/ } @{$args{objs}};
665 my @deps = compute_lib_depends(@{$args{deps}});
666 die "More than one symbol vector" if scalar @defs > 1;
667 my $deps = join(", -\n\t\t", @defs, @deps);
668 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
669 my $shared_def = join(",", map { "$_/OPT" } @defs);
670 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
671 "VMS", "translatesyms.pl")),
672 rel2abs($config{builddir}));
673 # The "[]" hack is because in .OPT files, each line inherits the
674 # previous line's file spec as default, so if no directory spec
675 # is present in the current line and the previous line has one that
676 # doesn't apply, you're in for a surprise.
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)
684 $shlib.EXE : $lib.OLB $deps
685 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
686 LINK \$(LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,$lib.OLB/LIBRARY
688 DELETE $defs[0]-translated;*
689 PURGE $shlib.EXE,$shlib.MAP
691 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
692 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
698 my $lib = $args{lib};
699 my $libd = dirname($lib);
700 my $libn = basename($lib);
701 (my $libn_nolib = $libn) =~ s/^lib//;
702 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
703 my @deps = compute_lib_depends(@{$args{deps}});
704 my $deps = join(", -\n\t\t", @objs, @deps);
705 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
706 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
707 "VMS", "engine.opt")),
708 rel2abs($config{builddir}));
709 # The "[]" hack is because in .OPT files, each line inherits the
710 # previous line's file spec as default, so if no directory spec
711 # is present in the current line and the previous line has one that
712 # doesn't apply, you're in for a surprise.
714 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
715 "WRITE OPT_FILE \"$x" } @objs).
718 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
719 $x =~ s|(\.EXE)|$1/SHARE|;
720 $x =~ s|(\.OLB)|$1/LIB|;
721 "WRITE OPT_FILE \"$x\"" } @deps)
725 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
726 TYPE $engine_opt /OUTPUT=OPT_FILE:
730 LINK \$(LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(EX_LIBS)
731 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
733 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
734 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
740 (my $lib = $args{lib}) =~ s/\.a$//;
741 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
742 my $objs = join(", -\n\t\t", @objs);
743 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_" }
747 LIBRARY/CREATE/OBJECT $lib.OLB
754 my $bin = $args{bin};
755 my $bind = dirname($bin);
756 my $binn = basename($bin);
757 my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}};
758 my $objs = join(",", @objs);
759 my @deps = compute_lib_depends(@{$args{deps}});
760 my $deps = join(", -\n\t\t", @objs, @deps);
762 my $olb_count = scalar grep(m|\.OLB$|, @deps);
763 my $analyse_objs = "@ !";
764 if ($olb_count > 0) {
766 $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
767 $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
769 # The "[]" hack is because in .OPT files, each line inherits the
770 # previous line's file spec as default, so if no directory spec
771 # is present in the current line and the previous line has one that
772 # doesn't apply, you're in for a surprise.
774 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
775 "\@ WRITE OPT_FILE \"$x" } @objs).
778 join("\n\t", map { my @lines = ();
779 my $x = $_ =~ /\[/ ? $_ : "[]".$_;
780 if ($x =~ m|\.EXE$|) {
781 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
782 } elsif ($x =~ m|\.OLB$|) {
783 (my $l = $x) =~ s/\W/_/g;
785 "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB\$(INCLUDE_MAIN_$l)\"",
786 "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
791 # The linking commands looks a bit complex, but it's for good reason.
792 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
793 # bar.obj happens to have a symbol that also exists in libsomething.exe,
794 # the linker will warn about it, loudly, and will then choose to pick
795 # the first copy encountered (the one in bar.obj in this example).
796 # On Unix and on Windows, the corresponding maneuvre goes through
797 # silently with the same effect.
798 # With some test programs, made for checking the internals of OpenSSL,
799 # we do this kind of linking deliberately, picking a few specific object
800 # files from within [.crypto] or [.ssl] so we can reach symbols that are
801 # otherwise unreachable (since the shareable images only exports the
802 # symbols listed in [.util]*.num), and then with the shared libraries
803 # themselves. So we need to silence the warning about multiply defined
804 # symbols, to mimic the way linking work on Unix and Windows, and so
805 # the build isn't interrupted (MMS stops when warnings are signaled,
806 # by default), and so someone building doesn't have to worry where it
807 # isn't necessary. If there are other warnings, however, we show them
808 # and let it break the build.
812 @ OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
816 TYPE $bin.opt ! For debugging
817 - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
818 LINK \$(LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(EX_LIBS) ; -
819 link_status = \$status ; link_severity = link_status .AND. 7
820 @ search_severity = 1
821 -@ IF link_severity .EQ. 0 THEN -
822 pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | -
823 SPAWN/WAIT/NOLOG/OUT=NLA0: -
824 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
825 search_severity = \$severity
826 @ ! search_severity is 3 when the last search didn't find any matching
827 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
828 @ ! If that was the result, we pretend linking got through without
829 @ ! fault or warning.
830 @ IF search_severity .EQ. 3 THEN link_severity = 1
831 @ ! At this point, if link_severity shows that there was a fault
832 @ ! or warning, make sure to restore the linking status.
833 -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG
834 -@ DELETE $bin.LINKLOG;*
835 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
836 - PURGE $bin.EXE,$bin.OPT
838 . ($config{target} =~ m|alpha| ? "" : <<"EOF"
839 SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
845 my $script = $args{script};
846 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
847 my $sources = join(" ", @{$args{sources}});
848 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
849 "util", "dofile.pl")),
850 rel2abs($config{builddir}));
853 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
854 "-o$target{build_file}" $sources > $script
855 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
859 "" # Important! This becomes part of the template result.