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