1e1051a39Sopenharmony_ci## descrip.mms to build OpenSSL on OpenVMS
2e1051a39Sopenharmony_ci##
3e1051a39Sopenharmony_ci## {- join("\n## ", @autowarntext) -}
4e1051a39Sopenharmony_ci{-
5e1051a39Sopenharmony_ci  use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
6e1051a39Sopenharmony_ci  use File::Basename;
7e1051a39Sopenharmony_ci  use OpenSSL::Util;
8e1051a39Sopenharmony_ci
9e1051a39Sopenharmony_ci  (our $osslprefix_q = platform->osslprefix()) =~ s/\$/\\\$/;
10e1051a39Sopenharmony_ci
11e1051a39Sopenharmony_ci  our $sover_dirname = platform->shlib_version_as_filename();
12e1051a39Sopenharmony_ci  our $osslver = sprintf "%02d", split(/\./, $config{version});
13e1051a39Sopenharmony_ci
14e1051a39Sopenharmony_ci  our $sourcedir = $config{sourcedir};
15e1051a39Sopenharmony_ci  our $builddir = $config{builddir};
16e1051a39Sopenharmony_ci  sub make_unix_path {
17e1051a39Sopenharmony_ci      # Split the native path
18e1051a39Sopenharmony_ci      (my $vol, my $dirs, my $file) = File::Spec->splitpath($_[0]);
19e1051a39Sopenharmony_ci      my @dirs = File::Spec->splitdir($dirs);
20e1051a39Sopenharmony_ci
21e1051a39Sopenharmony_ci      # Reassemble it as a Unix path
22e1051a39Sopenharmony_ci      $vol =~ s|:$||;
23e1051a39Sopenharmony_ci      return File::Spec::Unix->catpath(
24e1051a39Sopenharmony_ci          '', File::Spec::Unix->catdir('', $vol ? $vol : (), @dirs), $file);
25e1051a39Sopenharmony_ci  }
26e1051a39Sopenharmony_ci  sub sourcefile {
27e1051a39Sopenharmony_ci      catfile($sourcedir, @_);
28e1051a39Sopenharmony_ci  }
29e1051a39Sopenharmony_ci  sub buildfile {
30e1051a39Sopenharmony_ci      catfile($builddir, @_);
31e1051a39Sopenharmony_ci  }
32e1051a39Sopenharmony_ci  sub sourcedir {
33e1051a39Sopenharmony_ci      catdir($sourcedir, @_);
34e1051a39Sopenharmony_ci  }
35e1051a39Sopenharmony_ci  sub builddir {
36e1051a39Sopenharmony_ci      catdir($builddir, @_);
37e1051a39Sopenharmony_ci  }
38e1051a39Sopenharmony_ci  sub tree {
39e1051a39Sopenharmony_ci      (my $x = shift) =~ s|\]$|...]|;
40e1051a39Sopenharmony_ci      $x
41e1051a39Sopenharmony_ci  }
42e1051a39Sopenharmony_ci
43e1051a39Sopenharmony_ci  # Because we need to make two computations of these data,
44e1051a39Sopenharmony_ci  # we store them in arrays for reuse
45e1051a39Sopenharmony_ci  our @libs =
46e1051a39Sopenharmony_ci      map { platform->staticname($_) }
47e1051a39Sopenharmony_ci      @{$unified_info{libraries}};
48e1051a39Sopenharmony_ci  our @shlibs =
49e1051a39Sopenharmony_ci      map { platform->sharedname($_) // () }
50e1051a39Sopenharmony_ci      @{$unified_info{libraries}};
51e1051a39Sopenharmony_ci  our @install_libs =
52e1051a39Sopenharmony_ci      map { platform->staticname($_) }
53e1051a39Sopenharmony_ci      grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
54e1051a39Sopenharmony_ci      @{$unified_info{libraries}};
55e1051a39Sopenharmony_ci  our @install_shlibs =
56e1051a39Sopenharmony_ci      map { platform->sharedname($_) // () }
57e1051a39Sopenharmony_ci      grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
58e1051a39Sopenharmony_ci      @{$unified_info{libraries}};
59e1051a39Sopenharmony_ci  our @install_engines =
60e1051a39Sopenharmony_ci      grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
61e1051a39Sopenharmony_ci             && $unified_info{attributes}->{modules}->{$_}->{engine} }
62e1051a39Sopenharmony_ci      @{$unified_info{modules}};
63e1051a39Sopenharmony_ci  our @install_modules =
64e1051a39Sopenharmony_ci      grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
65e1051a39Sopenharmony_ci             && !$unified_info{attributes}->{modules}->{$_}->{engine}
66e1051a39Sopenharmony_ci             && !$unified_info{attributes}->{modules}->{$_}->{fips} }
67e1051a39Sopenharmony_ci      @{$unified_info{modules}};
68e1051a39Sopenharmony_ci  our @install_fipsmodules =
69e1051a39Sopenharmony_ci      grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
70e1051a39Sopenharmony_ci             && $unified_info{attributes}->{modules}->{$_}->{fips} }
71e1051a39Sopenharmony_ci      @{$unified_info{modules}};
72e1051a39Sopenharmony_ci  our @install_programs =
73e1051a39Sopenharmony_ci      grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
74e1051a39Sopenharmony_ci      @{$unified_info{programs}};
75e1051a39Sopenharmony_ci  our @install_bin_scripts =
76e1051a39Sopenharmony_ci      grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
77e1051a39Sopenharmony_ci             && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
78e1051a39Sopenharmony_ci      @{$unified_info{scripts}};
79e1051a39Sopenharmony_ci  our @install_misc_scripts =
80e1051a39Sopenharmony_ci      grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
81e1051a39Sopenharmony_ci             && $unified_info{attributes}->{scripts}->{$_}->{misc} }
82e1051a39Sopenharmony_ci      @{$unified_info{scripts}};
83e1051a39Sopenharmony_ci
84e1051a39Sopenharmony_ci  # Configured flags
85e1051a39Sopenharmony_ci
86e1051a39Sopenharmony_ci  our @cnf_asflags = ($target{asflags} || (), @{$config{asflags}});
87e1051a39Sopenharmony_ci  our @cnf_defines = (@{$target{defines}}, @{$config{defines}});
88e1051a39Sopenharmony_ci  our @cnf_includes = (@{$target{includes}}, @{$config{includes}});
89e1051a39Sopenharmony_ci  our @cnf_cppflags = ($target{cppflags} || (), @{$config{cppflags}});
90e1051a39Sopenharmony_ci  our @cnf_cflags = ($target{cflags} || (), @{$config{cflags}});
91e1051a39Sopenharmony_ci  our @cnf_cxxflags = ($target{cxxflags} || (), @{$config{cxxflags}});
92e1051a39Sopenharmony_ci  our @cnf_ldflags = ($target{lflags} || (), @{$config{lflags}});
93e1051a39Sopenharmony_ci  our @cnf_ex_libs = (map{ ",$_" } @{$target{ex_libs}}, @{$config{ex_libs}});
94e1051a39Sopenharmony_ci
95e1051a39Sopenharmony_ci  # Variables starting with $lib_ are used to build library object files
96e1051a39Sopenharmony_ci  # and shared libraries.
97e1051a39Sopenharmony_ci  # Variables starting with $dso_ are used to build DSOs and their object files.
98e1051a39Sopenharmony_ci  # Variables starting with $bin_ are used to build programs and their object
99e1051a39Sopenharmony_ci  # files.
100e1051a39Sopenharmony_ci
101e1051a39Sopenharmony_ci  # The following array is special and is treated separately from the rest of
102e1051a39Sopenharmony_ci  # the lib_ variables.
103e1051a39Sopenharmony_ci  our @lib_cppincludes = (@{$target{lib_includes}}, @{$target{shared_includes}},
104e1051a39Sopenharmony_ci                          @{$config{lib_includes}}, @{$config{shared_includes}},
105e1051a39Sopenharmony_ci                          @cnf_includes);
106e1051a39Sopenharmony_ci
107e1051a39Sopenharmony_ci  our $lib_cppdefines =
108e1051a39Sopenharmony_ci      join(',', @{$target{lib_defines}}, @{$target{shared_defines}},
109e1051a39Sopenharmony_ci                @{$config{lib_defines}}, @{$config{shared_defines}},
110e1051a39Sopenharmony_ci                @cnf_defines,
111e1051a39Sopenharmony_ci                'OPENSSLDIR="""$(OPENSSLDIR_C)"""',
112e1051a39Sopenharmony_ci                'ENGINESDIR="""$(ENGINESDIR_C)"""',
113e1051a39Sopenharmony_ci                'MODULESDIR="""$(MODULESDIR_C)"""'
114e1051a39Sopenharmony_ci                )
115e1051a39Sopenharmony_ci      . '$(DEFINES)'
116e1051a39Sopenharmony_ci      . "'extradefines'";
117e1051a39Sopenharmony_ci  our $lib_asflags =
118e1051a39Sopenharmony_ci      join(' ', $target{lib_asflags} || (), @{$config{lib_asflags}},
119e1051a39Sopenharmony_ci                @cnf_asflags, '$(ASFLAGS)');
120e1051a39Sopenharmony_ci  our $lib_cppflags =
121e1051a39Sopenharmony_ci      join('', $target{lib_cppflags} || (), $target{shared_cppflags} || (),
122e1051a39Sopenharmony_ci               @{$config{lib_cppflags}}, @{$config{shared_cppflag}},
123e1051a39Sopenharmony_ci               @cnf_cppflags, '/DEFINE=('.$lib_cppdefines.')', '$(CPPFLAGS)');
124e1051a39Sopenharmony_ci  my @lib_cflags = ( $target{lib_cflags} // () );
125e1051a39Sopenharmony_ci  my @lib_cflags_no_inst = ( $target{no_inst_lib_cflags} // @lib_cflags );
126e1051a39Sopenharmony_ci  my @lib_cflags_cont = ( $target{shared_cflag} || (),
127e1051a39Sopenharmony_ci                          @{$config{lib_cflags}}, @{$config{shared_cflag}},
128e1051a39Sopenharmony_ci                          @cnf_cflags, '$(CFLAGS)');
129e1051a39Sopenharmony_ci  our $lib_cflags = join('', @lib_cflags, @lib_cflags_cont );
130e1051a39Sopenharmony_ci  our $lib_cflags_no_inst = join('', @lib_cflags_no_inst, @lib_cflags_cont );
131e1051a39Sopenharmony_ci  our $lib_ldflags =
132e1051a39Sopenharmony_ci      join('', $target{lib_lflags} || (), $target{shared_ldflag} || (),
133e1051a39Sopenharmony_ci               @{$config{lib_lflags}}, @{$config{shared_ldflag}},
134e1051a39Sopenharmony_ci               @cnf_ldflags, '$(LDFLAGS)');
135e1051a39Sopenharmony_ci  our $lib_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
136e1051a39Sopenharmony_ci
137e1051a39Sopenharmony_ci  # The following array is special and is treated separately from the rest of
138e1051a39Sopenharmony_ci  # the dso_ variables.
139e1051a39Sopenharmony_ci  our @dso_cppincludes = (@{$target{dso_includes}}, @{$target{module_includes}},
140e1051a39Sopenharmony_ci                          @{$config{dso_includes}}, @{$config{module_includes}},
141e1051a39Sopenharmony_ci                          @cnf_includes);
142e1051a39Sopenharmony_ci
143e1051a39Sopenharmony_ci  our $dso_cppdefines =
144e1051a39Sopenharmony_ci      join(',', @{$target{dso_defines}}, @{$target{module_defines}},
145e1051a39Sopenharmony_ci                @{$config{dso_defines}}, @{$config{module_defines}},
146e1051a39Sopenharmony_ci                @cnf_defines,
147e1051a39Sopenharmony_ci                )
148e1051a39Sopenharmony_ci      . '$(DEFINES)'
149e1051a39Sopenharmony_ci      . "'extradefines'";
150e1051a39Sopenharmony_ci  our $dso_asflags =
151e1051a39Sopenharmony_ci      join(' ', $target{dso_asflags} || (), $target{module_asflags} || (),
152e1051a39Sopenharmony_ci                @{$config{dso_asflags}}, @{$config{module_asflags}},
153e1051a39Sopenharmony_ci                @cnf_asflags, '$(ASFLAGS)');
154e1051a39Sopenharmony_ci  our $dso_cppflags =
155e1051a39Sopenharmony_ci      join('', $target{dso_cppflags} || (), $target{module_cppflags} || (),
156e1051a39Sopenharmony_ci               @{$config{dso_cppflags}}, @{$config{module_cppflag}},
157e1051a39Sopenharmony_ci               @cnf_cppflags,
158e1051a39Sopenharmony_ci               '/DEFINE=('.$dso_cppdefines.')',
159e1051a39Sopenharmony_ci               '$(CPPFLAGS)');
160e1051a39Sopenharmony_ci  my @dso_cflags = ( $target{dso_cflags} // () );
161e1051a39Sopenharmony_ci  my @dso_cflags_no_inst = ( $target{no_inst_dso_cflags} // @dso_cflags );
162e1051a39Sopenharmony_ci  my @dso_cflags_cont = ( $target{module_cflag} || (),
163e1051a39Sopenharmony_ci                          @{$config{dso_cflags}}, @{$config{module_cflag}},
164e1051a39Sopenharmony_ci                          @cnf_cflags, '$(CFLAGS)');
165e1051a39Sopenharmony_ci  our $dso_cflags = join('', @dso_cflags, @dso_cflags_cont );
166e1051a39Sopenharmony_ci  our $dso_cflags_no_inst = join('', @dso_cflags_no_inst, @dso_cflags_cont );
167e1051a39Sopenharmony_ci  our $dso_ldflags =
168e1051a39Sopenharmony_ci      join('', $target{dso_lflags} || (), $target{module_ldflag} || (),
169e1051a39Sopenharmony_ci               @{$config{dso_lflags}}, @{$config{module_ldflag}},
170e1051a39Sopenharmony_ci               @cnf_ldflags, '$(LDFLAGS)');
171e1051a39Sopenharmony_ci  our $dso_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
172e1051a39Sopenharmony_ci
173e1051a39Sopenharmony_ci  # The following array is special and is treated separately from the rest of
174e1051a39Sopenharmony_ci  # the bin_ variables.
175e1051a39Sopenharmony_ci  our @bin_cppincludes = (@{$target{bin_includes}},
176e1051a39Sopenharmony_ci                          @{$config{bin_includes}},
177e1051a39Sopenharmony_ci                          @cnf_includes);
178e1051a39Sopenharmony_ci
179e1051a39Sopenharmony_ci  our $bin_cppdefines =
180e1051a39Sopenharmony_ci      join(',', @{$target{bin_defines}},
181e1051a39Sopenharmony_ci                @{$config{bin_defines}},
182e1051a39Sopenharmony_ci                @cnf_defines,
183e1051a39Sopenharmony_ci                )
184e1051a39Sopenharmony_ci      . '$(DEFINES)'
185e1051a39Sopenharmony_ci      . "'extradefines'";
186e1051a39Sopenharmony_ci  our $bin_asflags =
187e1051a39Sopenharmony_ci      join(' ', $target{bin_asflags} || (),
188e1051a39Sopenharmony_ci                @{$config{bin_asflags}},
189e1051a39Sopenharmony_ci                @cnf_asflags, '$(ASFLAGS)');
190e1051a39Sopenharmony_ci  our $bin_cppflags =
191e1051a39Sopenharmony_ci      join('', $target{bin_cppflags} || (),
192e1051a39Sopenharmony_ci               @{$config{bin_cppflags}},
193e1051a39Sopenharmony_ci               @cnf_cppflags,
194e1051a39Sopenharmony_ci               '/DEFINE=('.$bin_cppdefines.')',
195e1051a39Sopenharmony_ci               '$(CPPFLAGS)');
196e1051a39Sopenharmony_ci  my @bin_cflags = ( $target{bin_cflags} // () );
197e1051a39Sopenharmony_ci  my @bin_cflags_no_inst = ( $target{no_inst_bin_cflags} // @bin_cflags );
198e1051a39Sopenharmony_ci  my @bin_cflags_cont = ( @{$config{bin_cflags}},
199e1051a39Sopenharmony_ci                          @cnf_cflags, '$(CFLAGS)');
200e1051a39Sopenharmony_ci  our $bin_cflags = join('', @bin_cflags, @bin_cflags_cont );
201e1051a39Sopenharmony_ci  our $bin_cflags_no_inst = join('', @bin_cflags_no_inst, @bin_cflags_cont );
202e1051a39Sopenharmony_ci  our $bin_ldflags =
203e1051a39Sopenharmony_ci      join('', $target{bin_lflags} || (),
204e1051a39Sopenharmony_ci               @{$config{bin_lflags}},
205e1051a39Sopenharmony_ci               @cnf_ldflags, '$(LDFLAGS)');
206e1051a39Sopenharmony_ci  our $bin_ex_libs = join('', @cnf_ex_libs, '$(EX_LIBS)');
207e1051a39Sopenharmony_ci
208e1051a39Sopenharmony_ci  # This is a horrible hack, but is needed because recursive inclusion of files
209e1051a39Sopenharmony_ci  # in different directories does not work well with VMS C.  We try to help by
210e1051a39Sopenharmony_ci  # specifying extra relative directories.  They must always be in Unix format,
211e1051a39Sopenharmony_ci  # relative to the directory where the .c file is located.  The logic is that
212e1051a39Sopenharmony_ci  # any inclusion, merged with one of these relative directories, will find the
213e1051a39Sopenharmony_ci  # requested inclusion file.
214e1051a39Sopenharmony_ci  foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) {
215e1051a39Sopenharmony_ci      my $obj = platform->obj($_);
216e1051a39Sopenharmony_ci      push @{$unified_info{includes_extra}->{$obj}}, qw(../);
217e1051a39Sopenharmony_ci  }
218e1051a39Sopenharmony_ci  foreach (grep /\[\.crypto\.ec\.curve448\].*?\.o$/, keys %{$unified_info{sources}}) {
219e1051a39Sopenharmony_ci      my $obj = platform->obj($_);
220e1051a39Sopenharmony_ci      push @{$unified_info{includes_extra}->{$obj}}, qw(./arch_32 ./arch64);
221e1051a39Sopenharmony_ci  }
222e1051a39Sopenharmony_ci  foreach (grep /\[\.crypto\.ec\.curve448.arch_(?:32|64)\].*?\.o$/, keys %{$unified_info{sources}}) {
223e1051a39Sopenharmony_ci      my $obj = platform->obj($_);
224e1051a39Sopenharmony_ci      push @{$unified_info{includes_extra}->{$obj}}, qw(../);
225e1051a39Sopenharmony_ci  }
226e1051a39Sopenharmony_ci  foreach (grep /\[\.ssl\.(?:record|statem)\].*?\.o$/, keys %{$unified_info{sources}}) {
227e1051a39Sopenharmony_ci      my $obj = platform->obj($_);
228e1051a39Sopenharmony_ci      # Most of the files in [.ssl.record] and [.ssl.statem] include
229e1051a39Sopenharmony_ci      # "../ssl_local.h", which includes things like "record/record.h".
230e1051a39Sopenharmony_ci      # Adding "../" as an inclusion directory helps making this sort of header
231e1051a39Sopenharmony_ci      # from these directories.
232e1051a39Sopenharmony_ci      push @{$unified_info{includes_extra}->{$obj}}, qw(../);
233e1051a39Sopenharmony_ci
234e1051a39Sopenharmony_ci  }
235e1051a39Sopenharmony_ci  foreach (grep /\[\.test\].*?\.o$/, keys %{$unified_info{sources}}) {
236e1051a39Sopenharmony_ci      my $obj = platform->obj($_);
237e1051a39Sopenharmony_ci      push @{$unified_info{includes_extra}->{$obj}}, qw(../ssl ./helpers);
238e1051a39Sopenharmony_ci  }
239e1051a39Sopenharmony_ci  foreach (grep /\[\.test\.helpers\].*?\.o$/, keys %{$unified_info{sources}}) {
240e1051a39Sopenharmony_ci      my $obj = platform->obj($_);
241e1051a39Sopenharmony_ci      push @{$unified_info{includes_extra}->{$obj}}, qw(../../ssl);
242e1051a39Sopenharmony_ci  }
243e1051a39Sopenharmony_ci
244e1051a39Sopenharmony_ci  # This makes sure things get built in the order they need
245e1051a39Sopenharmony_ci  # to. You're welcome.
246e1051a39Sopenharmony_ci  sub dependmagic {
247e1051a39Sopenharmony_ci      my $target = shift;
248e1051a39Sopenharmony_ci
249e1051a39Sopenharmony_ci      return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target";
250e1051a39Sopenharmony_ci  }
251e1051a39Sopenharmony_ci  "";
252e1051a39Sopenharmony_ci-}
253e1051a39Sopenharmony_ciPLATFORM={- $config{target} -}
254e1051a39Sopenharmony_ciOPTIONS={- $config{options} -}
255e1051a39Sopenharmony_ciCONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
256e1051a39Sopenharmony_ciSRCDIR={- $config{sourcedir} -}
257e1051a39Sopenharmony_ciBLDDIR={- $config{builddir} -}
258e1051a39Sopenharmony_ciFIPSKEY={- $config{FIPSKEY} -}
259e1051a39Sopenharmony_ci
260e1051a39Sopenharmony_ci# Allow both V and VERBOSE to indicate verbosity.  This only applies
261e1051a39Sopenharmony_ci# to testing.
262e1051a39Sopenharmony_ciVERBOSE=$(V)
263e1051a39Sopenharmony_ciVERBOSE_FAILURE=$(VF)
264e1051a39Sopenharmony_ci
265e1051a39Sopenharmony_ciVERSION={- "$config{full_version}" -}
266e1051a39Sopenharmony_ciVERSION_NUMBER={- "$config{version}" -}
267e1051a39Sopenharmony_ciMAJOR={- $config{major} -}
268e1051a39Sopenharmony_ciMINOR={- $config{minor} -}
269e1051a39Sopenharmony_ciSHLIB_VERSION_NUMBER={- $config{shlib_version} -}
270e1051a39Sopenharmony_ciSHLIB_TARGET={- $target{shared_target} -}
271e1051a39Sopenharmony_ci
272e1051a39Sopenharmony_ciLIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -}
273e1051a39Sopenharmony_ciSHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -}
274e1051a39Sopenharmony_ciMODULES={- join(", ", map { "-\n\t".$_.".EXE" }
275e1051a39Sopenharmony_ci                      # Drop all modules that are dependencies, they will
276e1051a39Sopenharmony_ci                      # be processed through their dependents
277e1051a39Sopenharmony_ci                      grep { my $x = $_;
278e1051a39Sopenharmony_ci                             !grep { grep { $_ eq $x } @$_ }
279e1051a39Sopenharmony_ci                                   values %{$unified_info{depends}} }
280e1051a39Sopenharmony_ci                      @{$unified_info{modules}}) -}
281e1051a39Sopenharmony_ciFIPSMODULE={- # We do some extra checking here, as there should be only one
282e1051a39Sopenharmony_ci              use File::Basename;
283e1051a39Sopenharmony_ci              our @fipsmodules =
284e1051a39Sopenharmony_ci                  grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
285e1051a39Sopenharmony_ci                         && $unified_info{attributes}->{modules}->{$_}->{fips} }
286e1051a39Sopenharmony_ci                  @{$unified_info{modules}};
287e1051a39Sopenharmony_ci              die "More that one FIPS module" if scalar @fipsmodules > 1;
288e1051a39Sopenharmony_ci              join(" ", map { platform->dso($_) } @fipsmodules) -}
289e1051a39Sopenharmony_ciFIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1;
290e1051a39Sopenharmony_ci                  join(", ", map { basename(platform->dso($_)) } @fipsmodules) -}
291e1051a39Sopenharmony_ciPROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -}
292e1051a39Sopenharmony_ciSCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -}
293e1051a39Sopenharmony_ci{- output_off() if $disabled{makedepend}; "" -}
294e1051a39Sopenharmony_ciDEPS={- our @deps = map { platform->isobj($_) ? platform->dep($_) : $_ }
295e1051a39Sopenharmony_ci                    grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
296e1051a39Sopenharmony_ci                    keys %{$unified_info{sources}};
297e1051a39Sopenharmony_ci        join(", ", map { "-\n\t".$_ } @deps); -}
298e1051a39Sopenharmony_ci{- output_on() if $disabled{makedepend}; "" -}
299e1051a39Sopenharmony_ciGENERATED_MANDATORY={- join(", ",
300e1051a39Sopenharmony_ci                            map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -}
301e1051a39Sopenharmony_ciGENERATED_PODS={- # common0.tmpl provides @generated
302e1051a39Sopenharmony_ci                  join(", ",
303e1051a39Sopenharmony_ci                       map { my $x = $_;
304e1051a39Sopenharmony_ci                             (
305e1051a39Sopenharmony_ci                               grep { 
306e1051a39Sopenharmony_ci                                      $unified_info{attributes}->{depends}
307e1051a39Sopenharmony_ci                                      ->{$x}->{$_}->{pod} // 0
308e1051a39Sopenharmony_ci                                    }
309e1051a39Sopenharmony_ci                                   keys %{$unified_info{attributes}->{depends}->{$x}}
310e1051a39Sopenharmony_ci                             ) ? "-\n\t".$x : ();
311e1051a39Sopenharmony_ci                           }
312e1051a39Sopenharmony_ci                           @generated) -}
313e1051a39Sopenharmony_ciGENERATED={- # common0.tmpl provides @generated
314e1051a39Sopenharmony_ci             join(", ", map { platform->convertext($_) } @generated) -}
315e1051a39Sopenharmony_ci
316e1051a39Sopenharmony_ciINSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -}
317e1051a39Sopenharmony_ciINSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -}
318e1051a39Sopenharmony_ciINSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @install_engines) -}
319e1051a39Sopenharmony_ciINSTALL_MODULES={- join(", ", map { "-\n\t".$_.".EXE" } @install_modules) -}
320e1051a39Sopenharmony_ciINSTALL_FIPSMODULE={- join(", ", map { "-\n\t".$_.".EXE" } @install_fipsmodules) -}
321e1051a39Sopenharmony_ciINSTALL_FIPSMODULECONF=[.providers]fipsmodule.cnf
322e1051a39Sopenharmony_ciINSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @install_programs) -}
323e1051a39Sopenharmony_ciBIN_SCRIPTS={- join(", ", @install_bin_scripts) -}
324e1051a39Sopenharmony_ciMISC_SCRIPTS={- join(", ", @install_misc_scripts) -}
325e1051a39Sopenharmony_ciHTMLDOCS1={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man1}}) -}
326e1051a39Sopenharmony_ciHTMLDOCS3={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man3}}) -}
327e1051a39Sopenharmony_ciHTMLDOCS5={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man5}}) -}
328e1051a39Sopenharmony_ciHTMLDOCS7={- join(", ", map { "-\n\t".$_ } @{$unified_info{htmldocs}->{man7}}) -}
329e1051a39Sopenharmony_ci
330e1051a39Sopenharmony_ciAPPS_OPENSSL="{- use File::Spec::Functions;
331e1051a39Sopenharmony_ci                 catfile("apps","openssl") -}"
332e1051a39Sopenharmony_ci
333e1051a39Sopenharmony_ci# DESTDIR is for package builders so that they can configure for, say,
334e1051a39Sopenharmony_ci# SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER].
335e1051a39Sopenharmony_ci# In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run
336e1051a39Sopenharmony_ci# MMS with /MACROS=(DESTDIR=STAGING:[USER]).  The result will end up in
337e1051a39Sopenharmony_ci# STAGING:[USER.OPENSSL].
338e1051a39Sopenharmony_ci# Normally it is left empty.
339e1051a39Sopenharmony_ciDESTDIR=
340e1051a39Sopenharmony_ci
341e1051a39Sopenharmony_ci# Do not edit this manually. Use Configure --prefix=DIR to change this!
342e1051a39Sopenharmony_ciINSTALLTOP={- our $installtop =
343e1051a39Sopenharmony_ci                  catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]";
344e1051a39Sopenharmony_ci              $installtop -}
345e1051a39Sopenharmony_ciSYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -}
346e1051a39Sopenharmony_ci# This is the standard central area to store certificates, private keys...
347e1051a39Sopenharmony_ciOPENSSLDIR={- catdir($config{openssldir}) or
348e1051a39Sopenharmony_ci              $config{prefix} ? catdir($config{prefix},"COMMON")
349e1051a39Sopenharmony_ci                              : "SYS\$COMMON:[OPENSSL-COMMON]" -}
350e1051a39Sopenharmony_ci# The same, but for C
351e1051a39Sopenharmony_ciOPENSSLDIR_C={- platform->osslprefix() -}DATAROOT:[000000]
352e1051a39Sopenharmony_ci# Where installed ENGINE modules reside, for C
353e1051a39Sopenharmony_ciENGINESDIR_C={- platform->osslprefix() -}ENGINES{- $sover_dirname.$target{pointer_size} -}:
354e1051a39Sopenharmony_ci# Where modules reside, for C
355e1051a39Sopenharmony_ciMODULESDIR_C={- platform->osslprefix() -}MODULES{- $target{pointer_size} -}:
356e1051a39Sopenharmony_ci
357e1051a39Sopenharmony_ci##### User defined commands and flags ################################
358e1051a39Sopenharmony_ci
359e1051a39Sopenharmony_ciCC={- $config{CC} -}
360e1051a39Sopenharmony_ciCPP={- $config{CPP} -}
361e1051a39Sopenharmony_ciDEFINES={- our $defines = join('', map { ",$_" } @{$config{CPPDEFINES}}) -}
362e1051a39Sopenharmony_ci#INCLUDES={- our $includes = join(',', @{$config{CPPINCLUDES}}) -}
363e1051a39Sopenharmony_ciCPPFLAGS={- our $cppflags = join('', @{$config{CPPFLAGS}}) -}
364e1051a39Sopenharmony_ciCFLAGS={- join('', @{$config{CFLAGS}}) -}
365e1051a39Sopenharmony_ciLDFLAGS={- join('', @{$config{LFLAGS}}) -}
366e1051a39Sopenharmony_ciEX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -}
367e1051a39Sopenharmony_ci
368e1051a39Sopenharmony_ciPERL={- $config{PERL} -}
369e1051a39Sopenharmony_ci
370e1051a39Sopenharmony_ciAS={- $config{AS} -}
371e1051a39Sopenharmony_ciASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
372e1051a39Sopenharmony_ci
373e1051a39Sopenharmony_ci##### Special command flags ##########################################
374e1051a39Sopenharmony_ci
375e1051a39Sopenharmony_ciASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
376e1051a39Sopenharmony_ci
377e1051a39Sopenharmony_ciPERLASM_SCHEME={- $target{perlasm_scheme} -}
378e1051a39Sopenharmony_ci
379e1051a39Sopenharmony_ci# CPPFLAGS_Q is used for one thing only: to build up buildinf.h
380e1051a39Sopenharmony_ciCPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags) =~ s|"|""|g;
381e1051a39Sopenharmony_ci              (my $d = $lib_cppdefines) =~ s|"|""|g;
382e1051a39Sopenharmony_ci              my $i = join(',', @lib_cppincludes || (), '$(INCLUDES)');
383e1051a39Sopenharmony_ci              my $x = $c;
384e1051a39Sopenharmony_ci              $x .= "/INCLUDE=($i)" if $i;
385e1051a39Sopenharmony_ci              $x .= "/DEFINE=($d)" if $d;
386e1051a39Sopenharmony_ci              $x; -}
387e1051a39Sopenharmony_ci
388e1051a39Sopenharmony_ci# .FIRST and .LAST are special targets with MMS and MMK.
389e1051a39Sopenharmony_ciNODEBUG=@
390e1051a39Sopenharmony_ci.FIRST :
391e1051a39Sopenharmony_ci        {- join( "\n        \$(NODEBUG) ", @{ $target{setup_commands} // [] },
392e1051a39Sopenharmony_ci                                           '!' ) -}
393e1051a39Sopenharmony_ci        $(NODEBUG) sourcetop = F$PARSE("$(SRCDIR)","[]A.;",,,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" + ".]"
394e1051a39Sopenharmony_ci        $(NODEBUG) DEFINE ossl_sourceroot 'sourcetop'
395e1051a39Sopenharmony_ci        $(NODEBUG) !
396e1051a39Sopenharmony_ci        $(NODEBUG) staging_dir = "$(DESTDIR)"
397e1051a39Sopenharmony_ci        $(NODEBUG) staging_instdir = ""
398e1051a39Sopenharmony_ci        $(NODEBUG) staging_datadir = ""
399e1051a39Sopenharmony_ci        $(NODEBUG) IF staging_dir .NES. "" THEN -
400e1051a39Sopenharmony_ci                staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
401e1051a39Sopenharmony_ci        $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN -
402e1051a39Sopenharmony_ci                staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]"
403e1051a39Sopenharmony_ci        $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN -
404e1051a39Sopenharmony_ci                staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]"
405e1051a39Sopenharmony_ci        $(NODEBUG) IF staging_dir .NES. "" THEN -
406e1051a39Sopenharmony_ci                staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY")
407e1051a39Sopenharmony_ci        $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN -
408e1051a39Sopenharmony_ci                staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]"
409e1051a39Sopenharmony_ci        $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN -
410e1051a39Sopenharmony_ci                staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]"
411e1051a39Sopenharmony_ci        $(NODEBUG) !
412e1051a39Sopenharmony_ci        $(NODEBUG) ! Installation logical names
413e1051a39Sopenharmony_ci        $(NODEBUG) !
414e1051a39Sopenharmony_ci        $(NODEBUG) ! This also creates a few DCL variables that are used for
415e1051a39Sopenharmony_ci        $(NODEBUG) ! the "install_msg" target.
416e1051a39Sopenharmony_ci        $(NODEBUG) !
417e1051a39Sopenharmony_ci        $(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
418e1051a39Sopenharmony_ci        $(NODEBUG) installtop = installroot + ".]"
419e1051a39Sopenharmony_ci        $(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;"
420e1051a39Sopenharmony_ci        $(NODEBUG) datatop = dataroot + ".]"
421e1051a39Sopenharmony_ci        $(NODEBUG) DEFINE ossl_installroot 'installtop'
422e1051a39Sopenharmony_ci        $(NODEBUG) DEFINE ossl_dataroot 'datatop'
423e1051a39Sopenharmony_ci        $(NODEBUG) !
424e1051a39Sopenharmony_ci        $(NODEBUG) ! Override disturbing system logicals.  We can't deassign
425e1051a39Sopenharmony_ci        $(NODEBUG) ! them, so we create it instead.  This is an unfortunate
426e1051a39Sopenharmony_ci        $(NODEBUG) ! necessity.
427e1051a39Sopenharmony_ci        $(NODEBUG) !
428e1051a39Sopenharmony_ci        $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;"
429e1051a39Sopenharmony_ci        $(NODEBUG) openssl_inc2 = F$PARSE("sourcetop:[include.openssl]","A.;",,,"SYNTAX_ONLY") - "A.;"
430e1051a39Sopenharmony_ci        $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2'
431e1051a39Sopenharmony_ci        $(NODEBUG) !
432e1051a39Sopenharmony_ci        $(NODEBUG) ! Figure out the architecture
433e1051a39Sopenharmony_ci        $(NODEBUG) !
434e1051a39Sopenharmony_ci        $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase")
435e1051a39Sopenharmony_ci        $(NODEBUG) !
436e1051a39Sopenharmony_ci        $(NODEBUG) ! Set up logical names for the libraries, so LINK and
437e1051a39Sopenharmony_ci        $(NODEBUG) ! running programs can use them.
438e1051a39Sopenharmony_ci        $(NODEBUG) !
439e1051a39Sopenharmony_ci        $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -}
440e1051a39Sopenharmony_ci
441e1051a39Sopenharmony_ci.LAST :
442e1051a39Sopenharmony_ci        $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -}
443e1051a39Sopenharmony_ci        $(NODEBUG) DEASSIGN openssl
444e1051a39Sopenharmony_ci        $(NODEBUG) DEASSIGN ossl_dataroot
445e1051a39Sopenharmony_ci        $(NODEBUG) DEASSIGN ossl_installroot
446e1051a39Sopenharmony_ci        $(NODEBUG) DEASSIGN ossl_sourceroot
447e1051a39Sopenharmony_ci.DEFAULT :
448e1051a39Sopenharmony_ci        @ ! MMS cannot handle no actions...
449e1051a39Sopenharmony_ci
450e1051a39Sopenharmony_ci# The main targets ###################################################
451e1051a39Sopenharmony_ci
452e1051a39Sopenharmony_ci{- dependmagic('build_sw'); -} : build_libs_nodep, build_modules_nodep, build_programs_nodep
453e1051a39Sopenharmony_ci{- dependmagic('build_libs'); -} : build_libs_nodep
454e1051a39Sopenharmony_ci{- dependmagic('build_modules'); -} : build_modules_nodep
455e1051a39Sopenharmony_ci{- dependmagic('build_programs'); -} : build_programs_nodep
456e1051a39Sopenharmony_ci
457e1051a39Sopenharmony_cibuild_generated_pods : $(GENERATED_PODS)
458e1051a39Sopenharmony_cibuild_docs : build_html_docs
459e1051a39Sopenharmony_cibuild_html_docs : $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
460e1051a39Sopenharmony_ci
461e1051a39Sopenharmony_cibuild_generated : $(GENERATED_MANDATORY)
462e1051a39Sopenharmony_cibuild_libs_nodep : $(LIBS), $(SHLIBS)
463e1051a39Sopenharmony_cibuild_modules_nodep : $(MODULES)
464e1051a39Sopenharmony_cibuild_programs_nodep : $(PROGRAMS), $(SCRIPTS)
465e1051a39Sopenharmony_ci
466e1051a39Sopenharmony_ci# Kept around for backward compatibility
467e1051a39Sopenharmony_cibuild_apps build_tests : build_programs
468e1051a39Sopenharmony_ci
469e1051a39Sopenharmony_ci# Convenience target to prebuild all generated files, not just the mandatory
470e1051a39Sopenharmony_ci# ones
471e1051a39Sopenharmony_cibuild_all_generated : $(GENERATED_MANDATORY) $(GENERATED) build_docs
472e1051a39Sopenharmony_ci	@ ! {- output_off() if $disabled{makedepend}; "" -}
473e1051a39Sopenharmony_ci	@ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if"
474e1051a39Sopenharmony_ci	@ WRITE SYS$OUTPUT "         target system doesn't have $(PERL),"
475e1051a39Sopenharmony_ci	@ WRITE SYS$OUTPUT "         then make will fail..."
476e1051a39Sopenharmony_ci	@ ! {- output_on() if $disabled{makedepend}; "" -}
477e1051a39Sopenharmony_ci
478e1051a39Sopenharmony_ciall : build_sw build_docs
479e1051a39Sopenharmony_ci
480e1051a39Sopenharmony_citest : tests
481e1051a39Sopenharmony_ci{- dependmagic('tests'); -} : build_programs_nodep, build_modules_nodep run_tests
482e1051a39Sopenharmony_cirun_tests :
483e1051a39Sopenharmony_ci        @ ! {- output_off() if $disabled{tests}; "" -}
484e1051a39Sopenharmony_ci        DEFINE SRCTOP "$(SRCDIR)"
485e1051a39Sopenharmony_ci        DEFINE BLDTOP "$(BLDDIR)"
486e1051a39Sopenharmony_ci        DEFINE FIPSKEY "$(FIPSKEY)"
487e1051a39Sopenharmony_ci        IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)"
488e1051a39Sopenharmony_ci        $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS)
489e1051a39Sopenharmony_ci        DEASSIGN BLDTOP
490e1051a39Sopenharmony_ci        DEASSIGN SRCTOP
491e1051a39Sopenharmony_ci        DEASSIGN FIPSKEY
492e1051a39Sopenharmony_ci        @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
493e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
494e1051a39Sopenharmony_ci        @ ! {- output_on() if !$disabled{tests}; "" -}
495e1051a39Sopenharmony_ci
496e1051a39Sopenharmony_cilist-tests :
497e1051a39Sopenharmony_ci        @ ! {- output_off() if $disabled{tests}; "" -}
498e1051a39Sopenharmony_ci        @ DEFINE SRCTOP "$(SRCDIR)"
499e1051a39Sopenharmony_ci        @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list
500e1051a39Sopenharmony_ci        @ DEASSIGN SRCTOP
501e1051a39Sopenharmony_ci        @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
502e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options"
503e1051a39Sopenharmony_ci        @ ! {- output_on() if !$disabled{tests}; "" -}
504e1051a39Sopenharmony_ci
505e1051a39Sopenharmony_ciinstall : install_sw install_ssldirs install_docs {- $disabled{fips} ? "" : "install_fips" -} install_msg
506e1051a39Sopenharmony_ci
507e1051a39Sopenharmony_ciinstall_msg :
508e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT ""
509e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "######################################################################"
510e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT ""
511e1051a39Sopenharmony_ci        @ IF "$(DESTDIR)" .EQS. "" THEN -
512e1051a39Sopenharmony_ci             @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}"
513e1051a39Sopenharmony_ci        @ IF "$(DESTDIR)" .NES. "" THEN -
514e1051a39Sopenharmony_ci             @{- sourcefile("VMS", "msg_staging.com") -} -
515e1051a39Sopenharmony_ci             "''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" -
516e1051a39Sopenharmony_ci             "$(SYSTARTUP)" "{- $osslver -}"
517e1051a39Sopenharmony_ci
518e1051a39Sopenharmony_cicheck_install :
519e1051a39Sopenharmony_ci        spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
520e1051a39Sopenharmony_ci
521e1051a39Sopenharmony_ciuninstall : uninstall_docs uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -}
522e1051a39Sopenharmony_ci
523e1051a39Sopenharmony_ci# Because VMS wants the generation number (or *) to delete files, we can't
524e1051a39Sopenharmony_ci# use $(LIBS), $(PROGRAMS), $(GENERATED) and $(MODULES) directly.
525e1051a39Sopenharmony_cilibclean :
526e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -}
527e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -}
528e1051a39Sopenharmony_ci
529e1051a39Sopenharmony_ciclean : libclean
530e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man1}}) || "@ !" -}
531e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man3}}) || "@ !" -}
532e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man5}}) || "@ !" -}
533e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{htmldocs}->{man7}}) || "@ !" -}
534e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -}
535e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{modules}}) || "@ !" -}
536e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -}
537e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -}
538e1051a39Sopenharmony_ci        {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -}
539e1051a39Sopenharmony_ci        - DELETE [...]*.MAP;*
540e1051a39Sopenharmony_ci        - DELETE [...]*.D;*
541e1051a39Sopenharmony_ci        - DELETE [...]*.OBJ;*,*.LIS;*
542e1051a39Sopenharmony_ci        - DELETE []CXX$DEMANGLER_DB.;*
543e1051a39Sopenharmony_ci        - DELETE [.VMS]openssl_startup.com;*
544e1051a39Sopenharmony_ci        - DELETE [.VMS]openssl_shutdown.com;*
545e1051a39Sopenharmony_ci        - DELETE []vmsconfig.pm;*
546e1051a39Sopenharmony_ci
547e1051a39Sopenharmony_cidistclean : clean
548e1051a39Sopenharmony_ci        - DELETE [.include.openssl]configuration.h;*
549e1051a39Sopenharmony_ci        - DELETE configdata.pm;*
550e1051a39Sopenharmony_ci        - DELETE descrip.mms;*
551e1051a39Sopenharmony_ci
552e1051a39Sopenharmony_cidepend : descrip.mms
553e1051a39Sopenharmony_ci	@ ! {- output_off() if $disabled{makedepend}; "" -}
554e1051a39Sopenharmony_ci	@ $(PERL) {- sourcefile("util", "add-depends.pl") -} "{- $config{makedep_scheme} -}"
555e1051a39Sopenharmony_ci	@ ! {- output_on() if $disabled{makedepend}; "" -}
556e1051a39Sopenharmony_ci
557e1051a39Sopenharmony_ci# Install helper targets #############################################
558e1051a39Sopenharmony_ci
559e1051a39Sopenharmony_ciinstall_sw : install_dev install_engines install_modules -
560e1051a39Sopenharmony_ci             install_runtime install_startup install_ivp
561e1051a39Sopenharmony_ci
562e1051a39Sopenharmony_ciuninstall_sw : uninstall_dev uninstall_modules uninstall_engines -
563e1051a39Sopenharmony_ci               uninstall_runtime uninstall_startup uninstall_ivp
564e1051a39Sopenharmony_ci
565e1051a39Sopenharmony_ciinstall_docs : install_html_docs
566e1051a39Sopenharmony_ci
567e1051a39Sopenharmony_ciuninstall_docs : uninstall_html_docs
568e1051a39Sopenharmony_ci
569e1051a39Sopenharmony_ci{- output_off() if $disabled{fips}; "" -}
570e1051a39Sopenharmony_ciinstall_fips : build_sw $(INSTALL_FIPSMODULECONF)
571e1051a39Sopenharmony_ci	@ WRITE SYS$OUTPUT "*** Installing FIPS module"
572e1051a39Sopenharmony_ci	- CREATE/DIR ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']
573e1051a39Sopenharmony_ci	- CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
574e1051a39Sopenharmony_ci	COPY/PROT=W:RE $(INSTALL_FIPSMODULES) -
575e1051a39Sopenharmony_ci                ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']$(FIPSMODULENAME)
576e1051a39Sopenharmony_ci	@ WRITE SYS$OUTPUT "*** Installing FIPS module configuration"
577e1051a39Sopenharmony_ci	COPY/PROT=W:RE $(INSTALL_FIPSMODULECONF) OSSL_DATAROOT:[000000]
578e1051a39Sopenharmony_ci
579e1051a39Sopenharmony_ciuninstall_fips :
580e1051a39Sopenharmony_ci	@ WRITE SYS$OUTPUT "*** Uninstalling FIPS module configuration"
581e1051a39Sopenharmony_ci	DELETE OSSL_DATAROOT:[000000]fipsmodule.cnf;*
582e1051a39Sopenharmony_ci	@ WRITE SYS$OUTPUT "*** Uninstalling FIPS module"
583e1051a39Sopenharmony_ci	DELETE ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']$(FIPSMODULENAME);*
584e1051a39Sopenharmony_ci{- output_on() if $disabled{fips}; "" -}
585e1051a39Sopenharmony_ci
586e1051a39Sopenharmony_ciinstall_ssldirs : check_INSTALLTOP
587e1051a39Sopenharmony_ci        - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000]
588e1051a39Sopenharmony_ci        IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN -
589e1051a39Sopenharmony_ci                CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS]
590e1051a39Sopenharmony_ci        IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN -
591e1051a39Sopenharmony_ci                CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE]
592e1051a39Sopenharmony_ci        IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN -
593e1051a39Sopenharmony_ci                CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC]
594e1051a39Sopenharmony_ci        COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC]
595e1051a39Sopenharmony_ci        @ ! Install configuration file
596e1051a39Sopenharmony_ci        COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
597e1051a39Sopenharmony_ci                ossl_dataroot:[000000]openssl.cnf-dist
598e1051a39Sopenharmony_ci        IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN -
599e1051a39Sopenharmony_ci                COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} -
600e1051a39Sopenharmony_ci                        ossl_dataroot:[000000]openssl.cnf
601e1051a39Sopenharmony_ci        @ ! Install CTLOG configuration file
602e1051a39Sopenharmony_ci        COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
603e1051a39Sopenharmony_ci                ossl_dataroot:[000000]ct_log_list.cnf-dist
604e1051a39Sopenharmony_ci        IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN -
605e1051a39Sopenharmony_ci                COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} -
606e1051a39Sopenharmony_ci                        ossl_dataroot:[000000]ct_log_list.cnf
607e1051a39Sopenharmony_ci
608e1051a39Sopenharmony_ciinstall_dev : check_INSTALLTOP install_runtime_libs
609e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "*** Installing development files"
610e1051a39Sopenharmony_ci        @ ! Install header files
611e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[include.openssl]
612e1051a39Sopenharmony_ci        COPY/PROT=W:R ossl_sourceroot:[include.openssl]*.h -
613e1051a39Sopenharmony_ci                ossl_installroot:[include.openssl]
614e1051a39Sopenharmony_ci        COPY/PROT=W:R [.include.openssl]*.h ossl_installroot:[include.openssl]
615e1051a39Sopenharmony_ci        @ ! Install static (development) libraries
616e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[LIB.'arch']
617e1051a39Sopenharmony_ci        {- join("\n        ",
618e1051a39Sopenharmony_ci                map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" }
619e1051a39Sopenharmony_ci                @install_libs) -}
620e1051a39Sopenharmony_ci
621e1051a39Sopenharmony_ciinstall_engines : check_INSTALLTOP install_runtime_libs build_modules
622e1051a39Sopenharmony_ci        @ {- output_off() unless scalar @install_engines; "" -} !
623e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "*** Installing engines"
624e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch']
625e1051a39Sopenharmony_ci        {- join("\n        ",
626e1051a39Sopenharmony_ci                map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" }
627e1051a39Sopenharmony_ci                @install_engines) -}
628e1051a39Sopenharmony_ci        @ {- output_on() unless scalar @install_engines; "" -} !
629e1051a39Sopenharmony_ci
630e1051a39Sopenharmony_ciinstall_modules : check_INSTALLTOP install_runtime_libs build_modules
631e1051a39Sopenharmony_ci        @ {- output_off() unless scalar @install_modules; "" -} !
632e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "*** Installing modules"
633e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[MODULES{- $target{pointer_size} -}.'arch']
634e1051a39Sopenharmony_ci        {- join("\n        ",
635e1051a39Sopenharmony_ci                map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[MODULES$target{pointer_size}.'arch']" }
636e1051a39Sopenharmony_ci                @install_modules) -}
637e1051a39Sopenharmony_ci        @ {- output_on() unless scalar @install_modules; "" -} !
638e1051a39Sopenharmony_ci
639e1051a39Sopenharmony_ciinstall_runtime : install_programs
640e1051a39Sopenharmony_ci
641e1051a39Sopenharmony_ciinstall_runtime_libs : check_INSTALLTOP build_libs
642e1051a39Sopenharmony_ci        @ {- output_off() if $disabled{shared}; "" -} !
643e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "*** Installing shareable images"
644e1051a39Sopenharmony_ci        @ ! Install shared (runtime) libraries
645e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[LIB.'arch']
646e1051a39Sopenharmony_ci        {- join("\n        ",
647e1051a39Sopenharmony_ci                map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" }
648e1051a39Sopenharmony_ci                @install_shlibs) -}
649e1051a39Sopenharmony_ci        @ {- output_on() if $disabled{shared}; "" -} !
650e1051a39Sopenharmony_ci
651e1051a39Sopenharmony_ciinstall_programs : check_INSTALLTOP install_runtime_libs build_programs
652e1051a39Sopenharmony_ci        @ {- output_off() if $disabled{apps}; "" -} !
653e1051a39Sopenharmony_ci        @ ! Install the main program
654e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[EXE.'arch']
655e1051a39Sopenharmony_ci        COPY/PROT=W:RE [.APPS]openssl.EXE -
656e1051a39Sopenharmony_ci                ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE
657e1051a39Sopenharmony_ci        @ ! Install scripts
658e1051a39Sopenharmony_ci        COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE]
659e1051a39Sopenharmony_ci        @ ! {- output_on() if $disabled{apps}; "" -}
660e1051a39Sopenharmony_ci
661e1051a39Sopenharmony_ciinstall_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com -
662e1051a39Sopenharmony_ci                 [.VMS]openssl_utils.com, check_INSTALLTOP
663e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[SYS$STARTUP]
664e1051a39Sopenharmony_ci        COPY/PROT=W:RE [.VMS]openssl_startup.com -
665e1051a39Sopenharmony_ci                ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com
666e1051a39Sopenharmony_ci        COPY/PROT=W:RE [.VMS]openssl_shutdown.com -
667e1051a39Sopenharmony_ci                ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com
668e1051a39Sopenharmony_ci        COPY/PROT=W:RE [.VMS]openssl_utils.com -
669e1051a39Sopenharmony_ci                ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com
670e1051a39Sopenharmony_ci
671e1051a39Sopenharmony_ciinstall_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP
672e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[SYSTEST]
673e1051a39Sopenharmony_ci        COPY/PROT=W:RE [.VMS]openssl_ivp.com -
674e1051a39Sopenharmony_ci                ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com
675e1051a39Sopenharmony_ci
676e1051a39Sopenharmony_ci[.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -}
677e1051a39Sopenharmony_ci        - CREATE/DIR [.VMS]
678e1051a39Sopenharmony_ci        $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
679e1051a39Sopenharmony_ci                {- sourcefile("VMS", "openssl_startup.com.in") -} -
680e1051a39Sopenharmony_ci                > [.VMS]openssl_startup.com
681e1051a39Sopenharmony_ci
682e1051a39Sopenharmony_ci[.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -}
683e1051a39Sopenharmony_ci        - CREATE/DIR [.VMS]
684e1051a39Sopenharmony_ci        $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
685e1051a39Sopenharmony_ci                {- sourcefile("VMS", "openssl_utils.com.in") -} -
686e1051a39Sopenharmony_ci                > [.VMS]openssl_utils.com
687e1051a39Sopenharmony_ci
688e1051a39Sopenharmony_ci[.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -}
689e1051a39Sopenharmony_ci        - CREATE/DIR [.VMS]
690e1051a39Sopenharmony_ci        $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
691e1051a39Sopenharmony_ci                {- sourcefile("VMS", "openssl_shutdown.com.in") -} -
692e1051a39Sopenharmony_ci                > [.VMS]openssl_shutdown.com
693e1051a39Sopenharmony_ci
694e1051a39Sopenharmony_ci[.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -}
695e1051a39Sopenharmony_ci        - CREATE/DIR [.VMS]
696e1051a39Sopenharmony_ci        $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} -
697e1051a39Sopenharmony_ci                {- sourcefile("VMS", "openssl_ivp.com.in") -} -
698e1051a39Sopenharmony_ci                > [.VMS]openssl_ivp.com
699e1051a39Sopenharmony_ci
700e1051a39Sopenharmony_civmsconfig.pm : configdata.pm
701e1051a39Sopenharmony_ci        OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm
702e1051a39Sopenharmony_ci        WRITE CONFIG "package vmsconfig;"
703e1051a39Sopenharmony_ci        WRITE CONFIG "use strict; use warnings;"
704e1051a39Sopenharmony_ci        WRITE CONFIG "use Exporter;"
705e1051a39Sopenharmony_ci        WRITE CONFIG "our @ISA = qw(Exporter);"
706e1051a39Sopenharmony_ci        WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);"
707e1051a39Sopenharmony_ci        WRITE CONFIG "our %config = ("
708e1051a39Sopenharmony_ci        WRITE CONFIG "  target => '","{- $config{target} -}","',"
709e1051a39Sopenharmony_ci        WRITE CONFIG "  version => '","{- $config{version} -}","',"
710e1051a39Sopenharmony_ci        WRITE CONFIG "  shlib_version => '","{- $config{shlib_version} -}","',"
711e1051a39Sopenharmony_ci        WRITE CONFIG "  shlib_major => '","{- $config{shlib_major} -}","',"
712e1051a39Sopenharmony_ci        WRITE CONFIG "  shlib_minor => '","{- $config{shlib_minor} -}","',"
713e1051a39Sopenharmony_ci        WRITE CONFIG "  no_shared => '","{- $disabled{shared} -}","',"
714e1051a39Sopenharmony_ci        WRITE CONFIG "  INSTALLTOP => '$(INSTALLTOP)',"
715e1051a39Sopenharmony_ci        WRITE CONFIG "  OPENSSLDIR => '$(OPENSSLDIR)',"
716e1051a39Sopenharmony_ci        WRITE CONFIG "  pointer_size => '","{- $target{pointer_size} -}","',"
717e1051a39Sopenharmony_ci        WRITE CONFIG ");"
718e1051a39Sopenharmony_ci        WRITE CONFIG "our %target = ();"
719e1051a39Sopenharmony_ci        WRITE CONFIG "our %disabled = ();"
720e1051a39Sopenharmony_ci        WRITE CONFIG "our %withargs = ();"
721e1051a39Sopenharmony_ci        WRITE CONFIG "our %unified_info = ();"
722e1051a39Sopenharmony_ci        WRITE CONFIG "1;"
723e1051a39Sopenharmony_ci        CLOSE CONFIG
724e1051a39Sopenharmony_ci
725e1051a39Sopenharmony_ciinstall_html_docs : check_INSTALLTOP build_html_docs
726e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "*** Installing HTML docs"
727e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[HTML.MAN1]
728e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[HTML.MAN3]
729e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[HTML.MAN5]
730e1051a39Sopenharmony_ci        - CREATE/DIR ossl_installroot:[HTML.MAN7]
731e1051a39Sopenharmony_ci        {- join("\n        ",
732e1051a39Sopenharmony_ci                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN1]" }
733e1051a39Sopenharmony_ci                  @{$unified_info{htmldocs}->{man1}} ),
734e1051a39Sopenharmony_ci                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN3]" }
735e1051a39Sopenharmony_ci                  @{$unified_info{htmldocs}->{man3}} ),
736e1051a39Sopenharmony_ci                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN5]" }
737e1051a39Sopenharmony_ci                  @{$unified_info{htmldocs}->{man5}} ),
738e1051a39Sopenharmony_ci                ( map { "COPY/PROT=W:RE $_ ossl_installroot:[HTML.MAN7]" }
739e1051a39Sopenharmony_ci                  @{$unified_info{htmldocs}->{man7}} )) -}
740e1051a39Sopenharmony_ci
741e1051a39Sopenharmony_cicheck_INSTALLTOP :
742e1051a39Sopenharmony_ci        @ IF "$(INSTALLTOP)" .EQS. "" THEN -
743e1051a39Sopenharmony_ci                WRITE SYS$ERROR "INSTALLTOP should not be empty"
744e1051a39Sopenharmony_ci        @ IF "$(INSTALLTOP)" .EQS. "" THEN -
745e1051a39Sopenharmony_ci                EXIT %x10000002
746e1051a39Sopenharmony_ci
747e1051a39Sopenharmony_ci# Developer targets ##################################################
748e1051a39Sopenharmony_ci
749e1051a39Sopenharmony_cidebug_logicals :
750e1051a39Sopenharmony_ci        SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot
751e1051a39Sopenharmony_ci
752e1051a39Sopenharmony_ci# Building targets ###################################################
753e1051a39Sopenharmony_ci
754e1051a39Sopenharmony_cidescrip.mms : configdata.pm {- join(" ", @{$config{build_file_templates}}) -}
755e1051a39Sopenharmony_ci	perl configdata.pm
756e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "*************************************************"
757e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "***                                           ***"
758e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "***   Please run the same mms command again   ***"
759e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "***                                           ***"
760e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "*************************************************"
761e1051a39Sopenharmony_ci        @ PIPE ( EXIT %X10000000 )
762e1051a39Sopenharmony_ci
763e1051a39Sopenharmony_ciconfigdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_infos}}, @{$config{conf_files}}) -}
764e1051a39Sopenharmony_ci        perl configdata.pm -r
765e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "*************************************************"
766e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "***                                           ***"
767e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "***   Please run the same mms command again   ***"
768e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "***                                           ***"
769e1051a39Sopenharmony_ci        @ WRITE SYS$OUTPUT "*************************************************"
770e1051a39Sopenharmony_ci        @ PIPE ( EXIT %X10000000 )
771e1051a39Sopenharmony_ci
772e1051a39Sopenharmony_cireconfigure reconf :
773e1051a39Sopenharmony_ci	perl configdata.pm -r
774e1051a39Sopenharmony_ci
775e1051a39Sopenharmony_ci{-
776e1051a39Sopenharmony_ci  use File::Basename;
777e1051a39Sopenharmony_ci  use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
778e1051a39Sopenharmony_ci  use File::Spec::Unix;
779e1051a39Sopenharmony_ci
780e1051a39Sopenharmony_ci  # Helper function to convert dependencies in platform agnostic form to
781e1051a39Sopenharmony_ci  # dependencies in platform form.
782e1051a39Sopenharmony_ci  sub compute_platform_depends {
783e1051a39Sopenharmony_ci      map { my $x = $_;
784e1051a39Sopenharmony_ci
785e1051a39Sopenharmony_ci            grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
786e1051a39Sopenharmony_ci            or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
787e1051a39Sopenharmony_ci            or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
788e1051a39Sopenharmony_ci            or platform->convertext($x); } @_;
789e1051a39Sopenharmony_ci  }
790e1051a39Sopenharmony_ci
791e1051a39Sopenharmony_ci  # Helper function to figure out dependencies on libraries
792e1051a39Sopenharmony_ci  # It takes a list of library names and outputs a list of dependencies
793e1051a39Sopenharmony_ci  sub compute_lib_depends {
794e1051a39Sopenharmony_ci      # Depending on shared libraries:
795e1051a39Sopenharmony_ci      # On Windows POSIX layers, we depend on {libname}.dll.a
796e1051a39Sopenharmony_ci      # On Unix platforms, we depend on {shlibname}.so
797e1051a39Sopenharmony_ci      return map {
798e1051a39Sopenharmony_ci          { lib   => platform->sharedlib($_) // platform->staticlib($_),
799e1051a39Sopenharmony_ci            attrs => $unified_info{attributes}->{libraries}->{$_} }
800e1051a39Sopenharmony_ci      } @_;
801e1051a39Sopenharmony_ci  }
802e1051a39Sopenharmony_ci
803e1051a39Sopenharmony_ci  # Helper function to deal with inclusion directory specs.
804e1051a39Sopenharmony_ci  # We're dealing with two issues:
805e1051a39Sopenharmony_ci  # 1. A lot of include directory specs take up a lot of command line real
806e1051a39Sopenharmony_ci  #    estate, and the DCL command line is very limited (2KiB).
807e1051a39Sopenharmony_ci  # 2. For optimal usage, include directory paths must be in Unix form,
808e1051a39Sopenharmony_ci  #    that's the only way the C compiler can merge multiple include paths
809e1051a39Sopenharmony_ci  #    in a sane way (we can stop worrying about 1.h including foo/2.h
810e1051a39Sopenharmony_ci  #    including ../3.h).
811e1051a39Sopenharmony_ci  #
812e1051a39Sopenharmony_ci  # To resolve 1, we need to create a file with include directory pragmas,
813e1051a39Sopenharmony_ci  # and let the compiler use it with /FIRST_INCLUDE=.
814e1051a39Sopenharmony_ci  # To resolve 2, we convert all include directory specs we get to Unix,
815e1051a39Sopenharmony_ci  # with available File::Spec functions.
816e1051a39Sopenharmony_ci  #
817e1051a39Sopenharmony_ci  # We use CRC-24 from https://tools.ietf.org/html/rfc4880#section-6,
818e1051a39Sopenharmony_ci  # reimplemented in Perl to get a workable and constant file name for each
819e1051a39Sopenharmony_ci  # combination of include directory specs.  It is assumed that the order of
820e1051a39Sopenharmony_ci  # these directories don't matter.
821e1051a39Sopenharmony_ci  #
822e1051a39Sopenharmony_ci  # This function takes as input a list of include directories
823e1051a39Sopenharmony_ci  # This function returns a list two things:
824e1051a39Sopenharmony_ci  # 1. The file name to use with /FIRST_INCLUDE=
825e1051a39Sopenharmony_ci  # 2. Text to insert into descrip.mms (may be the empty string)
826e1051a39Sopenharmony_ci  sub crc24 {
827e1051a39Sopenharmony_ci      my $input = shift;
828e1051a39Sopenharmony_ci
829e1051a39Sopenharmony_ci      my $init_value = 0x00B704CE;
830e1051a39Sopenharmony_ci      my $poly_value = 0x01864CFB;
831e1051a39Sopenharmony_ci
832e1051a39Sopenharmony_ci      my $crc = $init_value;
833e1051a39Sopenharmony_ci
834e1051a39Sopenharmony_ci      foreach my $x (unpack ('C*', $input)) {
835e1051a39Sopenharmony_ci          $crc ^= $x << 16;
836e1051a39Sopenharmony_ci
837e1051a39Sopenharmony_ci          for (my $i; $i < 8; $i++) {
838e1051a39Sopenharmony_ci              $crc <<= 1;
839e1051a39Sopenharmony_ci              if ($crc & 0x01000000) {
840e1051a39Sopenharmony_ci                  $crc ^= $poly_value;
841e1051a39Sopenharmony_ci              }
842e1051a39Sopenharmony_ci          }
843e1051a39Sopenharmony_ci      }
844e1051a39Sopenharmony_ci      $crc &= 0xFFFFFF;
845e1051a39Sopenharmony_ci
846e1051a39Sopenharmony_ci      return $crc;
847e1051a39Sopenharmony_ci  }
848e1051a39Sopenharmony_ci  my %includefile_cache;
849e1051a39Sopenharmony_ci  sub make_includefile {
850e1051a39Sopenharmony_ci      my %dirs = map {
851e1051a39Sopenharmony_ci          my $udir = make_unix_path(rel2abs($_));
852e1051a39Sopenharmony_ci
853e1051a39Sopenharmony_ci          $udir => 1;
854e1051a39Sopenharmony_ci      } @_;
855e1051a39Sopenharmony_ci      my @dirs = sort keys %dirs;
856e1051a39Sopenharmony_ci      my $filename = sprintf 'incdirs_%x.h', crc24(join(',', @dirs));
857e1051a39Sopenharmony_ci
858e1051a39Sopenharmony_ci      if ($includefile_cache{$filename}) {
859e1051a39Sopenharmony_ci          return ($filename, "");
860e1051a39Sopenharmony_ci      }
861e1051a39Sopenharmony_ci
862e1051a39Sopenharmony_ci      my $scripture = <<"EOF";
863e1051a39Sopenharmony_ci$filename :
864e1051a39Sopenharmony_ci	open/write inc_output $filename
865e1051a39Sopenharmony_ciEOF
866e1051a39Sopenharmony_ci      foreach (@dirs) {
867e1051a39Sopenharmony_ci          $scripture .= <<"EOF";
868e1051a39Sopenharmony_ci	write inc_output "#pragma include_directory ""$_"""
869e1051a39Sopenharmony_ciEOF
870e1051a39Sopenharmony_ci      }
871e1051a39Sopenharmony_ci      $scripture .= <<"EOF";
872e1051a39Sopenharmony_ci	close inc_output
873e1051a39Sopenharmony_ciEOF
874e1051a39Sopenharmony_ci      $includefile_cache{$filename} = $scripture;
875e1051a39Sopenharmony_ci
876e1051a39Sopenharmony_ci      return ($filename, $scripture);
877e1051a39Sopenharmony_ci  }
878e1051a39Sopenharmony_ci
879e1051a39Sopenharmony_ci  # On VMS, (some) header file directories include the files
880e1051a39Sopenharmony_ci  # __DECC_INCLUDE_EPILOGUE.H and __DECC_INCLUDE_PROLOGUE.H.
881e1051a39Sopenharmony_ci  # When header files are generated, and the build directory
882e1051a39Sopenharmony_ci  # isn't the same as the source directory, these files must
883e1051a39Sopenharmony_ci  # be copied alongside the generated header file, or their
884e1051a39Sopenharmony_ci  # effect will be lost.
885e1051a39Sopenharmony_ci  # We use the same include file cache as make_includefile
886e1051a39Sopenharmony_ci  # to check if the scripture to copy these files has already
887e1051a39Sopenharmony_ci  # been generated.
888e1051a39Sopenharmony_ci  sub make_decc_include_files {
889e1051a39Sopenharmony_ci      my $outd = shift;
890e1051a39Sopenharmony_ci      my $ind = shift;
891e1051a39Sopenharmony_ci
892e1051a39Sopenharmony_ci      # If the build directory and the source directory are the
893e1051a39Sopenharmony_ci      # same, there's no need to copy the prologue and epilogue
894e1051a39Sopenharmony_ci      # files.
895e1051a39Sopenharmony_ci      return ('') if $outd eq $ind;
896e1051a39Sopenharmony_ci
897e1051a39Sopenharmony_ci      my $outprologue = catfile($outd, '__DECC_INCLUDE_PROLOGUE.H');
898e1051a39Sopenharmony_ci      my $outepilogue = catfile($outd, '__DECC_INCLUDE_EPILOGUE.H');
899e1051a39Sopenharmony_ci      my $inprologue = catfile($ind, '__DECC_INCLUDE_PROLOGUE.H');
900e1051a39Sopenharmony_ci      my $inepilogue = catfile($ind, '__DECC_INCLUDE_EPILOGUE.H');
901e1051a39Sopenharmony_ci      my @filenames = ();
902e1051a39Sopenharmony_ci      my $scripture = '';
903e1051a39Sopenharmony_ci
904e1051a39Sopenharmony_ci      if ($includefile_cache{$outprologue}) {
905e1051a39Sopenharmony_ci          push @filenames, $outprologue;
906e1051a39Sopenharmony_ci      } elsif (-f $inprologue) {
907e1051a39Sopenharmony_ci          my $local_scripture .= <<"EOF";
908e1051a39Sopenharmony_ci$outprologue : $inprologue
909e1051a39Sopenharmony_ci	COPY $inprologue $outprologue
910e1051a39Sopenharmony_ciEOF
911e1051a39Sopenharmony_ci          $includefile_cache{$outprologue} = $local_scripture;
912e1051a39Sopenharmony_ci
913e1051a39Sopenharmony_ci          push @filenames, $outprologue;
914e1051a39Sopenharmony_ci          $scripture .= $local_scripture;
915e1051a39Sopenharmony_ci      }
916e1051a39Sopenharmony_ci      if ($includefile_cache{$outepilogue}) {
917e1051a39Sopenharmony_ci          push @filenames, $outepilogue;
918e1051a39Sopenharmony_ci      } elsif (-f $inepilogue) {
919e1051a39Sopenharmony_ci          my $local_scripture .= <<"EOF";
920e1051a39Sopenharmony_ci$outepilogue : $inepilogue
921e1051a39Sopenharmony_ci	COPY $inepilogue $outepilogue
922e1051a39Sopenharmony_ciEOF
923e1051a39Sopenharmony_ci          $includefile_cache{$outepilogue} = $local_scripture;
924e1051a39Sopenharmony_ci
925e1051a39Sopenharmony_ci          push @filenames, $outepilogue;
926e1051a39Sopenharmony_ci          $scripture .= $local_scripture;
927e1051a39Sopenharmony_ci      }
928e1051a39Sopenharmony_ci
929e1051a39Sopenharmony_ci      return (@filenames, $scripture);
930e1051a39Sopenharmony_ci  }
931e1051a39Sopenharmony_ci
932e1051a39Sopenharmony_ci  sub generatetarget {
933e1051a39Sopenharmony_ci      my %args = @_;
934e1051a39Sopenharmony_ci      my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
935e1051a39Sopenharmony_ci      return <<"EOF";
936e1051a39Sopenharmony_ci$args{target} : $deps
937e1051a39Sopenharmony_ciEOF
938e1051a39Sopenharmony_ci  }
939e1051a39Sopenharmony_ci
940e1051a39Sopenharmony_ci  sub generatesrc {
941e1051a39Sopenharmony_ci      my %args = @_;
942e1051a39Sopenharmony_ci      my $gen0 = $args{generator}->[0];
943e1051a39Sopenharmony_ci      my $gen_args = join('', map { " $_" }
944e1051a39Sopenharmony_ci                              @{$args{generator}}[1..$#{$args{generator}}]);
945e1051a39Sopenharmony_ci      my $gen_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}});
946e1051a39Sopenharmony_ci      my $deps = join(", -\n\t\t",
947e1051a39Sopenharmony_ci                      compute_platform_depends(@{$args{generator_deps}},
948e1051a39Sopenharmony_ci                                               @{$args{deps}}));
949e1051a39Sopenharmony_ci
950e1051a39Sopenharmony_ci      if ($args{src} =~ /\.html$/) {
951e1051a39Sopenharmony_ci          #
952e1051a39Sopenharmony_ci          # HTML generator
953e1051a39Sopenharmony_ci          #
954e1051a39Sopenharmony_ci          my $title = basename($args{src}, ".html");
955e1051a39Sopenharmony_ci          my $pod = $gen0;
956e1051a39Sopenharmony_ci          my $mkpod2html = sourcefile('util', 'mkpod2html.pl');
957e1051a39Sopenharmony_ci          my $srcdoc = sourcedir('doc');
958e1051a39Sopenharmony_ci          return <<"EOF";
959e1051a39Sopenharmony_ci$args{src} : $pod
960e1051a39Sopenharmony_ci	\$(PERL) $mkpod2html -i $pod -o \$\@ -t "$title" -r "$srcdoc"
961e1051a39Sopenharmony_ciEOF
962e1051a39Sopenharmony_ci      } elsif ($args{src} =~ /\.(\d)$/) {
963e1051a39Sopenharmony_ci          #
964e1051a39Sopenharmony_ci          # Man-page generator, on VMS we simply ignore man-pages
965e1051a39Sopenharmony_ci          #
966e1051a39Sopenharmony_ci          return "";
967e1051a39Sopenharmony_ci      } elsif (platform->isdef($args{src})) {
968e1051a39Sopenharmony_ci          #
969e1051a39Sopenharmony_ci          # Linker script-ish generator
970e1051a39Sopenharmony_ci          #
971e1051a39Sopenharmony_ci          my $target = platform->def($args{src});
972e1051a39Sopenharmony_ci          my $mkdef = sourcefile('util', 'mkdef.pl');
973e1051a39Sopenharmony_ci          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
974e1051a39Sopenharmony_ci          my $ord_name =
975e1051a39Sopenharmony_ci              $args{generator}->[1] || basename($args{product}, '.EXE');
976e1051a39Sopenharmony_ci          my $case_insensitive =
977e1051a39Sopenharmony_ci              $target{$args{intent}.'_cflags'} =~ m|/NAMES=[^/]*AS_IS|i
978e1051a39Sopenharmony_ci              ? '' : ' --case-insensitive';
979e1051a39Sopenharmony_ci          return <<"EOF";
980e1051a39Sopenharmony_ci$target : $gen0 $deps $mkdef
981e1051a39Sopenharmony_ci	\$(PERL) $mkdef$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name "--OS" "VMS"$case_insensitive > $target
982e1051a39Sopenharmony_ciEOF
983e1051a39Sopenharmony_ci      } elsif (platform->isasm($args{src})
984e1051a39Sopenharmony_ci               || platform->iscppasm($args{src})) {
985e1051a39Sopenharmony_ci          #
986e1051a39Sopenharmony_ci          # Assembler generator
987e1051a39Sopenharmony_ci          #
988e1051a39Sopenharmony_ci          my $cppflags =
989e1051a39Sopenharmony_ci              { shlib => "$lib_cflags $lib_cppflags",
990e1051a39Sopenharmony_ci                lib => "$lib_cflags $lib_cppflags",
991e1051a39Sopenharmony_ci                dso => "$dso_cflags $dso_cppflags",
992e1051a39Sopenharmony_ci                bin => "$bin_cflags $bin_cppflags" } -> {$args{intent}};
993e1051a39Sopenharmony_ci          my $defs = join("", map { ",".$_ } @{$args{defs}});
994e1051a39Sopenharmony_ci          my $target = platform->isasm($args{src})
995e1051a39Sopenharmony_ci                       ? platform->asm($args{src})
996e1051a39Sopenharmony_ci                       : $args{src};
997e1051a39Sopenharmony_ci
998e1051a39Sopenharmony_ci          my $generator;
999e1051a39Sopenharmony_ci          if ($gen0 =~ /\.pl$/) {
1000e1051a39Sopenharmony_ci              $generator = '$(PERL)'.$gen_incs.' '.$gen0.$gen_args
1001e1051a39Sopenharmony_ci                  .' '.$cppflags;
1002e1051a39Sopenharmony_ci          } elsif ($gen0 =~ /\.S$/) {
1003e1051a39Sopenharmony_ci              $generator = undef;
1004e1051a39Sopenharmony_ci          } else {
1005e1051a39Sopenharmony_ci              die "Generator type for $src unknown: $gen0.$gen_args\n";
1006e1051a39Sopenharmony_ci          }
1007e1051a39Sopenharmony_ci
1008e1051a39Sopenharmony_ci          if (defined($generator)) {
1009e1051a39Sopenharmony_ci              return <<"EOF";
1010e1051a39Sopenharmony_ci$target : $gen0 $deps
1011e1051a39Sopenharmony_ci        \@ extradefines = "$defs"
1012e1051a39Sopenharmony_ci	$generator \$\@
1013e1051a39Sopenharmony_ci        \@ DELETE/SYMBOL/LOCAL extradefines
1014e1051a39Sopenharmony_ciEOF
1015e1051a39Sopenharmony_ci          }
1016e1051a39Sopenharmony_ci          return <<"EOF";
1017e1051a39Sopenharmony_ci$target : $gen0 $deps
1018e1051a39Sopenharmony_ci        \@ extradefines = "$defs"
1019e1051a39Sopenharmony_ci        PIPE \$(CPP) $cppflags $gen0 | -
1020e1051a39Sopenharmony_ci        \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@
1021e1051a39Sopenharmony_ci        \@ DELETE/SYMBOL/LOCAL extradefines
1022e1051a39Sopenharmony_ciEOF
1023e1051a39Sopenharmony_ci      } elsif ($gen0 =~ m|^.*\.in$|) {
1024e1051a39Sopenharmony_ci          #
1025e1051a39Sopenharmony_ci          # "dofile" generator (file.in -> file)
1026e1051a39Sopenharmony_ci          #
1027e1051a39Sopenharmony_ci          my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1028e1051a39Sopenharmony_ci                                               "util", "dofile.pl")),
1029e1051a39Sopenharmony_ci                               rel2abs($config{builddir}));
1030e1051a39Sopenharmony_ci          my @perlmodules = ( 'configdata.pm',
1031e1051a39Sopenharmony_ci                              grep { $_ =~ m|\.pm$| } @{$args{deps}} );
1032e1051a39Sopenharmony_ci          my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules;
1033e1051a39Sopenharmony_ci          my @decc_include_data
1034e1051a39Sopenharmony_ci              = make_decc_include_files(dirname($args{src}), dirname($gen0));
1035e1051a39Sopenharmony_ci          my $decc_include_scripture = pop @decc_include_data;
1036e1051a39Sopenharmony_ci          $deps = join(' ', $deps, @decc_include_data,
1037e1051a39Sopenharmony_ci                            compute_platform_depends(@perlmodules));
1038e1051a39Sopenharmony_ci          @perlmodules = map { '"-M'.basename($_, '.pm').'"' } @perlmodules;
1039e1051a39Sopenharmony_ci          my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @perlmodules);
1040e1051a39Sopenharmony_ci
1041e1051a39Sopenharmony_ci          return <<"EOF";
1042e1051a39Sopenharmony_ci$args{src} : $gen0 $deps
1043e1051a39Sopenharmony_ci	\$(PERL)$perlmodules $dofile "-o$target{build_file}" $gen0$gen_args > \$\@
1044e1051a39Sopenharmony_ci$decc_include_scripture
1045e1051a39Sopenharmony_ciEOF
1046e1051a39Sopenharmony_ci      } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
1047e1051a39Sopenharmony_ci          #
1048e1051a39Sopenharmony_ci          # Generic generator using OpenSSL programs
1049e1051a39Sopenharmony_ci          #
1050e1051a39Sopenharmony_ci
1051e1051a39Sopenharmony_ci          # Redo $gen0, to ensure that we have the proper extension
1052e1051a39Sopenharmony_ci          $gen0 = platform->bin($gen0);
1053e1051a39Sopenharmony_ci          return <<"EOF";
1054e1051a39Sopenharmony_ci$args{src} : $gen0 $deps
1055e1051a39Sopenharmony_ci	PIPE MCR $gen0$gen_args > \$@
1056e1051a39Sopenharmony_ciEOF
1057e1051a39Sopenharmony_ci      } else {
1058e1051a39Sopenharmony_ci          #
1059e1051a39Sopenharmony_ci          # Generic generator using Perl
1060e1051a39Sopenharmony_ci          #
1061e1051a39Sopenharmony_ci          return <<"EOF";
1062e1051a39Sopenharmony_ci$args{src} : $gen0 $deps
1063e1051a39Sopenharmony_ci	\$(PERL)$gen_incs $gen0$gen_args > \$\@
1064e1051a39Sopenharmony_ciEOF
1065e1051a39Sopenharmony_ci      }
1066e1051a39Sopenharmony_ci  }
1067e1051a39Sopenharmony_ci
1068e1051a39Sopenharmony_ci  sub src2obj {
1069e1051a39Sopenharmony_ci      my $asmext = platform->asmext();
1070e1051a39Sopenharmony_ci      my %args = @_;
1071e1051a39Sopenharmony_ci      my @srcs =
1072e1051a39Sopenharmony_ci          map { my $x = $_;
1073e1051a39Sopenharmony_ci                (platform->isasm($x) && grep { $x eq $_ } @generated)
1074e1051a39Sopenharmony_ci                ? platform->asm($x) : $x }
1075e1051a39Sopenharmony_ci          ( @{$args{srcs}} );
1076e1051a39Sopenharmony_ci      my $obj = platform->obj($args{obj});
1077e1051a39Sopenharmony_ci      my $dep = platform->dep($args{obj});
1078e1051a39Sopenharmony_ci      my $deps = join(", -\n\t\t", @srcs, @{$args{deps}});
1079e1051a39Sopenharmony_ci
1080e1051a39Sopenharmony_ci      # Because VMS C isn't very good at combining a /INCLUDE path with
1081e1051a39Sopenharmony_ci      # #includes having a relative directory (like '#include "../foo.h"),
1082e1051a39Sopenharmony_ci      # the best choice is to move to the first source file's intended
1083e1051a39Sopenharmony_ci      # directory before compiling, and make sure to write the object file
1084e1051a39Sopenharmony_ci      # in the correct position (important when the object tree is other
1085e1051a39Sopenharmony_ci      # than the source tree).
1086e1051a39Sopenharmony_ci      my $forward = dirname($args{srcs}->[0]);
1087e1051a39Sopenharmony_ci      my $backward = abs2rel(rel2abs("."), rel2abs($forward));
1088e1051a39Sopenharmony_ci      my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward));
1089e1051a39Sopenharmony_ci      my $objn = basename($obj);
1090e1051a39Sopenharmony_ci      my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
1091e1051a39Sopenharmony_ci      my $depn = basename($dep);
1092e1051a39Sopenharmony_ci      my $srcs =
1093e1051a39Sopenharmony_ci          join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs);
1094e1051a39Sopenharmony_ci      my $incextra = join(',', map { "\"$_\"" }
1095e1051a39Sopenharmony_ci                               @{$unified_info{includes_extra}->{$obj}});
1096e1051a39Sopenharmony_ci      $incextra = "/INCLUDE=($incextra)" if $incextra;
1097e1051a39Sopenharmony_ci
1098e1051a39Sopenharmony_ci      my $cflags;
1099e1051a39Sopenharmony_ci      if ($args{attrs}->{noinst}) {
1100e1051a39Sopenharmony_ci          $cflags .= { shlib => $lib_cflags_no_inst,
1101e1051a39Sopenharmony_ci                       lib => $lib_cflags_no_inst,
1102e1051a39Sopenharmony_ci                       dso => $dso_cflags_no_inst,
1103e1051a39Sopenharmony_ci                       bin => $bin_cflags_no_inst } -> {$args{intent}};
1104e1051a39Sopenharmony_ci      } else {
1105e1051a39Sopenharmony_ci          $cflags .= { shlib => $lib_cflags,
1106e1051a39Sopenharmony_ci                       lib => $lib_cflags,
1107e1051a39Sopenharmony_ci                       dso => $dso_cflags,
1108e1051a39Sopenharmony_ci                       bin => $bin_cflags } -> {$args{intent}};
1109e1051a39Sopenharmony_ci      }
1110e1051a39Sopenharmony_ci      $cflags .= { shlib => $lib_cppflags,
1111e1051a39Sopenharmony_ci		   lib => $lib_cppflags,
1112e1051a39Sopenharmony_ci		   dso => $dso_cppflags,
1113e1051a39Sopenharmony_ci		   bin => $bin_cppflags } -> {$args{intent}};
1114e1051a39Sopenharmony_ci      $cflags .= $incextra;
1115e1051a39Sopenharmony_ci      my $defs = join("", map { ",".$_ } @{$args{defs}});
1116e1051a39Sopenharmony_ci      my $asflags = { shlib => $lib_asflags,
1117e1051a39Sopenharmony_ci		      lib => $lib_asflags,
1118e1051a39Sopenharmony_ci		      dso => $dso_asflags,
1119e1051a39Sopenharmony_ci		      bin => $bin_asflags } -> {$args{intent}};
1120e1051a39Sopenharmony_ci
1121e1051a39Sopenharmony_ci      if ($srcs[0] =~ /\Q${asmext}\E$/) {
1122e1051a39Sopenharmony_ci          return <<"EOF";
1123e1051a39Sopenharmony_ci$obj : $deps
1124e1051a39Sopenharmony_ci        SET DEFAULT $forward
1125e1051a39Sopenharmony_ci        \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn} $srcs
1126e1051a39Sopenharmony_ci        SET DEFAULT $backward
1127e1051a39Sopenharmony_ci        - PURGE $obj
1128e1051a39Sopenharmony_ciEOF
1129e1051a39Sopenharmony_ci      } elsif ($srcs[0] =~ /.S$/) {
1130e1051a39Sopenharmony_ci         return <<"EOF";
1131e1051a39Sopenharmony_ci$obj : $deps
1132e1051a39Sopenharmony_ci        SET DEFAULT $forward
1133e1051a39Sopenharmony_ci        \@ $incs_on
1134e1051a39Sopenharmony_ci        \@ extradefines = "$defs"
1135e1051a39Sopenharmony_ci        PIPE \$(CPP) ${cflags} $srcs | -
1136e1051a39Sopenharmony_ci             \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" -
1137e1051a39Sopenharmony_ci             > ${objd}${objn}-asm
1138e1051a39Sopenharmony_ci        \@ DELETE/SYMBOL/LOCAL extradefines
1139e1051a39Sopenharmony_ci        \@ $incs_off
1140e1051a39Sopenharmony_ci        SET DEFAULT $backward
1141e1051a39Sopenharmony_ci        \$(AS) $asflags \$(ASOUTFLAG)$obj $obj-asm
1142e1051a39Sopenharmony_ci        - PURGE $obj
1143e1051a39Sopenharmony_ciEOF
1144e1051a39Sopenharmony_ci      }
1145e1051a39Sopenharmony_ci
1146e1051a39Sopenharmony_ci      my ($incdir_filename, $incdir_scripture) =
1147e1051a39Sopenharmony_ci          make_includefile(@{ { shlib => [ @lib_cppincludes ],
1148e1051a39Sopenharmony_ci                                lib => [ @lib_cppincludes ],
1149e1051a39Sopenharmony_ci                                dso => [ @dso_cppincludes ],
1150e1051a39Sopenharmony_ci                                bin => [ @bin_cppincludes ] } -> {$args{intent}} },
1151e1051a39Sopenharmony_ci                           @{$args{incs}});
1152e1051a39Sopenharmony_ci      $deps .= ", -\n\t\t$incdir_filename";
1153e1051a39Sopenharmony_ci      $cflags =
1154e1051a39Sopenharmony_ci          $target{cflag_incfirst}
1155e1051a39Sopenharmony_ci          . '"'.make_unix_path(rel2abs($incdir_filename)).'"'
1156e1051a39Sopenharmony_ci          . $cflags;
1157e1051a39Sopenharmony_ci
1158e1051a39Sopenharmony_ci      my $depbuild = $disabled{makedepend} ? ""
1159e1051a39Sopenharmony_ci          : " /MMS=(FILE=${depd}${depn},TARGET=$obj)";
1160e1051a39Sopenharmony_ci
1161e1051a39Sopenharmony_ci      return <<"EOF";
1162e1051a39Sopenharmony_ci$obj : $deps
1163e1051a39Sopenharmony_ci        SET DEFAULT $forward
1164e1051a39Sopenharmony_ci        \@ $incs_on
1165e1051a39Sopenharmony_ci        \@ extradefines = "$defs"
1166e1051a39Sopenharmony_ci        \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn} /REPOSITORY=$backward $srcs
1167e1051a39Sopenharmony_ci        \@ DELETE/SYMBOL/LOCAL extradefines
1168e1051a39Sopenharmony_ci        \@ $incs_off
1169e1051a39Sopenharmony_ci        SET DEFAULT $backward
1170e1051a39Sopenharmony_ci        - PURGE $obj
1171e1051a39Sopenharmony_ci$incdir_scripture
1172e1051a39Sopenharmony_ciEOF
1173e1051a39Sopenharmony_ci  }
1174e1051a39Sopenharmony_ci  sub obj2shlib {
1175e1051a39Sopenharmony_ci      my %args = @_;
1176e1051a39Sopenharmony_ci      my $shlibname = platform->sharedname($args{lib});
1177e1051a39Sopenharmony_ci      my $shlib = platform->sharedlib($args{lib});
1178e1051a39Sopenharmony_ci      my @objs = map { platform->convertext($_) }
1179e1051a39Sopenharmony_ci                 grep { platform->isobj($_) }
1180e1051a39Sopenharmony_ci                 @{$args{objs}};
1181e1051a39Sopenharmony_ci      my @defs = map { platform->convertext($_) }
1182e1051a39Sopenharmony_ci                 grep { platform->isdef($_) }
1183e1051a39Sopenharmony_ci                 @{$args{objs}};
1184e1051a39Sopenharmony_ci      my @deps = compute_lib_depends(@{$args{deps}});
1185e1051a39Sopenharmony_ci      die "More than one symbol vector" if scalar @defs > 1;
1186e1051a39Sopenharmony_ci      my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1187e1051a39Sopenharmony_ci      my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1188e1051a39Sopenharmony_ci      my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir},
1189e1051a39Sopenharmony_ci                                                     "VMS", "translatesyms.pl")),
1190e1051a39Sopenharmony_ci                                     rel2abs($config{builddir}));
1191e1051a39Sopenharmony_ci      # The "[]" hack is because in .OPT files, each line inherits the
1192e1051a39Sopenharmony_ci      # previous line's file spec as default, so if no directory spec
1193e1051a39Sopenharmony_ci      # is present in the current line and the previous line has one that
1194e1051a39Sopenharmony_ci      # doesn't apply, you're in for a surprise.
1195e1051a39Sopenharmony_ci      my $write_opt1 =
1196e1051a39Sopenharmony_ci          join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1197e1051a39Sopenharmony_ci                                 "WRITE OPT_FILE \"$x" } @objs).
1198e1051a39Sopenharmony_ci          "\"";
1199e1051a39Sopenharmony_ci      my $write_opt2 =
1200e1051a39Sopenharmony_ci          join("\n\t", map { my $x = $_->{lib} =~ /\[/
1201e1051a39Sopenharmony_ci                                 ? $_->{lib} : "[]".$_->{lib};
1202e1051a39Sopenharmony_ci                             $x =~ s|(\.EXE)|$1/SHARE|;
1203e1051a39Sopenharmony_ci                             $x =~ s|(\.OLB)|$1/LIB|;
1204e1051a39Sopenharmony_ci                             "WRITE OPT_FILE \"$x\"" } @deps)
1205e1051a39Sopenharmony_ci          || "\@ !";
1206e1051a39Sopenharmony_ci      return <<"EOF"
1207e1051a39Sopenharmony_ci$shlib : $deps
1208e1051a39Sopenharmony_ci        \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated
1209e1051a39Sopenharmony_ci        OPEN/WRITE/SHARE=READ OPT_FILE $shlibname-components.OPT
1210e1051a39Sopenharmony_ci        $write_opt1
1211e1051a39Sopenharmony_ci        $write_opt2
1212e1051a39Sopenharmony_ci        CLOSE OPT_FILE
1213e1051a39Sopenharmony_ci        LINK ${lib_ldflags}/SHARE=\$\@ $defs[0]-translated/OPT,-
1214e1051a39Sopenharmony_ci                $shlibname-components.OPT/OPT \$(LIB_EX_LIBS)
1215e1051a39Sopenharmony_ci        DELETE $defs[0]-translated;*,$shlibname-components.OPT;*
1216e1051a39Sopenharmony_ci        PURGE $shlibname.EXE,$shlibname.MAP
1217e1051a39Sopenharmony_ciEOF
1218e1051a39Sopenharmony_ci        . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1219e1051a39Sopenharmony_ci        SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1220e1051a39Sopenharmony_ciEOF
1221e1051a39Sopenharmony_ci        );
1222e1051a39Sopenharmony_ci  }
1223e1051a39Sopenharmony_ci  sub obj2dso {
1224e1051a39Sopenharmony_ci      my %args = @_;
1225e1051a39Sopenharmony_ci      my $dsoname = platform->dsoname($args{module});
1226e1051a39Sopenharmony_ci      my $dso = platform->dso($args{module});
1227e1051a39Sopenharmony_ci      my @objs = map { platform->convertext($_) }
1228e1051a39Sopenharmony_ci                 grep { platform->isobj($_) }
1229e1051a39Sopenharmony_ci                 @{$args{objs}};
1230e1051a39Sopenharmony_ci      my @defs = map { platform->convertext($_) }
1231e1051a39Sopenharmony_ci                 grep { platform->isdef($_) }
1232e1051a39Sopenharmony_ci                 @{$args{objs}};
1233e1051a39Sopenharmony_ci      my @deps = compute_lib_depends(@{$args{deps}});
1234e1051a39Sopenharmony_ci      my $deps = join(", -\n\t\t", @objs, @defs, map { $_->{lib} } @deps);
1235e1051a39Sopenharmony_ci      die "More than one symbol vector" if scalar @defs > 1;
1236e1051a39Sopenharmony_ci      my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
1237e1051a39Sopenharmony_ci      # The "[]" hack is because in .OPT files, each line inherits the
1238e1051a39Sopenharmony_ci      # previous line's file spec as default, so if no directory spec
1239e1051a39Sopenharmony_ci      # is present in the current line and the previous line has one that
1240e1051a39Sopenharmony_ci      # doesn't apply, you're in for a surprise.
1241e1051a39Sopenharmony_ci      my $write_opt1 =
1242e1051a39Sopenharmony_ci          join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1243e1051a39Sopenharmony_ci                                 "WRITE OPT_FILE \"$x" } @objs).
1244e1051a39Sopenharmony_ci          "\"";
1245e1051a39Sopenharmony_ci      my $write_opt2 =
1246e1051a39Sopenharmony_ci          join("\n\t", map { my $x = $_->{lib} =~ /\[/
1247e1051a39Sopenharmony_ci                                 ? $_->{lib} : "[]".$_->{lib};
1248e1051a39Sopenharmony_ci                             $x =~ s|(\.EXE)|$1/SHARE|;
1249e1051a39Sopenharmony_ci                             $x =~ s|(\.OLB)|$1/LIB|;
1250e1051a39Sopenharmony_ci                             "WRITE OPT_FILE \"$x\"" } @deps)
1251e1051a39Sopenharmony_ci          || "\@ !";
1252e1051a39Sopenharmony_ci      return <<"EOF"
1253e1051a39Sopenharmony_ci$dso : $deps
1254e1051a39Sopenharmony_ci        OPEN/WRITE/SHARE=READ OPT_FILE $dsoname-components.OPT
1255e1051a39Sopenharmony_ci        $write_opt1
1256e1051a39Sopenharmony_ci        $write_opt2
1257e1051a39Sopenharmony_ci        CLOSE OPT_FILE
1258e1051a39Sopenharmony_ci        LINK ${dso_ldflags}/SHARE=\$\@ $defs[0]/OPT,-
1259e1051a39Sopenharmony_ci		$dsoname-components.OPT/OPT \$(DSO_EX_LIBS)
1260e1051a39Sopenharmony_ci        - PURGE $dsoname.EXE,$dsoname.OPT,$dsoname.MAP
1261e1051a39Sopenharmony_ciEOF
1262e1051a39Sopenharmony_ci        . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1263e1051a39Sopenharmony_ci        SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1264e1051a39Sopenharmony_ciEOF
1265e1051a39Sopenharmony_ci        );
1266e1051a39Sopenharmony_ci  }
1267e1051a39Sopenharmony_ci  sub obj2lib {
1268e1051a39Sopenharmony_ci      my %args = @_;
1269e1051a39Sopenharmony_ci      my $lib = platform->staticlib($args{lib});
1270e1051a39Sopenharmony_ci      my @objs = map { platform->convertext($_) }
1271e1051a39Sopenharmony_ci                 grep { platform->isobj($_) }
1272e1051a39Sopenharmony_ci                 @{$args{objs}};
1273e1051a39Sopenharmony_ci      my $objs = join(", -\n\t\t", @objs);
1274e1051a39Sopenharmony_ci      my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib $_" } @objs));
1275e1051a39Sopenharmony_ci      return <<"EOF";
1276e1051a39Sopenharmony_ci$lib : $objs
1277e1051a39Sopenharmony_ci        LIBRARY/CREATE/OBJECT $lib
1278e1051a39Sopenharmony_ci        $fill_lib
1279e1051a39Sopenharmony_ci        - PURGE $lib
1280e1051a39Sopenharmony_ciEOF
1281e1051a39Sopenharmony_ci  }
1282e1051a39Sopenharmony_ci  sub obj2bin {
1283e1051a39Sopenharmony_ci      my %args = @_;
1284e1051a39Sopenharmony_ci      my $bin = platform->bin($args{bin});
1285e1051a39Sopenharmony_ci      my $binname = platform->binname($args{bin});
1286e1051a39Sopenharmony_ci      my @objs = map { platform->convertext($_) }
1287e1051a39Sopenharmony_ci                 grep { platform->isobj($_) }
1288e1051a39Sopenharmony_ci                 @{$args{objs}};
1289e1051a39Sopenharmony_ci      my $objs = join(",", @objs);
1290e1051a39Sopenharmony_ci      my @deps = compute_lib_depends(@{$args{deps}});
1291e1051a39Sopenharmony_ci      my $deps = join(", -\n\t\t", @objs, map { $_->{lib} } @deps);
1292e1051a39Sopenharmony_ci
1293e1051a39Sopenharmony_ci      my $olb_count = scalar grep(m|\.OLB$|, map { $_->{lib} } @deps);
1294e1051a39Sopenharmony_ci      my $analyse_objs = "@ !";
1295e1051a39Sopenharmony_ci      if ($olb_count > 0) {
1296e1051a39Sopenharmony_ci          my $analyse_quals =
1297e1051a39Sopenharmony_ci              $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB";
1298e1051a39Sopenharmony_ci          $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1"
1299e1051a39Sopenharmony_ci      }
1300e1051a39Sopenharmony_ci      # The "[]" hack is because in .OPT files, each line inherits the
1301e1051a39Sopenharmony_ci      # previous line's file spec as default, so if no directory spec
1302e1051a39Sopenharmony_ci      # is present in the current line and the previous line has one that
1303e1051a39Sopenharmony_ci      # doesn't apply, you're in for a surprise.
1304e1051a39Sopenharmony_ci      my $write_opt1 =
1305e1051a39Sopenharmony_ci          join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_;
1306e1051a39Sopenharmony_ci                                 "\@ WRITE OPT_FILE \"$x" } @objs).
1307e1051a39Sopenharmony_ci          "\"";
1308e1051a39Sopenharmony_ci      my $write_opt2 =
1309e1051a39Sopenharmony_ci          join("\n\t", "WRITE OPT_FILE \"CASE_SENSITIVE=YES\"",
1310e1051a39Sopenharmony_ci                       map { my @lines = ();
1311e1051a39Sopenharmony_ci                             use Data::Dumper;
1312e1051a39Sopenharmony_ci                             my $x = $_->{lib} =~ /\[/
1313e1051a39Sopenharmony_ci                                 ? $_->{lib} : "[]".$_->{lib};
1314e1051a39Sopenharmony_ci                             if ($x =~ m|\.EXE$|) {
1315e1051a39Sopenharmony_ci                                 push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\"";
1316e1051a39Sopenharmony_ci                             } elsif ($x =~ m|\.OLB$|) {
1317e1051a39Sopenharmony_ci                                 # Special hack to include the MAIN object
1318e1051a39Sopenharmony_ci                                 # module explicitly.  This will only be done
1319e1051a39Sopenharmony_ci                                 # if there isn't a 'main' in the program's
1320e1051a39Sopenharmony_ci                                 # object modules already.
1321e1051a39Sopenharmony_ci                                 my $main = $_->{attrs}->{has_main}
1322e1051a39Sopenharmony_ci                                     ? '/INCLUDE=main' : '';
1323e1051a39Sopenharmony_ci                                 push @lines,
1324e1051a39Sopenharmony_ci                                     "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB$main\"",
1325e1051a39Sopenharmony_ci                                     "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\""
1326e1051a39Sopenharmony_ci                             }
1327e1051a39Sopenharmony_ci                             @lines
1328e1051a39Sopenharmony_ci                           } @deps)
1329e1051a39Sopenharmony_ci          || "\@ !";
1330e1051a39Sopenharmony_ci      # The linking commands looks a bit complex, but it's for good reason.
1331e1051a39Sopenharmony_ci      # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and
1332e1051a39Sopenharmony_ci      # bar.obj happens to have a symbol that also exists in libsomething.exe,
1333e1051a39Sopenharmony_ci      # the linker will warn about it, loudly, and will then choose to pick
1334e1051a39Sopenharmony_ci      # the first copy encountered (the one in bar.obj in this example).
1335e1051a39Sopenharmony_ci      # On Unix and on Windows, the corresponding maneuver goes through
1336e1051a39Sopenharmony_ci      # silently with the same effect.
1337e1051a39Sopenharmony_ci      # With some test programs, made for checking the internals of OpenSSL,
1338e1051a39Sopenharmony_ci      # we do this kind of linking deliberately, picking a few specific object
1339e1051a39Sopenharmony_ci      # files from within [.crypto] or [.ssl] so we can reach symbols that are
1340e1051a39Sopenharmony_ci      # otherwise unreachable (since the shareable images only exports the
1341e1051a39Sopenharmony_ci      # symbols listed in [.util]*.num), and then with the shared libraries
1342e1051a39Sopenharmony_ci      # themselves.  So we need to silence the warning about multiply defined
1343e1051a39Sopenharmony_ci      # symbols, to mimic the way linking work on Unix and Windows, and so
1344e1051a39Sopenharmony_ci      # the build isn't interrupted (MMS stops when warnings are signaled,
1345e1051a39Sopenharmony_ci      # by default), and so someone building doesn't have to worry where it
1346e1051a39Sopenharmony_ci      # isn't necessary.  If there are other warnings, however, we show them
1347e1051a39Sopenharmony_ci      # and let it break the build.
1348e1051a39Sopenharmony_ci      return <<"EOF"
1349e1051a39Sopenharmony_ci$bin : $deps
1350e1051a39Sopenharmony_ci        $analyse_objs
1351e1051a39Sopenharmony_ci        @ OPEN/WRITE/SHARE=READ OPT_FILE $binname.OPT
1352e1051a39Sopenharmony_ci        $write_opt1
1353e1051a39Sopenharmony_ci        $write_opt2
1354e1051a39Sopenharmony_ci        @ CLOSE OPT_FILE
1355e1051a39Sopenharmony_ci        TYPE $binname.OPT ! For debugging
1356e1051a39Sopenharmony_ci        - pipe SPAWN/WAIT/NOLOG/OUT=$binname.LINKLOG -
1357e1051a39Sopenharmony_ci                    LINK ${bin_ldflags}/EXEC=\$\@ $binname.OPT/OPT \$(BIN_EX_LIBS) ; -
1358e1051a39Sopenharmony_ci               link_status = \$status ; link_severity = link_status .AND. 7
1359e1051a39Sopenharmony_ci        @ search_severity = 1
1360e1051a39Sopenharmony_ci        -@ IF link_severity .EQ. 0 THEN -
1361e1051a39Sopenharmony_ci                pipe SEARCH $binname.LINKLOG "%","-"/MATCH=AND | -
1362e1051a39Sopenharmony_ci                     SPAWN/WAIT/NOLOG/OUT=NLA0: -
1363e1051a39Sopenharmony_ci                          SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; -
1364e1051a39Sopenharmony_ci                     search_severity = \$severity
1365e1051a39Sopenharmony_ci        @ ! search_severity is 3 when the last search didn't find any matching
1366e1051a39Sopenharmony_ci        @ ! string: %SEARCH-I-NOMATCHES, no strings matched
1367e1051a39Sopenharmony_ci        @ ! If that was the result, we pretend linking got through without
1368e1051a39Sopenharmony_ci        @ ! fault or warning.
1369e1051a39Sopenharmony_ci        @ IF search_severity .EQ. 3 THEN link_severity = 1
1370e1051a39Sopenharmony_ci        @ ! At this point, if link_severity shows that there was a fault
1371e1051a39Sopenharmony_ci        @ ! or warning, make sure to restore the linking status.
1372e1051a39Sopenharmony_ci        -@ IF .NOT. link_severity THEN TYPE $binname.LINKLOG
1373e1051a39Sopenharmony_ci        -@ DELETE $binname.LINKLOG;*
1374e1051a39Sopenharmony_ci        @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status'
1375e1051a39Sopenharmony_ci        - PURGE $bin,$binname.OPT
1376e1051a39Sopenharmony_ciEOF
1377e1051a39Sopenharmony_ci      . ($config{target} =~ m|alpha| ? "" : <<"EOF"
1378e1051a39Sopenharmony_ci        SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@
1379e1051a39Sopenharmony_ciEOF
1380e1051a39Sopenharmony_ci        );
1381e1051a39Sopenharmony_ci  }
1382e1051a39Sopenharmony_ci  sub in2script {
1383e1051a39Sopenharmony_ci      my %args = @_;
1384e1051a39Sopenharmony_ci      my $script = $args{script};
1385e1051a39Sopenharmony_ci      return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite!
1386e1051a39Sopenharmony_ci      my $sources = join(" ", @{$args{sources}});
1387e1051a39Sopenharmony_ci      my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
1388e1051a39Sopenharmony_ci                                           "util", "dofile.pl")),
1389e1051a39Sopenharmony_ci                           rel2abs($config{builddir}));
1390e1051a39Sopenharmony_ci      return <<"EOF";
1391e1051a39Sopenharmony_ci$script : $sources configdata.pm
1392e1051a39Sopenharmony_ci        \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile -
1393e1051a39Sopenharmony_ci	    "-o$target{build_file}" $sources > $script
1394e1051a39Sopenharmony_ci        SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script
1395e1051a39Sopenharmony_ci        PURGE $script
1396e1051a39Sopenharmony_ciEOF
1397e1051a39Sopenharmony_ci  }
1398e1051a39Sopenharmony_ci  ""    # Important!  This becomes part of the template result.
1399e1051a39Sopenharmony_ci-}
1400