Efence is antiquated, remove all traces of using it
[openssl.git] / Configurations / descrip.mms.tmpl
1 ## descrip.mms to build OpenSSL on OpenVMS
2 ##
3 ## {- join("\n## ", @autowarntext) -}
4 {-
5   use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
6
7   # Our prefix, claimed when speaking with the VSI folks Tuesday
8   # January 26th 2016
9   our $osslprefix = 'OSSL$';
10   (our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/;
11
12   our $sover = sprintf "%02d%02d", $config{shlib_major}, $config{shlib_minor};
13   our $osslver = sprintf "%02d%02d", split(/\./, $config{version});
14
15   our $sourcedir = $config{sourcedir};
16   our $builddir = $config{builddir};
17   sub sourcefile {
18       catfile($sourcedir, @_);
19   }
20   sub buildfile {
21       catfile($builddir, @_);
22   }
23   sub sourcedir {
24       catdir($sourcedir, @_);
25   }
26   sub builddir {
27       catdir($builddir, @_);
28   }
29   sub tree {
30       (my $x = shift) =~ s|\]$|...]|;
31       $x
32   }
33   sub move {
34       my $f = catdir(@_);
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);
40       "";
41   }
42
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}} ) );
52
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}
62           = qq(deassign arch);
63   }
64   my $sd1 = sourcedir("ssl","record");
65   my $sd2 = sourcedir("ssl","statem");
66   $unified_info{before}->{"[.test]heartbeat_test.OBJ"}
67       = $unified_info{before}->{"[.test]ssltest_old.OBJ"}
68       = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
69         define record 'record_include'
70         statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
71         define statem 'statem_include');
72   $unified_info{after}->{"[.test]heartbeat_test.OBJ"}
73       = $unified_info{after}->{"[.test]ssltest.OBJ"}
74       = qq(deassign statem
75         deassign record);
76   foreach (grep /^\[\.ssl\.(?:record|statem)\].*\.o$/, keys %{$unified_info{sources}}) {
77       (my $x = $_) =~ s|\.o$|.OBJ|;
78       $unified_info{before}->{$x}
79           = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;"
80         define record 'record_include'
81         statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;"
82         define statem 'statem_include');
83       $unified_info{after}->{$x}
84           = qq(deassign statem
85         deassign record);
86   }
87   #use Data::Dumper;
88   #print STDERR "DEBUG: before:\n", Dumper($unified_info{before});
89   #print STDERR "DEBUG: after:\n", Dumper($unified_info{after});
90   "";
91 -}
92 PLATFORM={- $config{target} -}
93 OPTIONS={- $config{options} -}
94 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
95 SRCDIR={- $config{sourcedir} -}
96 BLDDIR={- $config{builddir} -}
97
98 # Allow both V and VERBOSE to indicate verbosity.  This only applies
99 # to testing.
100 VERBOSE=$(V)
101
102 VERSION={- $config{version} -}
103 MAJOR={- $config{major} -}
104 MINOR={- $config{minor} -}
105 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
106 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
107 SHLIB_MAJOR={- $config{shlib_major} -}
108 SHLIB_MINOR={- $config{shlib_minor} -}
109 SHLIB_TARGET={- $target{shared_target} -}
110
111 EXE_EXT=.EXE
112 LIB_EXT=.OLB
113 SHLIB_EXT=.EXE
114 OBJ_EXT=.OBJ
115 DEP_EXT=.D
116
117 LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{libraries}}) -}
118 SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
119 ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -}
120 PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
121 SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
122 {- output_off() if $disabled{makedepend}; "" -}
123 DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; }
124                     grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
125                     keys %{$unified_info{sources}};
126         join(", ", map { "-\n\t".$_ } @deps); -}
127 {- output_on() if $disabled{makedepend}; "" -}
128 GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
129 GENERATED={- join(", ", map { "-\n\t".$_ } @generated) -}
130
131 INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @{$unified_info{install}->{libraries}}) -}
132 INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
133 INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -}
134 INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -}
135 {- output_off() if $disabled{apps}; "" -}
136 BIN_SCRIPTS=[.tools]c_rehash.pl
137 MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl
138 {- output_on() if $disabled{apps}; "" -}
139
140 # DESTDIR is for package builders so that they can configure for, say,
141 # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
142 # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
143 # MMS with /MACROS=(DESTDIR=STAGING:[USER]).  The result will end up in
144 # STAGING:[USER.OPENSSL].
145 # Normally it is left empty.
146 DESTDIR=
147
148 # Do not edit this manually. Use Configure --prefix=DIR to change this!
149 INSTALLTOP={- our $installtop =
150                   catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
151               $installtop -}
152 SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
153 # This is the standard central area to store certificates, private keys...
154 OPENSSLDIR={- catdir($config{openssldir}) or
155               $config{prefix} ? catdir($config{prefix},"COMMON")
156                               : "SYS\$COMMON:[OPENSSL-COMMON]" -}
157 # The same, but for C
158 OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000]
159 # Where installed engines reside, for C
160 ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover.$target{pointer_size} -}:
161
162 CC= {- $target{cc} -}
163 CFLAGS= /DEFINE=({- join(",", @{$target{defines}}, @{$config{defines}},"OPENSSLDIR=\"\"\"\$(OPENSSLDIR_C)\"\"\"","ENGINESDIR=\"\"\"\$(ENGINESDIR_C)\"\"\"") -}) {- $target{cflags} -} {- $config{cflags} -}
164 CFLAGS_Q=$(CFLAGS)
165 DEPFLAG= /DEFINE=({- join(",", @{$config{depdefines}}) -})
166 LDFLAGS= {- $target{lflags} -}
167 EX_LIBS= {- $target{ex_libs} ? ",".$target{ex_libs} : "" -}{- $config{ex_libs} ? ",".$config{ex_libs} : "" -}
168 LIB_CFLAGS={- $target{lib_cflags} || "" -}
169 DSO_CFLAGS={- $target{dso_cflags} || "" -}
170 BIN_CFLAGS={- $target{bin_cflags} || "" -}
171 NO_INST_LIB_CFLAGS={- $target{no_inst_lib_cflags} || '$(LIB_CFLAGS)' -}
172 NO_INST_DSO_CFLAGS={- $target{no_inst_dso_cflags} || '$(DSO_CFLAGS)' -}
173 NO_INST_BIN_CFLAGS={- $target{no_inst_bin_cflags} || '$(BIN_CFLAGS)' -}
174
175 PERL={- $config{perl} -}
176
177 # We let the C compiler driver to take care of .s files. This is done in
178 # order to be excused from maintaining a separate set of architecture
179 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
180 # gcc, then the driver will automatically translate it to -xarch=v8plus
181 # and pass it down to assembler.
182 AS={- $target{as} -}
183 ASFLAG={- $target{asflags} -}
184
185 # .FIRST and .LAST are special targets with MMS and MMK.
186 # The defines in there are for C.  includes that look like
187 # this:
188 #
189 #    #include <openssl/foo.h>
190 #    #include "internal/bar.h"
191 #
192 # will use the logical names to find the files.  Expecting
193 # DECompHP C to find files in subdirectories of whatever was
194 # given with /INCLUDE is a fantasy, unfortunately.
195 NODEBUG=@
196 .FIRST :
197         $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
198         $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
199         $(NODEBUG) internal_inc1 = F$PARSE("[.crypto.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;"
200         $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
201         $(NODEBUG) internal_inc3 = F$PARSE("{- catdir($config{sourcedir},"[.crypto.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;"
202         $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
203         $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2','internal_inc3'
204         $(NODEBUG) staging_dir = "$(DESTDIR)"
205         $(NODEBUG) staging_instdir = ""
206         $(NODEBUG) staging_datadir = ""
207         $(NODEBUG) IF staging_dir .NES. "" THEN -
208                 staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
209         $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
210                 staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
211         $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
212                 staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
213         $(NODEBUG) IF staging_dir .NES. "" THEN -
214                 staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
215         $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
216                 staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
217         $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
218                 staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
219         $(NODEBUG) !
220         $(NODEBUG) ! Installation logical names
221         $(NODEBUG) !
222         $(NODEBUG) installtop = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
223         $(NODEBUG) datatop = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
224         $(NODEBUG) DEFINE ossl_installroot 'installtop'
225         $(NODEBUG) DEFINE ossl_dataroot 'datatop'
226         $(NODEBUG) !
227         $(NODEBUG) ! Figure out the architecture
228         $(NODEBUG) !
229         $(NODEBUG) arch == f$edit( f$getsyi( "arch_name"), "upcase")
230         $(NODEBUG) !
231         $(NODEBUG) ! Set up logical names for the libraries, so LINK and
232         $(NODEBUG) ! running programs can use them.
233         $(NODEBUG) !
234         $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
235
236 .LAST :
237         $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) || "!" -}
238         $(NODEBUG) DEASSIGN ossl_dataroot
239         $(NODEBUG) DEASSIGN ossl_installroot
240         $(NODEBUG) DEASSIGN internal
241         $(NODEBUG) DEASSIGN openssl
242 .DEFAULT :
243         @ ! MMS cannot handle no actions...
244
245 # The main targets ###################################################
246
247 all : build_generated, -
248       build_libs_nodep, build_engines_nodep, build_programs_nodep, -
249       depend
250
251 build_libs : build_generated, build_libs_nodep, depend
252 build_libs_nodep : $(LIBS), $(SHLIBS)
253 build_engines : build_generated, build_engines_nodep, depend
254 build_engines_nodep : $(ENGINES)
255 build_programs : build_generated, build_programs_nodep, depend
256 build_programs_nodep : $(PROGRAMS), $(SCRIPTS)
257
258 build_generated : $(GENERATED_MANDATORY)
259
260 # Kept around for backward compatibility
261 build_apps build_tests : build_programs
262
263 test tests : build_generated, build_programs_nodep, build_engines_nodep, -
264              depend
265         @ ! {- output_off() if $disabled{tests}; "" -}
266         SET DEFAULT [.test]{- move("test") -}
267         DEFINE SRCTOP {- sourcedir() -}
268         DEFINE BLDTOP {- builddir() -}
269         DEFINE OPENSSL_ENGINES {- builddir("engines") -}
270         IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
271         $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
272         DEASSIGN OPENSSL_ENGINES
273         DEASSIGN BLDTOP
274         DEASSIGN SRCTOP
275         SET DEFAULT [-]{- move("..") -}
276         @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
277         @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
278         @ ! {- output_on() if !$disabled{tests}; "" -}
279
280 list-tests :
281         @ ! {- output_off() if $disabled{tests}; "" -}
282         @ DEFINE SRCTOP {- sourcedir() -}
283         @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
284         @ DEASSIGN SRCTOP
285         @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
286         @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
287         @ ! {- output_on() if !$disabled{tests}; "" -}
288
289 install : install_sw install_ssldirs install_docs
290         @ WRITE SYS$OUTPUT ""
291         @ WRITE SYS$OUTPUT "######################################################################"
292         @ WRITE SYS$OUTPUT ""
293         @ IF "$(DESTDIR)" .EQS. "" THEN -
294              PIPE ( WRITE SYS$OUTPUT "Installation complete" ; -
295                     WRITE SYS$OUTPUT "" ; -
296                     WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
297                     WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
298                     WRITE SYS$OUTPUT "" )
299         @ IF "$(DESTDIR)" .NES. "" THEN -
300              PIPE ( WRITE SYS$OUTPUT "Staging installation complete" ; -
301                     WRITE SYS$OUTPUT "" ; -
302                     WRITE SYS$OUTPUT "Finish or package in such a way that the contents of the directory tree" ; -
303                     WRITE SYS$OUTPUT staging_instdir ; -
304                     WRITE SYS$OUTPUT "ends up in $(INSTALLTOP)," ; -
305                     WRITE SYS$OUTPUT "and that the contents of the contents of the directory tree" ; -
306                     WRITE SYS$OUTPUT staging_datadir ; -
307                     WRITE SYS$OUTPUT "ends up in $(OPENSSLDIR)" ; -
308                     WRITE SYS$OUTPUT "" ; -
309                     WRITE SYS$OUTPUT "When in its final destination," ; -
310                     WRITE SYS$OUTPUT "Run @$(SYSTARTUP)openssl_startup{- $osslver -} to set up logical names" ; -
311                     WRITE SYS$OUTPUT "then run @$(SYSTARTUP)openssl_utils{- $osslver -} to define commands" ; -
312                     WRITE SYS$OUTPUT "" )
313
314 check_install :
315         spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
316
317 uninstall : uninstall_docs uninstall_sw
318
319 # Because VMS wants the generation number (or *) to delete files, we can't
320 # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly.
321 libclean :
322         {- join("\n\t", map { "- DELETE $_.OLB;*" } @{$unified_info{libraries}}) || "@ !" -}
323         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*,$_.OPT;*" } @shlibs) || "@ !" -}
324
325 clean : libclean
326         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
327         {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -}
328         {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
329         {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
330         - DELETE [...]*.MAP;*
331         - DELETE [...]*.D;*
332         - DELETE [...]*.OBJ;*,*.LIS;*
333         - DELETE []CXX$DEMANGLER_DB.;*
334         - DELETE [.VMS]openssl_startup.com;*
335         - DELETE [.VMS]openssl_shutdown.com;*
336         - DELETE []vmsconfig.pm;*
337
338 distclean : clean
339         - DELETE configdata.pm;*
340         - DELETE descrip.mms;*
341
342 depend : descrip.mms
343 descrip.mms : FORCE
344         @ ! {- output_off() if $disabled{makedepend}; "" -}
345         @ $(PERL) -pe "if (/^# DO NOT DELETE.*/) { exit(0); }" -
346                 < descrip.mms > descrip.mms-new
347         @ OPEN/APPEND DESCRIP descrip.mms-new
348         @ WRITE DESCRIP "# DO NOT DELETE THIS LINE -- make depend depends on it."
349         {- join("\n\t", map { "\@ IF F\$SEARCH(\"$_\") .NES. \"\" THEN TYPE $_ /OUTPUT=DESCRIP:" } @deps); -}
350         @ CLOSE DESCRIP
351         @ PIPE ( $(PERL) -e "use File::Compare qw/compare_text/; my $x = compare_text(""descrip.mms"",""descrip.mms-new""); exit(0x10000000 + ($x == 0));" || -
352                  RENAME descrip.mms-new descrip.mms )
353         @ IF F$SEARCH("descrip.mms-new") .NES. "" THEN DELETE descrip.mms-new;*
354         -@ SPAWN/OUTPUT=NLA0: PURGE/NOLOG descrip.mms
355         @ ! {- output_on() if $disabled{makedepend}; "" -}
356
357 # Install helper targets #############################################
358
359 install_sw : all install_shared _install_dev_ns -
360              install_engines _install_runtime_ns -
361              install_startup install_ivp
362
363 uninstall_sw : uninstall_shared _uninstall_dev_ns -
364                uninstall_engines _uninstall_runtime_ns -
365                uninstall_startup uninstall_ivp
366
367 install_docs : install_html_docs
368
369 uninstall_docs : uninstall_html_docs
370
371 install_ssldirs : check_INSTALLTOP
372         - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
373         IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
374                 CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
375         IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
376                 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
377         IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
378                 CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
379         COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
380         @ ! Install configuration file
381         COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
382                 ossl_dataroot:[000000]openssl.cnf-dist
383         IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
384                 COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
385                         ossl_dataroot:[000000]openssl.cnf
386         @ ! Install CTLOG configuration file
387         COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
388                 ossl_dataroot:[000000]ct_log_list.cnf-dist
389         IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
390                 COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
391                         ossl_dataroot:[000000]ct_log_list.cnf
392
393 install_shared : check_INSTALLTOP
394         @ {- output_off() if $disabled{shared}; "" -} !
395         @ WRITE SYS$OUTPUT "*** Installing shareable images"
396         @ ! Install shared (runtime) libraries
397         - CREATE/DIR ossl_installroot:[LIB.'arch']
398         {- join("\n        ",
399                 map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
400                 @install_shlibs) -}
401         @ {- output_on() if $disabled{shared}; "" -} !
402
403 _install_dev_ns : check_INSTALLTOP
404         @ WRITE SYS$OUTPUT "*** Installing development files"
405         @ ! Install header files
406         - CREATE/DIR ossl_installroot:[include.openssl]
407         COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl]
408         @ ! Install static (development) libraries
409         - CREATE/DIR ossl_installroot:[LIB.'arch']
410         {- join("\n        ",
411                 map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
412                 @{$unified_info{install}->{libraries}}) -}
413
414 install_dev : install_shared _install_dev_ns
415
416 _install_runtime_ns : check_INSTALLTOP
417         @ ! Install the main program
418         - CREATE/DIR ossl_installroot:[EXE.'arch']
419         COPY/PROT=W:RE [.APPS]openssl.EXE -
420                 ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
421         @ ! Install scripts
422         COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
423         @ ! {- output_on() if $disabled{apps}; "" -}
424
425 install_runtime : install_shared _install_runtime_ns
426
427 install_engines : check_INSTALLTOP
428         @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} !
429         @ WRITE SYS$OUTPUT "*** Installing engines"
430         - CREATE/DIR ossl_installroot:[ENGINES{- $sover.$target{pointer_size} -}.'arch']
431         {- join("\n        ",
432                 map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover$target{pointer_size}.'arch']" }
433                 @{$unified_info{install}->{engines}}) -}
434         @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} !
435
436 install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
437                  [.VMS]openssl_utils.com, check_INSTALLTOP
438         - CREATE/DIR ossl_installroot:[SYS$STARTUP]
439         COPY/PROT=W:RE [.VMS]openssl_startup.com -
440                 ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
441         COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
442                 ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
443         COPY/PROT=W:RE [.VMS]openssl_utils.com -
444                 ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
445
446 install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
447         - CREATE/DIR ossl_installroot:[SYSTEST]
448         COPY/PROT=W:RE [.VMS]openssl_ivp.com -
449                 ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
450
451 [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
452         - CREATE/DIR [.VMS]
453         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
454                 {- sourcefile("VMS", "openssl_startup.com.in") -} -
455                 > [.VMS]openssl_startup.com
456
457 [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
458         - CREATE/DIR [.VMS]
459         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
460                 {- sourcefile("VMS", "openssl_utils.com.in") -} -
461                 > [.VMS]openssl_utils.com
462
463 [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
464         - CREATE/DIR [.VMS]
465         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
466                 {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
467                 > [.VMS]openssl_shutdown.com
468
469 [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
470         - CREATE/DIR [.VMS]
471         $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
472                 {- sourcefile("VMS", "openssl_ivp.com.in") -} -
473                 > [.VMS]openssl_ivp.com
474
475 vmsconfig.pm : configdata.pm
476         OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
477         WRITE CONFIG "package vmsconfig;"
478         WRITE CONFIG "use strict; use warnings;"
479         WRITE CONFIG "use Exporter;"
480         WRITE CONFIG "our @ISA = qw(Exporter);"
481         WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
482         WRITE CONFIG "our %config = ("
483         WRITE CONFIG "  target => '","{- $config{target} -}","',"
484         WRITE CONFIG "  version => '","{- $config{version} -}","',"
485         WRITE CONFIG "  shlib_major => '","{- $config{shlib_major} -}","',"
486         WRITE CONFIG "  shlib_minor => '","{- $config{shlib_minor} -}","',"
487         WRITE CONFIG "  no_shared => '","{- $disabled{shared} -}","',"
488         WRITE CONFIG "  INSTALLTOP => '$(INSTALLTOP)',"
489         WRITE CONFIG "  OPENSSLDIR => '$(OPENSSLDIR)',"
490         WRITE CONFIG "  pointer_size => '","{- $target{pointer_size} -}","',"
491         WRITE CONFIG ");"
492         WRITE CONFIG "our %target = ();"
493         WRITE CONFIG "our %disabled = ();"
494         WRITE CONFIG "our %withargs = ();"
495         WRITE CONFIG "our %unified_info = ();"
496         WRITE CONFIG "1;"
497         CLOSE CONFIG
498
499 install_html_docs : check_INSTALLTOP
500         sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]"
501         $(PERL) {- sourcefile("util", "process_docs.pl") -} -
502                 --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] -
503                 --type=html
504
505 check_INSTALLTOP :
506         @ IF "$(INSTALLTOP)" .EQS. "" THEN -
507                 WRITE SYS$ERROR "INSTALLTOP should not be empty"
508         @ IF "$(INSTALLTOP)" .EQS. "" THEN -
509                 EXIT %x10000002
510
511 # Helper targets #####################################################
512
513 # Developer targets ##################################################
514
515 debug_logicals :
516         SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
517
518 # Building targets ###################################################
519
520 configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
521         @ WRITE SYS$OUTPUT "Reconfiguring..."
522         perl $(SRCDIR)Configure reconf
523         @ WRITE SYS$OUTPUT "*************************************************"
524         @ WRITE SYS$OUTPUT "***                                           ***"
525         @ WRITE SYS$OUTPUT "***   Please run the same mms command again   ***"
526         @ WRITE SYS$OUTPUT "***                                           ***"
527         @ WRITE SYS$OUTPUT "*************************************************"
528         @ PIPE ( EXIT %X10000000 )
529
530 {-
531   use File::Basename;
532   use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
533
534   sub generatesrc {
535       my %args = @_;
536       my $generator = join(" ", @{$args{generator}});
537       my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
538       my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}});
539
540       if ($args{src} !~ /\.[sS]$/) {
541           if ($args{generator}->[0] =~ m|^.*\.in$|) {
542               my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
543                                                    "util", "dofile.pl")),
544                                    rel2abs($config{builddir}));
545               return <<"EOF";
546 $args{src} : $args{generator}->[0] $deps
547         \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\
548             "-o$target{build_file}" $generator > \$@
549 EOF
550           } else {
551               return <<"EOF";
552 $args{src} : $args{generator}->[0] $deps
553         \$(PERL)$generator_incs $generator > \$@
554 EOF
555           }
556       } else {
557           die "No method to generate assembler source present.\n";
558       }
559   }
560
561   sub src2obj {
562       my %args = @_;
563       my $obj = $args{obj};
564       my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
565
566       # Because VMS C isn't very good at combining a /INCLUDE path with
567       # #includes having a relative directory (like '#include "../foo.h"),
568       # the best choice is to move to the first source file's intended
569       # directory before compiling, and make sure to write the object file
570       # in the correct position (important when the object tree is other
571       # than the source tree).
572       my $forward = dirname($args{srcs}->[0]);
573       my $backward = abs2rel(rel2abs("."), rel2abs($forward));
574       my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
575       my $objn = basename($obj);
576       my $srcs =
577           join(", ",
578                map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
579       my $ecflags;
580       if ($args{installed}) {
581           $ecflags = { lib => '$(LIB_CFLAGS)',
582                        dso => '$(DSO_CFLAGS)',
583                        bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
584       } else {
585           $ecflags = { lib => '$(NO_INST_LIB_CFLAGS)',
586                        dso => '$(NO_INST_DSO_CFLAGS)',
587                        bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}};
588       }
589       my $incs_on = "\@ !";
590       my $incs_off = "\@ !";
591       my $incs = "";
592       my @incs = ();
593       push @incs, @{$args{incs}} if @{$args{incs}};
594       unless ($disabled{zlib}) {
595           # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
596           # incarnations.
597           push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
598       }
599       if (@incs) {
600           $incs_on =
601               "DEFINE tmp_includes "
602               .join(",-\n\t\t\t", map {
603                                       file_name_is_absolute($_)
604                                       ? $_ : catdir($backward,$_)
605                                   } @incs);
606           $incs_off = "DEASSIGN tmp_includes";
607           $incs = " /INCLUDE=(tmp_includes:)";
608       }
609       my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !";
610       my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
611       my $depbuild = $disabled{makedepend} ? ""
612           : " /MMS=(FILE=${objd}${objn}.tmp-D,TARGET=$obj.OBJ)";
613
614       return <<"EOF";
615 $obj.OBJ : $deps
616         ${before}
617         SET DEFAULT $forward
618         $incs_on
619         \$(CC) \$(CFLAGS)${ecflags}${incs}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
620         $incs_off
621         SET DEFAULT $backward
622         ${after}
623         \@ PIPE ( \$(PERL) -e "use File::Compare qw/compare_text/; my \$x = compare_text(""$obj.D"",""$obj.tmp-D""); exit(0x10000000 + (\$x == 0));" || -
624                  RENAME $obj.tmp-D $obj.d )
625         \@ IF F\$SEARCH("$obj.tmp-D") .NES. "" THEN DELETE $obj.tmp-D;*
626         - PURGE $obj.OBJ
627 EOF
628   }
629   sub libobj2shlib {
630       my %args = @_;
631       my $lib = $args{lib};
632       my $shlib = $args{shlib};
633       my $libd = dirname($lib);
634       my $libn = basename($lib);
635       (my $mkdef_key = $libn) =~ s/^${osslprefix_q}lib([^0-9]*)\d*/$1/i;
636       my @deps = map {
637           $disabled{shared} ? $_.".OLB"
638               : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
639       my $deps = join(", -\n\t\t", @deps);
640       my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
641       my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
642       my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
643                                                "VMS", "engine.opt")),
644                                rel2abs($config{builddir}));
645       my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
646                                              "util", "mkdef.pl")),
647                              rel2abs($config{builddir}));
648       my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
649                                                      "VMS", "translatesyms.pl")),
650                                      rel2abs($config{builddir}));
651       # The "[]" hack is because in .OPT files, each line inherits the
652       # previous line's file spec as default, so if no directory spec
653       # is present in the current line and the previous line has one that
654       # doesn't apply, you're in for a surprise.
655       my $write_opt =
656           join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
657                              $x =~ s|(\.EXE)|$1/SHARE|;
658                              $x =~ s|(\.OLB)|$1/LIB|;
659                              "WRITE OPT_FILE \"$x\"" } @deps)
660           || "\@ !";
661       return <<"EOF";
662 $shlib.EXE : $lib.OLB $deps $ordinalsfile
663         \$(PERL) $mkdef_pl "$mkdef_key" "VMS" > $shlib.SYMVEC-tmp
664         \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $shlib.SYMVEC-tmp > $shlib.SYMVEC
665         DELETE $shlib.SYMVEC-tmp;*
666         OPEN/WRITE/SHARE=READ OPT_FILE $shlib.OPT
667         WRITE OPT_FILE "IDENTIFICATION=""V$config{version}"""
668         TYPE $shlib.SYMVEC /OUTPUT=OPT_FILE:
669         WRITE OPT_FILE "$lib.OLB/LIBRARY"
670         $write_opt
671         CLOSE OPT_FILE
672         LINK /MAP=$shlib.MAP /FULL/SHARE=$shlib.EXE $shlib.OPT/OPT \$(EX_LIBS)
673         DELETE $shlib.SYMVEC;*
674         PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
675 EOF
676   }
677   sub obj2dso {
678       my %args = @_;
679       my $lib = $args{lib};
680       my $libd = dirname($lib);
681       my $libn = basename($lib);
682       (my $libn_nolib = $libn) =~ s/^lib//;
683       my @objs = map { "$_.OBJ" } @{$args{objs}};
684       my @deps = map {
685           $disabled{shared} ? $_.".OLB"
686               : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
687       my $deps = join(", -\n\t\t", @objs, @deps);
688       my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
689       my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir},
690                                                "VMS", "engine.opt")),
691                                rel2abs($config{builddir}));
692       # The "[]" hack is because in .OPT files, each line inherits the
693       # previous line's file spec as default, so if no directory spec
694       # is present in the current line and the previous line has one that
695       # doesn't apply, you're in for a surprise.
696       my $write_opt1 =
697           join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
698                                  "WRITE OPT_FILE \"$x" } @objs).
699           "\"";
700       my $write_opt2 =
701           join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
702                              $x =~ s|(\.EXE)|$1/SHARE|;
703                              $x =~ s|(\.OLB)|$1/LIB|;
704                              "WRITE OPT_FILE \"$x\"" } @deps)
705           || "\@ !";
706       return <<"EOF";
707 $lib.EXE : $deps
708         OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT
709         TYPE $engine_opt /OUTPUT=OPT_FILE:
710         $write_opt1
711         $write_opt2
712         CLOSE OPT_FILE
713         LINK /MAP=$lib.MAP /FULL/SHARE=$lib.EXE $lib.OPT/OPT \$(EX_LIBS)
714         - PURGE $lib.EXE,$lib.OPT,$lib.MAP
715 EOF
716   }
717   sub obj2lib {
718       my %args = @_;
719       my $lib = $args{lib};
720       my $objs = join(", -\n\t\t", map { $_.".OBJ" } (@{$args{objs}}));
721       my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_.OBJ" }
722                                     @{$args{objs}}));
723       return <<"EOF";
724 $lib.OLB : $objs
725         LIBRARY/CREATE/OBJECT $lib.OLB
726         $fill_lib
727         - PURGE $lib.OLB
728 EOF
729   }
730   sub obj2bin {
731       my %args = @_;
732       my $bin = $args{bin};
733       my $bind = dirname($bin);
734       my $binn = basename($bin);
735       my @objs = map { "$_.OBJ" } @{$args{objs}};
736       my @deps = map {
737           $disabled{shared} ? $_.".OLB"
738               : $unified_info{sharednames}->{$_}.".EXE"; } @{$args{deps}};
739       my $deps = join(", -\n\t\t", @objs, @deps);
740       # The "[]" hack is because in .OPT files, each line inherits the
741       # previous line's file spec as default, so if no directory spec
742       # is present in the current line and the previous line has one that
743       # doesn't apply, you're in for a surprise.
744       my $write_opt1 =
745           join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
746                                  "WRITE OPT_FILE \"$x" } @objs).
747           "\"";
748       my $write_opt2 =
749           join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
750                              $x =~ s|(\.EXE)|$1/SHARE|;
751                              $x =~ s|(\.OLB)|$1/LIB|;
752                              "WRITE OPT_FILE \"$x\"" } @deps)
753           || "\@ !";
754       return <<"EOF";
755 $bin.EXE : $deps
756         OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT
757         $write_opt1
758         $write_opt2
759         CLOSE OPT_FILE
760         LINK/EXEC=$bin.EXE \$(LDFLAGS) $bin.OPT/OPT \$(EX_LIBS)
761         - PURGE $bin.EXE,$bin.OPT
762 EOF
763   }
764   sub in2script {
765       my %args = @_;
766       my $script = $args{script};
767       return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
768       my $sources = join(" ", @{$args{sources}});
769       my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
770                                            "util", "dofile.pl")),
771                            rel2abs($config{builddir}));
772       return <<"EOF";
773 $script : $sources
774         \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
775             "-o$target{build_file}" $sources > $script
776         SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
777         PURGE $script
778 EOF
779   }
780   ""    # Important!  This becomes part of the template result.
781 -}