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 = sprintf "%02d%02d", $config{shlib_major}, $config{shlib_minor};
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
45 our @shlibs = map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}};
46 our @install_shlibs = map { $unified_info{sharednames}->{$_} || () } @{$unified_info{install}->{libraries}};
47 our @generated = ( ( map { (my $x = $_) =~ s|\.S$|\.s|; $x }
48 grep { defined $unified_info{generate}->{$_} }
49 map { @{$unified_info{sources}->{$_}} }
50 grep { /\.o$/ } keys %{$unified_info{sources}} ),
51 ( grep { /\.h$/ } keys %{$unified_info{generate}} ) );
53 # This is a horrible hack, but is needed because recursive inclusion of files
54 # in different directories does not work well with HP C.
55 my $sd = sourcedir("crypto", "async", "arch");
56 foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
57 (my $x = $_) =~ s|\.o$|.OBJ|;
58 $unified_info{before}->{$x}
59 = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;"
60 define arch 'arch_include');
61 $unified_info{after}->{$x}
64 my $sd1 = sourcedir("ssl","record");
65 my $sd2 = sourcedir("ssl","statem");
66 my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/,
67 keys %{$unified_info{sources}});
68 foreach (@ssl_locl_users) {
69 (my $x = $_) =~ s|\.o$|.OBJ|;
70 $unified_info{before}->{$x}
71 = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
72 define record 'record_include'
73 statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
74 define statem 'statem_include');
75 $unified_info{after}->{$x}
80 #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
81 #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
84 PLATFORM={- $config{target} -}
85 OPTIONS={- $config{options} -}
86 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
87 SRCDIR={- $config{sourcedir} -}
88 BLDDIR={- $config{builddir} -}
90 # Allow both V and VERBOSE to indicate verbosity. This only applies
94 VERSION={- $config{version} -}
95 MAJOR={- $config{major} -}
96 MINOR={- $config{minor} -}
97 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
98 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
99 SHLIB_MAJOR={- $config{shlib_major} -}
100 SHLIB_MINOR={- $config{shlib_minor} -}
101 SHLIB_TARGET={- $target{shared_target} -}
109 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{libraries}}) -}
110 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
111 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
112 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
113 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
114 {- output_off() if $disabled{makedepend}; "" -}
115 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
116 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
117 keys %{$unified_info{sources}};
118 join(", ", map { "-\n\t".$_ } @deps); -}
119 {- output_on() if $disabled{makedepend}; "" -}
120 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
121 GENERATED={- join(", ", map { "-\n\t".$_ } @generated) -}
123 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{install}->{libraries}}) -}
124 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
125 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -}
126 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -}
127 {- output_off() if $disabled{apps}; "" -}
128 BIN_SCRIPTS=[.tools]c_rehash.pl
129 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
130 {- output_on() if $disabled{apps}; "" -}
132 # DESTDIR is for package builders so that they can configure for, say,
133 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
134 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
135 # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in
136 # STAGING:[USER.OPENSSL].
137 # Normally it is left empty.
140 # Do not edit this manually. Use Configure --prefix=DIR to change this!
141 INSTALLTOP={- our $installtop =
142 catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
144 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
145 # This is the standard central area to store certificates, private keys...
146 OPENSSLDIR={- catdir($config{openssldir}) or
147 $config{prefix} ? catdir($config{prefix},"COMMON")
148 : "SYS\$COMMON:[OPENSSL-COMMON]" -}
149 # The same, but for C
150 OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
151 # Where installed engines reside, for C
152 ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover.$target{pointer_size} -}:
154 CC= {- $target{cc} -}
155 CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR_C)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR_C)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -}
157 DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -})
158 LDFLAGS= {- $target{lflags} -}
159 EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
160 LIB_CFLAGS={- $target{lib_cflags} || "" -}
161 DSO_CFLAGS={- $target{dso_cflags} || "" -}
162 BIN_CFLAGS={- $target{bin_cflags} || "" -}
163 NO_INST_LIB_CFLAGS={- $target{no_inst_lib_cflags} || '$(LIB_CFLAGS)' -}
164 NO_INST_DSO_CFLAGS={- $target{no_inst_dso_cflags} || '$(DSO_CFLAGS)' -}
165 NO_INST_BIN_CFLAGS={- $target{no_inst_bin_cflags} || '$(BIN_CFLAGS)' -}
167 PERL={- $config{perl} -}
169 # We let the C compiler driver to take care of .s files. This is done in
170 # order to be excused from maintaining a separate set of architecture
171 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
172 # gcc, then the driver will automatically translate it to -xarch=v8plus
173 # and pass it down to assembler.
175 ASFLAG={- $target{asflags} -}
177 # .FIRST and .LAST are special targets with MMS and MMK.
178 # The defines in there are for C. includes that look like
181 # #include <openssl/foo.h>
182 # #include "internal/bar.h"
184 # will use the logical names to find the files. Expecting
185 # DECompHP C to find files in subdirectories of whatever was
186 # given with /INCLUDE is a fantasy, unfortunately.
189 $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
190 $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
191 $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
192 $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
193 $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
194 $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
195 $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
196 $(NODEBUG) staging_dir = "$(DESTDIR)"
197 $(NODEBUG) staging_instdir = ""
198 $(NODEBUG) staging_datadir = ""
199 $(NODEBUG) IF staging_dir .NES. "" THEN -
200 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
201 $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
202 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
203 $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
204 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
205 $(NODEBUG) IF staging_dir .NES. "" THEN -
206 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
207 $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
208 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
209 $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
210 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
212 $(NODEBUG) ! Installation logical names
214 $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
215 $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
216 $(NODEBUG) DEFINE ossl_installroot 'installtop'
217 $(NODEBUG) DEFINE ossl_dataroot 'datatop'
219 $(NODEBUG) ! Figure out the architecture
221 $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
223 $(NODEBUG) ! Set up logical names for the libraries, so LINK and
224 $(NODEBUG) ! running programs can use them.
226 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
229 $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
230 $(NODEBUG) DEASSIGN ossl_dataroot
231 $(NODEBUG) DEASSIGN ossl_installroot
232 $(NODEBUG) DEASSIGN internal
233 $(NODEBUG) DEASSIGN openssl
235 @ ! MMS cannot handle no actions...
237 # The main targets ###################################################
239 all : build_generated, -
240 build_libs_nodep, build_engines_nodep, build_programs_nodep, -
243 build_libs : build_generated, build_libs_nodep, depend
244 build_libs_nodep : $(LIBS), $(SHLIBS)
245 build_engines : build_generated, build_engines_nodep, depend
246 build_engines_nodep : $(ENGINES)
247 build_programs : build_generated, build_programs_nodep, depend
248 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
250 build_generated : $(GENERATED_MANDATORY)
252 # Kept around for backward compatibility
253 build_apps build_tests : build_programs
255 test tests : build_generated, build_programs_nodep, build_engines_nodep, -
257 @ ! {- output_off() if $disabled{tests}; "" -}
258 SET DEFAULT [.test]{- move("test") -}
259 DEFINE SRCTOP {- sourcedir() -}
260 DEFINE BLDTOP {- builddir() -}
261 DEFINE OPENSSL_ENGINES {- builddir("engines") -}
262 DEFINE OPENSSL_DEBUG_MEMORY "on"
263 IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
264 $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
265 DEASSIGN OPENSSL_DEBUG_MEMORY
266 DEASSIGN OPENSSL_ENGINES
269 SET DEFAULT [-]{- move("..") -}
270 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
271 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
272 @ ! {- output_on() if !$disabled{tests}; "" -}
275 @ ! {- output_off() if $disabled{tests}; "" -}
276 @ DEFINE SRCTOP {- sourcedir() -}
277 @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
279 @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
280 @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
281 @ ! {- output_on() if !$disabled{tests}; "" -}
283 install : install_sw install_ssldirs install_docs
284 @ WRITE SYS$OUTPUT ""
285 @ WRITE SYS$OUTPUT "######################################################################"
286 @ WRITE SYS$OUTPUT ""
287 @ IF "$(DESTDIR)" .EQS. "" THEN -
288 PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
289 WRITE SYS$OUTPUT "" ; -
290 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
291 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
292 WRITE SYS$OUTPUT "" )
293 @ IF "$(DESTDIR)" .NES. "" THEN -
294 PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
295 WRITE SYS$OUTPUT "" ; -
296 WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
297 WRITE SYS$OUTPUT staging_instdir ; -
298 WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
299 WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
300 WRITE SYS$OUTPUT staging_datadir ; -
301 WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
302 WRITE SYS$OUTPUT "" ; -
303 WRITE SYS$OUTPUT "When in its final destination," ; -
304 WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
305 WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
306 WRITE SYS$OUTPUT "" )
309 spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
311 uninstall : uninstall_docs uninstall_sw
313 # Because VMS wants the generation number (or *) to delete files, we can't
314 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
316 {- join("\n\t", map { "- DELETE $_.OLB;*" } @{$unified_info{libraries}}) || "@ !" -}
317 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*,$_.OPT;*" } @shlibs) || "@ !" -}
320 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
321 {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
322 {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
323 {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
324 - DELETE [...]*.MAP;*
326 - DELETE [...]*.OBJ;*,*.LIS;*
327 - DELETE []CXX$DEMANGLER_DB.;*
328 - DELETE [.VMS]openssl_startup.com;*
329 - DELETE [.VMS]openssl_shutdown.com;*
330 - DELETE []vmsconfig.pm;*
333 - DELETE configdata.pm;*
334 - DELETE descrip.mms;*
338 @ ! {- output_off() if $disabled{makedepend}; "" -}
339 @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
340 < descrip.mms > descrip.mms-new
341 @ OPEN/APPEND DESCRIP descrip.mms-new
342 @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
343 {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
345 @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
346 RENAME descrip.mms-new descrip.mms )
347 @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
348 -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
349 @ ! {- output_on() if $disabled{makedepend}; "" -}
351 # Install helper targets #############################################
353 install_sw : all install_shared _install_dev_ns -
354 install_engines _install_runtime_ns -
355 install_startup install_ivp
357 uninstall_sw : uninstall_shared _uninstall_dev_ns -
358 uninstall_engines _uninstall_runtime_ns -
359 uninstall_startup uninstall_ivp
361 install_docs : install_html_docs
363 uninstall_docs : uninstall_html_docs
365 install_ssldirs : check_INSTALLTOP
366 - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
367 IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
368 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
369 IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
370 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
371 IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
372 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
373 COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
374 @ ! Install configuration file
375 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
376 ossl_dataroot:[000000]openssl.cnf-dist
377 IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
378 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
379 ossl_dataroot:[000000]openssl.cnf
380 @ ! Install CTLOG configuration file
381 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
382 ossl_dataroot:[000000]ct_log_list.cnf-dist
383 IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
384 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
385 ossl_dataroot:[000000]ct_log_list.cnf
387 install_shared : check_INSTALLTOP
388 @ {- output_off() if $disabled{shared}; "" -} !
389 @ WRITE SYS$OUTPUT "*** Installing shareable images"
390 @ ! Install shared (runtime) libraries
391 - CREATE/DIR ossl_installroot:[LIB.'arch']
393 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
395 @ {- output_on() if $disabled{shared}; "" -} !
397 _install_dev_ns : check_INSTALLTOP
398 @ WRITE SYS$OUTPUT "*** Installing development files"
399 @ ! Install header files
400 - CREATE/DIR ossl_installroot:[include.openssl]
401 COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
402 @ ! Install static (development) libraries
403 - CREATE/DIR ossl_installroot:[LIB.'arch']
405 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
406 @{$unified_info{install}->{libraries}}) -}
408 install_dev : install_shared _install_dev_ns
410 _install_runtime_ns : check_INSTALLTOP
411 @ ! Install the main program
412 - CREATE/DIR ossl_installroot:[EXE.'arch']
413 COPY/PROT=W:RE [.APPS]openssl.EXE -
414 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
416 COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
417 @ ! {- output_on() if $disabled{apps}; "" -}
419 install_runtime : install_shared _install_runtime_ns
421 install_engines : check_INSTALLTOP
422 @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
423 @ WRITE SYS$OUTPUT "*** Installing engines"
424 - CREATE/DIR ossl_installroot:[ENGINES{- $sover.$target{pointer_size} -}.'arch']
426 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover$target{pointer_size}.'arch']" }
427 @{$unified_info{install}->{engines}}) -}
428 @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
430 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
431 [.VMS]openssl_utils.com, check_INSTALLTOP
432 - CREATE/DIR ossl_installroot:[SYS$STARTUP]
433 COPY/PROT=W:RE [.VMS]openssl_startup.com -
434 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
435 COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
436 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
437 COPY/PROT=W:RE [.VMS]openssl_utils.com -
438 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
440 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
441 - CREATE/DIR ossl_installroot:[SYSTEST]
442 COPY/PROT=W:RE [.VMS]openssl_ivp.com -
443 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
445 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
447 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
448 {- sourcefile("VMS", "openssl_startup.com.in") -} -
449 > [.VMS]openssl_startup.com
451 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
453 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
454 {- sourcefile("VMS", "openssl_utils.com.in") -} -
455 > [.VMS]openssl_utils.com
457 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
459 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
460 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
461 > [.VMS]openssl_shutdown.com
463 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
465 $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
466 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
467 > [.VMS]openssl_ivp.com
469 vmsconfig.pm : configdata.pm
470 OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
471 WRITE CONFIG "package vmsconfig;"
472 WRITE CONFIG "use strict; use warnings;"
473 WRITE CONFIG "use Exporter;"
474 WRITE CONFIG "our @ISA = qw(Exporter);"
475 WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
476 WRITE CONFIG "our %config = ("
477 WRITE CONFIG " target => '","{- $config{target} -}","',"
478 WRITE CONFIG " version => '","{- $config{version} -}","',"
479 WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","',"
480 WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","',"
481 WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","',"
482 WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)',"
483 WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)',"
484 WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","',"
486 WRITE CONFIG "our %target = ();"
487 WRITE CONFIG "our %disabled = ();"
488 WRITE CONFIG "our %withargs = ();"
489 WRITE CONFIG "our %unified_info = ();"
493 install_html_docs : check_INSTALLTOP
494 sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
495 $(PERL) {- sourcefile("util", "process_docs.pl") -} -
496 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
500 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
501 WRITE SYS$ERROR "INSTALLTOP should not be empty"
502 @ IF "$(INSTALLTOP)" .EQS. "" THEN -
505 # Helper targets #####################################################
507 # Developer targets ##################################################
510 SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
512 # Building targets ###################################################
514 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
515 @ WRITE SYS$OUTPUT "Reconfiguring..."
516 perl $(SRCDIR)Configure reconf
517 @ WRITE SYS$OUTPUT "*************************************************"
518 @ WRITE SYS$OUTPUT "*** ***"
519 @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***"
520 @ WRITE SYS$OUTPUT "*** ***"
521 @ WRITE SYS$OUTPUT "*************************************************"
522 @ PIPE ( EXIT %X10000000 )
526 use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
528 # Helper function to figure out dependencies on libraries
529 # It takes a list of library names and outputs a list of dependencies
530 sub compute_lib_depends {
531 if ($disabled{shared}) {
532 return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_;
534 return map { $_ =~ /\.a$/
536 : $unified_info{sharednames}->{$_}.".EXE" } @_;
541 my $generator = join(" ", @{$args{generator}});
542 my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
543 my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
545 if ($args{src} !~ /\.[sS]$/) {
546 if ($args{generator}->[0] =~ m|^.*\.in$|) {
547 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
548 "util", "dofile.pl")),
549 rel2abs($config{builddir}));
551 $args{src} : $args{generator}->[0] $deps
552 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
553 "-o$target{build_file}" $generator > \$@
557 $args{src} : $args{generator}->[0] $deps
558 \$(PERL)$generator_incs $generator > \$@
562 die "No method to generate assembler source present.\n";
568 my $obj = $args{obj};
569 my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
571 # Because VMS C isn't very good at combining a /INCLUDE path with
572 # #includes having a relative directory (like '#include "../foo.h"),
573 # the best choice is to move to the first source file's intended
574 # directory before compiling, and make sure to write the object file
575 # in the correct position (important when the object tree is other
576 # than the source tree).
577 my $forward = dirname($args{srcs}->[0]);
578 my $backward = abs2rel(rel2abs("."), rel2abs($forward));
579 my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
580 my $objn = basename($obj);
583 map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
585 if ($args{installed}) {
586 $ecflags = { lib => '$(LIB_CFLAGS)',
587 dso => '$(DSO_CFLAGS)',
588 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
590 $ecflags = { lib => '$(NO_INST_LIB_CFLAGS)',
591 dso => '$(NO_INST_DSO_CFLAGS)',
592 bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
594 my $incs_on = "\@ !";
595 my $incs_off = "\@ !";
598 push @incs, @{$args{incs}} if @{$args{incs}};
599 unless ($disabled{zlib}) {
600 # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
602 push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
606 "DEFINE tmp_includes "
607 .join(",-\n\t\t\t", map {
608 file_name_is_absolute($_)
609 ? $_ : catdir($backward,$_)
611 $incs_off = "DEASSIGN tmp_includes";
612 $incs = " /INCLUDE=(tmp_includes:)";
614 my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
615 my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
616 my $depbuild = $disabled{makedepend} ? ""
617 : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
624 \$(CC) \$(CFLAGS)${ecflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
626 SET DEFAULT $backward
628 \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
629 RENAME $obj.tmp-D $obj.d )
630 \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
636 my $lib = $args{lib};
637 my $shlib = $args{shlib};
638 my $libd = dirname($lib);
639 my $libn = basename($lib);
640 (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib([^0-9]*)\d*/$1/i;
641 my @deps = compute_lib_depends(@{$args{deps}});
642 my $deps = join(", -\n\t\t", @deps);
643 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
644 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
645 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
646 "VMS", "engine.opt")),
647 rel2abs($config{builddir}));
648 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
649 "util", "mkdef.pl")),
650 rel2abs($config{builddir}));
651 my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
652 "VMS", "translatesyms.pl")),
653 rel2abs($config{builddir}));
654 # The "[]" hack is because in .OPT files, each line inherits the
655 # previous line's file spec as default, so if no directory spec
656 # is present in the current line and the previous line has one that
657 # doesn't apply, you're in for a surprise.
659 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
660 $x =~ s|(\.EXE)|$1/SHARE|;
661 $x =~ s|(\.OLB)|$1/LIB|;
662 "WRITE OPT_FILE \"$x\"" } @deps)
665 $shlib.EXE : $lib.OLB $deps $ordinalsfile
666 \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
667 \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
668 DELETE $shlib.SYMVEC-tmp;*
669 OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
670 WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
671 TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
672 WRITE OPT_FILE "$lib.OLB/LIBRARY"
675 LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS)
676 DELETE $shlib.SYMVEC;*
677 PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
682 my $lib = $args{lib};
683 my $libd = dirname($lib);
684 my $libn = basename($lib);
685 (my $libn_nolib = $libn) =~ s/^lib//;
686 my @objs = map { "$_.OBJ" } @{$args{objs}};
687 my @deps = compute_lib_depends(@{$args{deps}});
688 my $deps = join(", -\n\t\t", @objs, @deps);
689 my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
690 my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
691 "VMS", "engine.opt")),
692 rel2abs($config{builddir}));
693 # The "[]" hack is because in .OPT files, each line inherits the
694 # previous line's file spec as default, so if no directory spec
695 # is present in the current line and the previous line has one that
696 # doesn't apply, you're in for a surprise.
698 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
699 "WRITE OPT_FILE \"$x" } @objs).
702 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
703 $x =~ s|(\.EXE)|$1/SHARE|;
704 $x =~ s|(\.OLB)|$1/LIB|;
705 "WRITE OPT_FILE \"$x\"" } @deps)
709 OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
710 TYPE $engine_opt /OUTPUT=OPT_FILE:
714 LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS)
715 - PURGE $lib.EXE,$lib.OPT,$lib.MAP
720 my $lib = $args{lib};
721 my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
722 my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
726 LIBRARY/CREATE/OBJECT $lib.OLB
733 my $bin = $args{bin};
734 my $bind = dirname($bin);
735 my $binn = basename($bin);
736 my @objs = map { "$_.OBJ" } @{$args{objs}};
737 my @deps = compute_lib_depends(@{$args{deps}});
738 my $deps = join(", -\n\t\t", @objs, @deps);
739 # The "[]" hack is because in .OPT files, each line inherits the
740 # previous line's file spec as default, so if no directory spec
741 # is present in the current line and the previous line has one that
742 # doesn't apply, you're in for a surprise.
744 join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
745 "WRITE OPT_FILE \"$x" } @objs).
748 join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
749 $x =~ s|(\.EXE)|$1/SHARE|;
750 $x =~ s|(\.OLB)|$1/LIB|;
751 "WRITE OPT_FILE \"$x\"" } @deps)
753 # The linking commands looks a bit complex, but it's for good reason.
754 # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
755 # bar.obj happens to have a symbol that also exists in libsomething.exe,
756 # the linker will warn about it, loudly, and will then choose to pick
757 # the first copy encountered (the one in bar.obj in this example).
758 # On Unix and on Windows, the corresponding maneuvre goes through
759 # silently with the same effect.
760 # With some test programs, made for checking the internals of OpenSSL,
761 # we do this kind of linking deliberately, picking a few specific object
762 # files from within [.crypto] or [.ssl] so we can reach symbols that are
763 # otherwise unreachable (since the shareable images only exports the
764 # symbols listed in [.util]*.num), and then with the shared libraries
765 # themselves. So we need to silence the warning about multiply defined
766 # symbols, to mimic the way linking work on Unix and Windows, and so
767 # the build isn't interrupted (MMS stops when warnings are signaled,
768 # by default), and so someone building doesn't have to worry where it
769 # isn't necessary. If there are other warnings, however, we show them
770 # and let it break the build.
773 OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
777 - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG -
778 LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS) ; -
779 link_status = \$status ; link_severity = link_status .AND. 7
780 @ search_severity = 1
781 -@ IF link_severity .EQ. 0 THEN -
782 pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | -
783 SPAWN/WAIT/NOLOG/OUT=NLA0: -
784 SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
785 search_severity = \$severity
786 @ ! search_severity is 3 when the last search didn't find any matching
787 @ ! string: %SEARCH-I-NOMATCHES, no strings matched
788 @ ! If that was the result, we pretend linking got through without
789 @ ! fault or warning.
790 @ IF search_severity .EQ. 3 THEN link_severity = 1
791 @ ! At this point, if link_severity shows that there was a fault
792 @ ! or warning, make sure to restore the linking status.
793 -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG
794 -@ DELETE $bin.LINKLOG;*
795 @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
796 - PURGE $bin.EXE,$bin.OPT
801 my $script = $args{script};
802 return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
803 my $sources = join(" ", @{$args{sources}});
804 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
805 "util", "dofile.pl")),
806 rel2abs($config{builddir}));
809 \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
810 "-o$target{build_file}" $sources > $script
811 SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
815 "" # Important! This becomes part of the template result.