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