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 christos use File::Basename; 7 1.1 christos 8 1.1 christos # Our prefix, claimed when speaking with the VSI folks Tuesday 9 1.1 christos # January 26th 2016 10 1.1 christos our $osslprefix = 'OSSL$'; 11 1.1 christos (our $osslprefix_q = $osslprefix) =~ s/\$/\\\$/; 12 1.1 christos 13 1.1 christos our $sover_dirname = sprintf "%02d%02d", split(/\./, $config{shlib_version_number}); 14 1.1 christos our $osslver = sprintf "%02d%02d", split(/\./, $config{version}); 15 1.1 christos 16 1.1 christos our $sourcedir = $config{sourcedir}; 17 1.1 christos our $builddir = $config{builddir}; 18 1.1 christos sub sourcefile { 19 1.1 christos catfile($sourcedir, @_); 20 1.1 christos } 21 1.1 christos sub buildfile { 22 1.1 christos catfile($builddir, @_); 23 1.1 christos } 24 1.1 christos sub sourcedir { 25 1.1 christos catdir($sourcedir, @_); 26 1.1 christos } 27 1.1 christos sub builddir { 28 1.1 christos catdir($builddir, @_); 29 1.1 christos } 30 1.1 christos sub tree { 31 1.1 christos (my $x = shift) =~ s|\]$|...]|; 32 1.1 christos $x 33 1.1 christos } 34 1.1 christos sub move { 35 1.1 christos my $f = catdir(@_); 36 1.1 christos my $b = abs2rel(rel2abs("."),rel2abs($f)); 37 1.1 christos $sourcedir = catdir($b,$sourcedir) 38 1.1 christos if !file_name_is_absolute($sourcedir); 39 1.1 christos $builddir = catdir($b,$builddir) 40 1.1 christos if !file_name_is_absolute($builddir); 41 1.1 christos ""; 42 1.1 christos } 43 1.1 christos 44 1.1 christos # Because we need to make two computations of these data, 45 1.1 christos # we store them in arrays for reuse 46 1.1 christos our @libs = 47 1.1 christos map { (my $x = $_) =~ s/\.a$//; $x } 48 1.1 christos @{$unified_info{libraries}}; 49 1.1 christos our @shlibs = 50 1.1 christos map { $unified_info{sharednames}->{$_} || () } 51 1.1 christos grep(!/\.a$/, @{$unified_info{libraries}}); 52 1.1 christos our @install_libs = 53 1.1 christos map { (my $x = $_) =~ s/\.a$//; $x } 54 1.1 christos @{$unified_info{install}->{libraries}}; 55 1.1 christos our @install_shlibs = 56 1.1 christos map { $unified_info{sharednames}->{$_} || () } 57 1.1 christos grep(!/\.a$/, @{$unified_info{install}->{libraries}}); 58 1.1 christos 59 1.1 christos # This is a horrible hack, but is needed because recursive inclusion of files 60 1.1 christos # in different directories does not work well with HP C. 61 1.1 christos my $sd = sourcedir("crypto", "async", "arch"); 62 1.1 christos foreach (grep /\[\.crypto\.async\.arch\].*\.o$/, keys %{$unified_info{sources}}) { 63 1.1 christos (my $x = $_) =~ s|\.o$|.OBJ|; 64 1.1 christos $unified_info{before}->{$x} 65 1.1 christos = qq(arch_include = F\$PARSE("$sd","A.;",,,"SYNTAX_ONLY") - "A.;" 66 1.1 christos define arch 'arch_include'); 67 1.1 christos $unified_info{after}->{$x} 68 1.1 christos = qq(deassign arch); 69 1.1 christos } 70 1.1 christos my $sd1 = sourcedir("ssl","record"); 71 1.1 christos my $sd2 = sourcedir("ssl","statem"); 72 1.1 christos my @ssl_locl_users = grep(/^\[\.(?:ssl\.(?:record|statem)|test)\].*\.o$/, 73 1.1 christos keys %{$unified_info{sources}}); 74 1.1 christos foreach (@ssl_locl_users) { 75 1.1 christos (my $x = $_) =~ s|\.o$|.OBJ|; 76 1.1 christos $unified_info{before}->{$x} 77 1.1 christos = qq(record_include = F\$PARSE("$sd1","A.;",,,"SYNTAX_ONLY") - "A.;" 78 1.1 christos define record 'record_include' 79 1.1 christos statem_include = F\$PARSE("$sd2","A.;",,,"SYNTAX_ONLY") - "A.;" 80 1.1 christos define statem 'statem_include'); 81 1.1 christos $unified_info{after}->{$x} 82 1.1 christos = qq(deassign statem 83 1.1 christos deassign record); 84 1.1 christos } 85 1.1 christos # This makes sure things get built in the order they need 86 1.1 christos # to. You're welcome. 87 1.1 christos sub dependmagic { 88 1.1 christos my $target = shift; 89 1.1 christos 90 1.1 christos return "$target : build_generated\n\t\pipe \$(MMS) \$(MMSQUALIFIERS) depend && \$(MMS) \$(MMSQUALIFIERS) _$target\n_$target"; 91 1.1 christos } 92 1.1 christos #use Data::Dumper; 93 1.1 christos #print STDERR "DEBUG: before:\n", Dumper($unified_info{before}); 94 1.1 christos #print STDERR "DEBUG: after:\n", Dumper($unified_info{after}); 95 1.1 christos ""; 96 1.1 christos -} 97 1.1 christos PLATFORM={- $config{target} -} 98 1.1 christos OPTIONS={- $config{options} -} 99 1.1 christos CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) 100 1.1 christos SRCDIR={- $config{sourcedir} -} 101 1.1 christos BLDDIR={- $config{builddir} -} 102 1.1 christos 103 1.1 christos # Allow both V and VERBOSE to indicate verbosity. This only applies 104 1.1 christos # to testing. 105 1.1 christos VERBOSE=$(V) 106 1.1 christos 107 1.1 christos VERSION={- $config{version} -} 108 1.1 christos MAJOR={- $config{major} -} 109 1.1 christos MINOR={- $config{minor} -} 110 1.1 christos SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} 111 1.1 christos SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -} 112 1.1 christos SHLIB_MAJOR={- $config{shlib_major} -} 113 1.1 christos SHLIB_MINOR={- $config{shlib_minor} -} 114 1.1 christos SHLIB_TARGET={- $target{shared_target} -} 115 1.1 christos 116 1.1 christos EXE_EXT=.EXE 117 1.1 christos LIB_EXT=.OLB 118 1.1 christos SHLIB_EXT=.EXE 119 1.1 christos OBJ_EXT=.OBJ 120 1.1 christos DEP_EXT=.D 121 1.1 christos 122 1.1 christos LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @libs) -} 123 1.1 christos SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @shlibs) -} 124 1.1 christos ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{engines}}) -} 125 1.1 christos PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{programs}}) -} 126 1.1 christos SCRIPTS={- join(", ", map { "-\n\t".$_ } @{$unified_info{scripts}}) -} 127 1.1 christos {- output_off() if $disabled{makedepend}; "" -} 128 1.1 christos DEPS={- our @deps = map { (my $x = $_) =~ s|\.o$|\$(DEP_EXT)|; $x; } 129 1.1 christos grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } 130 1.1 christos keys %{$unified_info{sources}}; 131 1.1 christos join(", ", map { "-\n\t".$_ } @deps); -} 132 1.1 christos {- output_on() if $disabled{makedepend}; "" -} 133 1.1 christos GENERATED_MANDATORY={- join(", ", map { "-\n\t".$_ } @{$unified_info{depends}->{""}} ) -} 134 1.1 christos GENERATED={- # common0.tmpl provides @generated 135 1.1 christos join(", ", map { (my $x = $_) =~ s|\.[sS]$|.asm|; "-\n\t".$x } 136 1.1 christos @generated) -} 137 1.1 christos 138 1.1 christos INSTALL_LIBS={- join(", ", map { "-\n\t".$_.".OLB" } @install_libs) -} 139 1.1 christos INSTALL_SHLIBS={- join(", ", map { "-\n\t".$_.".EXE" } @install_shlibs) -} 140 1.1 christos INSTALL_ENGINES={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{engines}}) -} 141 1.1 christos INSTALL_PROGRAMS={- join(", ", map { "-\n\t".$_.".EXE" } @{$unified_info{install}->{programs}}) -} 142 1.1 christos {- output_off() if $disabled{apps}; "" -} 143 1.1 christos BIN_SCRIPTS=[.tools]c_rehash.pl 144 1.1 christos MISC_SCRIPTS=[.apps]CA.pl, [.apps]tsget.pl 145 1.1 christos {- output_on() if $disabled{apps}; "" -} 146 1.1 christos 147 1.1 christos APPS_OPENSSL={- use File::Spec::Functions; 148 1.1 christos catfile("apps","openssl") -} 149 1.1 christos 150 1.1 christos # DESTDIR is for package builders so that they can configure for, say, 151 1.1 christos # SYS$COMMON:[OPENSSL] and yet have everything installed in STAGING:[USER]. 152 1.1 christos # In that case, configure with --prefix=SYS$COMMON:[OPENSSL] and then run 153 1.1 christos # MMS with /MACROS=(DESTDIR=STAGING:[USER]). The result will end up in 154 1.1 christos # STAGING:[USER.OPENSSL]. 155 1.1 christos # Normally it is left empty. 156 1.1 christos DESTDIR= 157 1.1 christos 158 1.1 christos # Do not edit this manually. Use Configure --prefix=DIR to change this! 159 1.1 christos INSTALLTOP={- our $installtop = 160 1.1 christos catdir($config{prefix}) || "SYS\$COMMON:[OPENSSL]"; 161 1.1 christos $installtop -} 162 1.1 christos SYSTARTUP={- catdir($installtop, '[.SYS$STARTUP]'); -} 163 1.1 christos # This is the standard central area to store certificates, private keys... 164 1.1 christos OPENSSLDIR={- catdir($config{openssldir}) or 165 1.1 christos $config{prefix} ? catdir($config{prefix},"COMMON") 166 1.1 christos : "SYS\$COMMON:[OPENSSL-COMMON]" -} 167 1.1 christos # The same, but for C 168 1.1 christos OPENSSLDIR_C={- $osslprefix -}DATAROOT:[000000] 169 1.1 christos # Where installed engines reside, for C 170 1.1 christos ENGINESDIR_C={- $osslprefix -}ENGINES{- $sover_dirname.$target{pointer_size} -}: 171 1.1 christos 172 1.1 christos ##### User defined commands and flags ################################ 173 1.1 christos 174 1.1 christos CC={- $config{CC} -} 175 1.1 christos CPP={- $config{CPP} -} 176 1.1 christos DEFINES={- our $defines1 = join('', map { ",$_" } @{$config{CPPDEFINES}}) -} 177 1.1 christos INCLUDES={- our $includes1 = join(',', @{$config{CPPINCLUDES}}) -} 178 1.1 christos CPPFLAGS={- our $cppflags1 = join('', @{$config{CPPFLAGS}}) -} 179 1.1 christos CFLAGS={- join('', @{$config{CFLAGS}}) -} 180 1.1 christos LDFLAGS={- join('', @{$config{LFLAGS}}) -} 181 1.1 christos EX_LIBS={- join('', map { ",$_" } @{$config{LDLIBS}}) -} 182 1.1 christos 183 1.1 christos PERL={- $config{PERL} -} 184 1.1 christos 185 1.1 christos AS={- $config{AS} -} 186 1.1 christos ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -} 187 1.1 christos 188 1.1 christos ##### Special command flags ########################################## 189 1.1 christos 190 1.1 christos ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY) 191 1.1 christos 192 1.1 christos ##### Project flags ################################################## 193 1.1 christos 194 1.1 christos # Variables starting with CNF_ are common variables for all product types 195 1.1 christos 196 1.1 christos CNF_ASFLAGS={- join('', $target{asflags} || (), 197 1.1 christos @{$config{asflags}}) -} 198 1.1 christos CNF_DEFINES={- our $defines2 = join('', map { ",$_" } @{$target{defines}}, 199 1.1 christos @{$config{defines}}) -} 200 1.1 christos CNF_INCLUDES={- our $includes2 = join(',', @{$target{includes}}, 201 1.1 christos @{$config{includes}}) -} 202 1.1 christos CNF_CPPFLAGS={- our $cppflags2 = join('', $target{cppflags} || (), 203 1.1 christos @{$config{cppflags}}) -} 204 1.1 christos CNF_CFLAGS={- join('', $target{cflags} || (), 205 1.1 christos @{$config{cflags}}) -} 206 1.1 christos CNF_CXXFLAGS={- join('', $target{cxxflags} || (), 207 1.1 christos @{$config{cxxflags}}) -} 208 1.1 christos CNF_LDFLAGS={- join('', $target{lflags} || (), 209 1.1 christos @{$config{lflags}}) -} 210 1.1 christos CNF_EX_LIBS={- join('', map{ ",$_" } @{$target{ex_libs}}, 211 1.1 christos @{$config{ex_libs}}) -} 212 1.1 christos 213 1.1 christos # Variables starting with LIB_ are used to build library object files 214 1.1 christos # and shared libraries. 215 1.1 christos # Variables starting with DSO_ are used to build DSOs and their object files. 216 1.1 christos # Variables starting with BIN_ are used to build programs and their object 217 1.1 christos # files. 218 1.1 christos 219 1.1 christos LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (), 220 1.1 christos @{$config{lib_asflags}}, 221 1.1 christos '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} 222 1.1 christos LIB_DEFINES={- our $lib_defines = 223 1.1 christos join('', (map { ",$_" } @{$target{lib_defines}}, 224 1.1 christos @{$target{shared_defines}}, 225 1.1 christos @{$config{lib_defines}}, 226 1.1 christos @{$config{shared_defines}})); 227 1.1 christos join('', $lib_defines, 228 1.1 christos (map { ",$_" } 'OPENSSLDIR="""$(OPENSSLDIR_C)"""', 229 1.1 christos 'ENGINESDIR="""$(ENGINESDIR_C)"""'), 230 1.1 christos '$(CNF_DEFINES)', '$(DEFINES)') -} 231 1.1 christos LIB_INCLUDES={- our $lib_includes = 232 1.1 christos join(',', @{$target{lib_includes}}, 233 1.1 christos @{$target{shared_includes}}, 234 1.1 christos @{$config{lib_includes}}, 235 1.1 christos @{$config{shared_includes}}) -} 236 1.1 christos LIB_CPPFLAGS={- our $lib_cppflags = 237 1.1 christos join('', $target{lib_cppflags} || (), 238 1.1 christos $target{shared_cppflags} || (), 239 1.1 christos @{$config{lib_cppflags}}, 240 1.1 christos @{$config{shared_cppflag}}); 241 1.1 christos join('', "'qual_includes'", 242 1.1 christos '/DEFINE=(__dummy$(LIB_DEFINES))', 243 1.1 christos $lib_cppflags, 244 1.1 christos '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 245 1.1 christos LIB_CFLAGS={- join('', $target{lib_cflags} || (), 246 1.1 christos $target{shared_cflag} || (), 247 1.1 christos @{$config{lib_cflags}}, 248 1.1 christos @{$config{shared_cflag}}, 249 1.1 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 250 1.1 christos LIB_LDFLAGS={- join('', $target{lib_lflags} || (), 251 1.1 christos $target{shared_ldflag} || (), 252 1.1 christos @{$config{lib_lflags}}, 253 1.1 christos @{$config{shared_ldflag}}, 254 1.1 christos '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 255 1.1 christos LIB_EX_LIBS=$(CNF_EX_LIBS)$(EX_LIBS) 256 1.1 christos DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (), 257 1.1 christos $target{module_asflags} || (), 258 1.1 christos @{$config{dso_asflags}}, 259 1.1 christos @{$config{module_asflags}}, 260 1.1 christos '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} 261 1.1 christos DSO_DEFINES={- join('', (map { ",$_" } @{$target{dso_defines}}, 262 1.1 christos @{$target{module_defines}}, 263 1.1 christos @{$config{dso_defines}}, 264 1.1 christos @{$config{module_defines}}), 265 1.1 christos '$(CNF_DEFINES)', '$(DEFINES)') -} 266 1.1 christos DSO_INCLUDES={- join(',', @{$target{dso_includes}}, 267 1.1 christos @{$target{module_includes}}, 268 1.1 christos @{$config{dso_includes}}, 269 1.1 christos @{$config{module_includes}}) -} 270 1.1 christos DSO_CPPFLAGS={- join('', "'qual_includes'", 271 1.1 christos '/DEFINE=(__dummy$(DSO_DEFINES))', 272 1.1 christos $target{dso_cppflags} || (), 273 1.1 christos $target{module_cppflags} || (), 274 1.1 christos @{$config{dso_cppflags}}, 275 1.1 christos @{$config{module_cppflags}}, 276 1.1 christos '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 277 1.1 christos DSO_CFLAGS={- join('', $target{dso_cflags} || (), 278 1.1 christos $target{module_cflags} || (), 279 1.1 christos @{$config{dso_cflags}}, 280 1.1 christos @{$config{module_cflags}}, 281 1.1 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 282 1.1 christos DSO_LDFLAGS={- join('', $target{dso_lflags} || (), 283 1.1 christos $target{module_ldflags} || (), 284 1.1 christos @{$config{dso_lflags}}, 285 1.1 christos @{$config{module_ldflags}}, 286 1.1 christos '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 287 1.1 christos DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 288 1.1 christos BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (), 289 1.1 christos @{$config{bin_asflags}}, 290 1.1 christos '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} 291 1.1 christos BIN_DEFINES={- join('', (map { ",$_" } @{$target{bin_defines}}, 292 1.1 christos @{$config{bin_defines}}), 293 1.1 christos '$(CNF_DEFINES)', '$(DEFINES)') -} 294 1.1 christos BIN_INCLUDES={- join(',', @{$target{bin_includes}}, 295 1.1 christos @{$config{bin_includes}}) -} 296 1.1 christos BIN_CPPFLAGS={- join('', "'qual_includes'", 297 1.1 christos '/DEFINE=(__dummy$(DSO_DEFINES))', 298 1.1 christos $target{bin_cppflags} || (), 299 1.1 christos @{$config{bin_cppflag}}, 300 1.1 christos '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 301 1.1 christos BIN_CFLAGS={- join('', $target{bin_cflag} || (), 302 1.1 christos @{$config{bin_cflag}}, 303 1.1 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 304 1.1 christos BIN_LDFLAGS={- join('', $target{bin_lflags} || (), 305 1.1 christos @{$config{bin_lflags}} || (), 306 1.1 christos '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 307 1.1 christos BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 308 1.1 christos NO_INST_LIB_CFLAGS={- join('', $target{no_inst_lib_cflags} 309 1.1 christos // $target{lib_cflags} 310 1.1 christos // (), 311 1.1 christos $target{shared_cflag} || (), 312 1.1 christos @{$config{lib_cflags}}, 313 1.1 christos @{$config{shared_cflag}}, 314 1.1 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 315 1.1 christos NO_INST_DSO_CFLAGS={- join('', $target{no_inst_lib_cflags} 316 1.1 christos // $target{lib_cflags} 317 1.1 christos // (), 318 1.1 christos $target{dso_cflags} || (), 319 1.1 christos @{$config{lib_cflags}}, 320 1.1 christos @{$config{dso_cflags}}, 321 1.1 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 322 1.1 christos NO_INST_BIN_CFLAGS={- join('', $target{no_inst_bin_cflags} 323 1.1 christos // $target{bin_cflags} 324 1.1 christos // (), 325 1.1 christos @{$config{bin_cflags}}, 326 1.1 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 327 1.1 christos 328 1.1 christos PERLASM_SCHEME={- $target{perlasm_scheme} -} 329 1.1 christos 330 1.1 christos # CPPFLAGS_Q is used for one thing only: to build up buildinf.h 331 1.1 christos CPPFLAGS_Q={- (my $c = $lib_cppflags.$cppflags2.$cppflags1) =~ s|"|""|g; 332 1.1 christos (my $d = $lib_defines.$defines2.$defines1) =~ s|"|""|g; 333 1.1 christos my $i = join(',', $lib_includes || (), $includes2 || (), 334 1.1 christos $includes1 || ()); 335 1.1 christos my $x = $c; 336 1.1 christos $x .= "/INCLUDE=($i)" if $i; 337 1.1 christos $x .= "/DEFINE=($d)" if $d; 338 1.1 christos $x; -} 339 1.1 christos 340 1.1 christos # .FIRST and .LAST are special targets with MMS and MMK. 341 1.1 christos # The defines in there are for C. includes that look like 342 1.1 christos # this: 343 1.1 christos # 344 1.1 christos # #include <openssl/foo.h> 345 1.1 christos # #include "internal/bar.h" 346 1.1 christos # #include "crypto/something.h" 347 1.1 christos # 348 1.1 christos # will use the logical names to find the files. Expecting 349 1.1 christos # DECompHP C to find files in subdirectories of whatever was 350 1.1 christos # given with /INCLUDE is a fantasy, unfortunately. 351 1.1 christos NODEBUG=@ 352 1.1 christos .FIRST : 353 1.1 christos $(NODEBUG) openssl_inc1 = F$PARSE("[.include.openssl]","A.;",,,"syntax_only") - "A.;" 354 1.1 christos $(NODEBUG) openssl_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.openssl]") -}","A.;",,,"SYNTAX_ONLY") - "A.;" 355 1.1 christos $(NODEBUG) internal_inc1 = F$PARSE("[.include.internal]","A.;",,,"SYNTAX_ONLY") - "A.;" 356 1.1 christos $(NODEBUG) internal_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.internal]") -}","A.;",,,"SYNTAX_ONLY") - "A.;" 357 1.1 christos $(NODEBUG) crypto_inc1 = F$PARSE("[.include.crypto]","A.;",,,"SYNTAX_ONLY") - "A.;" 358 1.1 christos $(NODEBUG) crypto_inc2 = F$PARSE("{- catdir($config{sourcedir},"[.include.crypto]") -}","A.;",,,"SYNTAX_ONLY") - "A.;" 359 1.1 christos $(NODEBUG) DEFINE openssl 'openssl_inc1','openssl_inc2' 360 1.1 christos $(NODEBUG) DEFINE internal 'internal_inc1','internal_inc2' 361 1.1 christos $(NODEBUG) DEFINE crypto 'crypto_inc1','crypto_inc2' 362 1.1 christos $(NODEBUG) staging_dir = "$(DESTDIR)" 363 1.1 christos $(NODEBUG) staging_instdir = "" 364 1.1 christos $(NODEBUG) staging_datadir = "" 365 1.1 christos $(NODEBUG) IF staging_dir .NES. "" THEN - 366 1.1 christos staging_instdir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY") 367 1.1 christos $(NODEBUG) IF staging_instdir - "]A.;" .NES. staging_instdir THEN - 368 1.1 christos staging_instdir = staging_instdir - "]A.;" + ".OPENSSL-INSTALL]" 369 1.1 christos $(NODEBUG) IF staging_instdir - "A.;" .NES. staging_instdir THEN - 370 1.1 christos staging_instdir = staging_instdir - "A.;" + "[OPENSSL-INSTALL]" 371 1.1 christos $(NODEBUG) IF staging_dir .NES. "" THEN - 372 1.1 christos staging_datadir = F$PARSE("A.;",staging_dir,"[]",,"SYNTAX_ONLY") 373 1.1 christos $(NODEBUG) IF staging_datadir - "]A.;" .NES. staging_datadir THEN - 374 1.1 christos staging_datadir = staging_datadir - "]A.;" + ".OPENSSL-COMMON]" 375 1.1 christos $(NODEBUG) IF staging_datadir - "A.;" .NES. staging_datadir THEN - 376 1.1 christos staging_datadir = staging_datadir - "A.;" + "[OPENSSL-COMMON]" 377 1.1 christos $(NODEBUG) ! 378 1.1 christos $(NODEBUG) ! Installation logical names 379 1.1 christos $(NODEBUG) ! 380 1.1 christos $(NODEBUG) ! This also creates a few DCL variables that are used for 381 1.1 christos $(NODEBUG) ! the "install_msg" target. 382 1.1 christos $(NODEBUG) ! 383 1.1 christos $(NODEBUG) installroot = F$PARSE(staging_instdir,"$(INSTALLTOP)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" 384 1.1 christos $(NODEBUG) installtop = installroot + ".]" 385 1.1 christos $(NODEBUG) dataroot = F$PARSE(staging_datadir,"$(OPENSSLDIR)","[]A.;",,"SYNTAX_ONLY,NO_CONCEAL") - ".][000000" - "[000000." - "][" - "]A.;" 386 1.1 christos $(NODEBUG) datatop = dataroot + ".]" 387 1.1 christos $(NODEBUG) DEFINE ossl_installroot 'installtop' 388 1.1 christos $(NODEBUG) DEFINE ossl_dataroot 'datatop' 389 1.1 christos $(NODEBUG) ! 390 1.1 christos $(NODEBUG) ! Figure out the architecture 391 1.1 christos $(NODEBUG) ! 392 1.1 christos $(NODEBUG) arch = f$edit( f$getsyi( "arch_name"), "upcase") 393 1.1 christos $(NODEBUG) ! 394 1.1 christos $(NODEBUG) ! Set up logical names for the libraries, so LINK and 395 1.1 christos $(NODEBUG) ! running programs can use them. 396 1.1 christos $(NODEBUG) ! 397 1.1 christos $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEFINE ".uc($_)." 'F\$ENV(\"DEFAULT\")'".uc($_)."\$(SHLIB_EXT)" } @shlibs) || "!" -} 398 1.1 christos 399 1.1 christos .LAST : 400 1.1 christos $(NODEBUG) {- join("\n\t\$(NODEBUG) ", map { "DEASSIGN ".uc($_) } @shlibs) || "!" -} 401 1.1 christos $(NODEBUG) DEASSIGN ossl_dataroot 402 1.1 christos $(NODEBUG) DEASSIGN ossl_installroot 403 1.1 christos $(NODEBUG) DEASSIGN crypto 404 1.1 christos $(NODEBUG) DEASSIGN internal 405 1.1 christos $(NODEBUG) DEASSIGN openssl 406 1.1 christos .DEFAULT : 407 1.1 christos @ ! MMS cannot handle no actions... 408 1.1 christos 409 1.1 christos # The main targets ################################################### 410 1.1 christos 411 1.1 christos {- dependmagic('all'); -} : build_libs_nodep, build_engines_nodep, build_programs_nodep 412 1.1 christos {- dependmagic('build_libs'); -} : build_libs_nodep 413 1.1 christos {- dependmagic('build_engines'); -} : build_engines_nodep 414 1.1 christos {- dependmagic('build_programs'); -} : build_programs_nodep 415 1.1 christos 416 1.1 christos build_generated : $(GENERATED_MANDATORY) 417 1.1 christos build_libs_nodep : $(LIBS), $(SHLIBS) 418 1.1 christos build_engines_nodep : $(ENGINES) 419 1.1 christos build_programs_nodep : $(PROGRAMS), $(SCRIPTS) 420 1.1 christos 421 1.1 christos # Kept around for backward compatibility 422 1.1 christos build_apps build_tests : build_programs 423 1.1 christos 424 1.1 christos # Convenience target to prebuild all generated files, not just the mandatory 425 1.1 christos # ones 426 1.1 christos build_all_generated : $(GENERATED_MANDATORY) $(GENERATED) 427 1.1 christos @ ! {- output_off() if $disabled{makedepend}; "" -} 428 1.1 christos @ WRITE SYS$OUTPUT "Warning: consider configuring with no-makedepend, because if" 429 1.1 christos @ WRITE SYS$OUTPUT " target system doesn't have $(PERL)," 430 1.1 christos @ WRITE SYS$OUTPUT " then make will fail..." 431 1.1 christos @ ! {- output_on() if $disabled{makedepend}; "" -} 432 1.1 christos 433 1.1 christos test : tests 434 1.1 christos {- dependmagic('tests'); -} : build_programs_nodep, build_engines_nodep 435 1.1 christos @ ! {- output_off() if $disabled{tests}; "" -} 436 1.1 christos SET DEFAULT [.test]{- move("test") -} 437 1.1 christos CREATE/DIR [.test-runs] 438 1.1 christos DEFINE SRCTOP {- sourcedir() -} 439 1.1 christos DEFINE BLDTOP {- builddir() -} 440 1.1 christos DEFINE RESULT_D {- builddir(qw(test test-runs)) -} 441 1.1 christos engines = F$PARSE("{- builddir("engines") -}","A.;",,,"syntax_only") - "A.;" 442 1.1 christos DEFINE OPENSSL_ENGINES 'engines' 443 1.1 christos DEFINE OPENSSL_DEBUG_MEMORY "on" 444 1.1 christos IF "$(VERBOSE)" .NES. "" THEN DEFINE VERBOSE "$(VERBOSE)" 445 1.1 christos $(PERL) {- sourcefile("test", "run_tests.pl") -} $(TESTS) 446 1.1 christos DEASSIGN OPENSSL_DEBUG_MEMORY 447 1.1 christos DEASSIGN OPENSSL_ENGINES 448 1.1 christos DEASSIGN BLDTOP 449 1.1 christos DEASSIGN SRCTOP 450 1.1 christos SET DEFAULT [-]{- move("..") -} 451 1.1 christos @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} 452 1.1 christos @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options" 453 1.1 christos @ ! {- output_on() if !$disabled{tests}; "" -} 454 1.1 christos 455 1.1 christos list-tests : 456 1.1 christos @ ! {- output_off() if $disabled{tests}; "" -} 457 1.1 christos @ DEFINE SRCTOP {- sourcedir() -} 458 1.1 christos @ $(PERL) {- sourcefile("test", "run_tests.pl") -} list 459 1.1 christos @ DEASSIGN SRCTOP 460 1.1 christos @ ! {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} 461 1.1 christos @ WRITE SYS$OUTPUT "Tests are not supported with your chosen Configure options" 462 1.1 christos @ ! {- output_on() if !$disabled{tests}; "" -} 463 1.1 christos 464 1.1 christos install : install_sw install_ssldirs install_docs install_msg 465 1.1 christos @ ! 466 1.1 christos 467 1.1 christos install_msg : 468 1.1 christos @ WRITE SYS$OUTPUT "" 469 1.1 christos @ WRITE SYS$OUTPUT "######################################################################" 470 1.1 christos @ WRITE SYS$OUTPUT "" 471 1.1 christos @ IF "$(DESTDIR)" .EQS. "" THEN - 472 1.1 christos @{- sourcefile("VMS", "msg_install.com") -} "$(SYSTARTUP)" "{- $osslver -}" 473 1.1 christos @ IF "$(DESTDIR)" .NES. "" THEN - 474 1.1 christos @{- sourcefile("VMS", "msg_staging.com") -} - 475 1.1 christos "''installroot']" "''dataroot']" "$(INSTALLTOP)" "$(OPENSSLDIR)" - 476 1.1 christos "$(SYSTARTUP)" "{- $osslver -}" 477 1.1 christos 478 1.1 christos check_install : 479 1.1 christos spawn/nolog @ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com 480 1.1 christos 481 1.1 christos uninstall : uninstall_docs uninstall_sw 482 1.1 christos 483 1.1 christos # Because VMS wants the generation number (or *) to delete files, we can't 484 1.1 christos # use $(LIBS), $(PROGRAMS), $(GENERATED) and $(ENGINES)directly. 485 1.1 christos libclean : 486 1.1 christos {- join("\n\t", map { "- DELETE $_.OLB;*" } @libs) || "@ !" -} 487 1.1 christos {- join("\n\t", map { "- DELETE $_.EXE;*,$_.MAP;*" } @shlibs) || "@ !" -} 488 1.1 christos 489 1.1 christos clean : libclean 490 1.1 christos {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{programs}}) || "@ !" -} 491 1.1 christos {- join("\n\t", map { "- DELETE $_.EXE;*,$_.OPT;*" } @{$unified_info{engines}}) || "@ !" -} 492 1.1 christos {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{scripts}}) || "@ !" -} 493 1.1 christos {- join("\n\t", map { "- DELETE $_;*" } @{$unified_info{depends}->{""}}) || "@ !" -} 494 1.1 christos {- join("\n\t", map { "- DELETE $_;*" } @generated) || "@ !" -} 495 1.1 christos - DELETE [...]*.MAP;* 496 1.1 christos - DELETE [...]*.D;* 497 1.1 christos - DELETE [...]*.OBJ;*,*.LIS;* 498 1.1 christos - DELETE []CXX$DEMANGLER_DB.;* 499 1.1 christos - DELETE [.VMS]openssl_startup.com;* 500 1.1 christos - DELETE [.VMS]openssl_shutdown.com;* 501 1.1 christos - DELETE []vmsconfig.pm;* 502 1.1 christos 503 1.1 christos distclean : clean 504 1.1 christos - DELETE configdata.pm;* 505 1.1 christos - DELETE descrip.mms;* 506 1.1 christos 507 1.1 christos depend : descrip.mms 508 1.1 christos descrip.mms : FORCE 509 1.1 christos @ ! {- output_off() if $disabled{makedepend}; "" -} 510 1.1 christos @ $(PERL) {- sourcefile("util", "add-depends.pl") -} "VMS C" 511 1.1 christos @ ! {- output_on() if $disabled{makedepend}; "" -} 512 1.1 christos 513 1.1 christos # Install helper targets ############################################# 514 1.1 christos 515 1.1 christos install_sw : install_dev install_engines install_runtime - 516 1.1 christos install_startup install_ivp 517 1.1 christos 518 1.1 christos uninstall_sw : uninstall_dev uninstall_engines uninstall_runtime - 519 1.1 christos uninstall_startup uninstall_ivp 520 1.1 christos 521 1.1 christos install_docs : install_html_docs 522 1.1 christos 523 1.1 christos uninstall_docs : uninstall_html_docs 524 1.1 christos 525 1.1 christos install_ssldirs : check_INSTALLTOP 526 1.1 christos - CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[000000] 527 1.1 christos IF F$SEARCH("OSSL_DATAROOT:[000000]CERTS.DIR;1") .EQS. "" THEN - 528 1.1 christos CREATE/DIR/PROT=(S:RWED,O:RWE,G:RE,W:RE) OSSL_DATAROOT:[CERTS] 529 1.1 christos IF F$SEARCH("OSSL_DATAROOT:[000000]PRIVATE.DIR;1") .EQS. "" THEN - 530 1.1 christos CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[PRIVATE] 531 1.1 christos IF F$SEARCH("OSSL_DATAROOT:[000000]MISC.DIR;1") .EQS. "" THEN - 532 1.1 christos CREATE/DIR/PROT=(S:RWED,O:RWE,G,W) OSSL_DATAROOT:[MISC] 533 1.1 christos COPY/PROT=W:RE $(MISC_SCRIPTS) OSSL_DATAROOT:[MISC] 534 1.1 christos @ ! Install configuration file 535 1.1 christos COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} - 536 1.1 christos ossl_dataroot:[000000]openssl.cnf-dist 537 1.1 christos IF F$SEARCH("OSSL_DATAROOT:[000000]openssl.cnf") .EQS. "" THEN - 538 1.1 christos COPY/PROT=W:R {- sourcefile("apps", "openssl-vms.cnf") -} - 539 1.1 christos ossl_dataroot:[000000]openssl.cnf 540 1.1 christos @ ! Install CTLOG configuration file 541 1.1 christos COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} - 542 1.1 christos ossl_dataroot:[000000]ct_log_list.cnf-dist 543 1.1 christos IF F$SEARCH("OSSL_DATAROOT:[000000]ct_log_list.cnf") .EQS. "" THEN - 544 1.1 christos COPY/PROT=W:R {- sourcefile("apps", "ct_log_list.cnf") -} - 545 1.1 christos ossl_dataroot:[000000]ct_log_list.cnf 546 1.1 christos 547 1.1 christos install_dev : check_INSTALLTOP install_runtime_libs 548 1.1 christos @ WRITE SYS$OUTPUT "*** Installing development files" 549 1.1 christos @ ! Install header files 550 1.1 christos - CREATE/DIR ossl_installroot:[include.openssl] 551 1.1 christos COPY/PROT=W:R openssl:*.h ossl_installroot:[include.openssl] 552 1.1 christos @ ! Install static (development) libraries 553 1.1 christos - CREATE/DIR ossl_installroot:[LIB.'arch'] 554 1.1 christos {- join("\n ", 555 1.1 christos map { "COPY/PROT=W:R $_.OLB ossl_installroot:[LIB.'arch']" } 556 1.1 christos @install_libs) -} 557 1.1 christos 558 1.1 christos install_engines : check_INSTALLTOP install_runtime_libs build_engines 559 1.1 christos @ {- output_off() unless scalar @{$unified_info{engines}}; "" -} ! 560 1.1 christos @ WRITE SYS$OUTPUT "*** Installing engines" 561 1.1 christos - CREATE/DIR ossl_installroot:[ENGINES{- $sover_dirname.$target{pointer_size} -}.'arch'] 562 1.1 christos {- join("\n ", 563 1.1 christos map { "COPY/PROT=W:RE $_.EXE ossl_installroot:[ENGINES$sover_dirname$target{pointer_size}.'arch']" } 564 1.1 christos @{$unified_info{install}->{engines}}) -} 565 1.1 christos @ {- output_on() unless scalar @{$unified_info{engines}}; "" -} ! 566 1.1 christos 567 1.1 christos install_runtime : install_programs 568 1.1 christos 569 1.1 christos install_runtime_libs : check_INSTALLTOP build_libs 570 1.1 christos @ {- output_off() if $disabled{shared}; "" -} ! 571 1.1 christos @ WRITE SYS$OUTPUT "*** Installing shareable images" 572 1.1 christos @ ! Install shared (runtime) libraries 573 1.1 christos - CREATE/DIR ossl_installroot:[LIB.'arch'] 574 1.1 christos {- join("\n ", 575 1.1 christos map { "COPY/PROT=W:R $_.EXE ossl_installroot:[LIB.'arch']" } 576 1.1 christos @install_shlibs) -} 577 1.1 christos @ {- output_on() if $disabled{shared}; "" -} ! 578 1.1 christos 579 1.1 christos install_programs : check_INSTALLTOP install_runtime_libs build_programs 580 1.1 christos @ {- output_off() if $disabled{apps}; "" -} ! 581 1.1 christos @ ! Install the main program 582 1.1 christos - CREATE/DIR ossl_installroot:[EXE.'arch'] 583 1.1 christos COPY/PROT=W:RE [.APPS]openssl.EXE - 584 1.1 christos ossl_installroot:[EXE.'arch']openssl{- $osslver -}.EXE 585 1.1 christos @ ! Install scripts 586 1.1 christos COPY/PROT=W:RE $(BIN_SCRIPTS) ossl_installroot:[EXE] 587 1.1 christos @ ! {- output_on() if $disabled{apps}; "" -} 588 1.1 christos 589 1.1 christos install_startup : [.VMS]openssl_startup.com [.VMS]openssl_shutdown.com - 590 1.1 christos [.VMS]openssl_utils.com, check_INSTALLTOP 591 1.1 christos - CREATE/DIR ossl_installroot:[SYS$STARTUP] 592 1.1 christos COPY/PROT=W:RE [.VMS]openssl_startup.com - 593 1.1 christos ossl_installroot:[SYS$STARTUP]openssl_startup{- $osslver -}.com 594 1.1 christos COPY/PROT=W:RE [.VMS]openssl_shutdown.com - 595 1.1 christos ossl_installroot:[SYS$STARTUP]openssl_shutdown{- $osslver -}.com 596 1.1 christos COPY/PROT=W:RE [.VMS]openssl_utils.com - 597 1.1 christos ossl_installroot:[SYS$STARTUP]openssl_utils{- $osslver -}.com 598 1.1 christos 599 1.1 christos install_ivp : [.VMS]openssl_ivp.com check_INSTALLTOP 600 1.1 christos - CREATE/DIR ossl_installroot:[SYSTEST] 601 1.1 christos COPY/PROT=W:RE [.VMS]openssl_ivp.com - 602 1.1 christos ossl_installroot:[SYSTEST]openssl_ivp{- $osslver -}.com 603 1.1 christos 604 1.1 christos [.VMS]openssl_startup.com : vmsconfig.pm {- sourcefile("VMS", "openssl_startup.com.in") -} 605 1.1 christos - CREATE/DIR [.VMS] 606 1.1 christos $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - 607 1.1 christos {- sourcefile("VMS", "openssl_startup.com.in") -} - 608 1.1 christos > [.VMS]openssl_startup.com 609 1.1 christos 610 1.1 christos [.VMS]openssl_utils.com : vmsconfig.pm {- sourcefile("VMS", "openssl_utils.com.in") -} 611 1.1 christos - CREATE/DIR [.VMS] 612 1.1 christos $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - 613 1.1 christos {- sourcefile("VMS", "openssl_utils.com.in") -} - 614 1.1 christos > [.VMS]openssl_utils.com 615 1.1 christos 616 1.1 christos [.VMS]openssl_shutdown.com : vmsconfig.pm {- sourcefile("VMS", "openssl_shutdown.com.in") -} 617 1.1 christos - CREATE/DIR [.VMS] 618 1.1 christos $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - 619 1.1 christos {- sourcefile("VMS", "openssl_shutdown.com.in") -} - 620 1.1 christos > [.VMS]openssl_shutdown.com 621 1.1 christos 622 1.1 christos [.VMS]openssl_ivp.com : vmsconfig.pm {- sourcefile("VMS", "openssl_ivp.com.in") -} 623 1.1 christos - CREATE/DIR [.VMS] 624 1.1 christos $(PERL) "-I." "-Mvmsconfig" {- sourcefile("util", "dofile.pl") -} - 625 1.1 christos {- sourcefile("VMS", "openssl_ivp.com.in") -} - 626 1.1 christos > [.VMS]openssl_ivp.com 627 1.1 christos 628 1.1 christos vmsconfig.pm : configdata.pm 629 1.1 christos OPEN/WRITE/SHARE=READ CONFIG []vmsconfig.pm 630 1.1 christos WRITE CONFIG "package vmsconfig;" 631 1.1 christos WRITE CONFIG "use strict; use warnings;" 632 1.1 christos WRITE CONFIG "use Exporter;" 633 1.1 christos WRITE CONFIG "our @ISA = qw(Exporter);" 634 1.1 christos WRITE CONFIG "our @EXPORT = qw(%config %target %withargs %unified_info %disabled);" 635 1.1 christos WRITE CONFIG "our %config = (" 636 1.1 christos WRITE CONFIG " target => '","{- $config{target} -}","'," 637 1.1 christos WRITE CONFIG " version => '","{- $config{version} -}","'," 638 1.1 christos WRITE CONFIG " shlib_version_number => '","{- $config{shlib_version_number} -}","'," 639 1.1 christos WRITE CONFIG " shlib_major => '","{- $config{shlib_major} -}","'," 640 1.1 christos WRITE CONFIG " shlib_minor => '","{- $config{shlib_minor} -}","'," 641 1.1 christos WRITE CONFIG " no_shared => '","{- $disabled{shared} -}","'," 642 1.1 christos WRITE CONFIG " INSTALLTOP => '$(INSTALLTOP)'," 643 1.1 christos WRITE CONFIG " OPENSSLDIR => '$(OPENSSLDIR)'," 644 1.1 christos WRITE CONFIG " pointer_size => '","{- $target{pointer_size} -}","'," 645 1.1 christos WRITE CONFIG ");" 646 1.1 christos WRITE CONFIG "our %target = ();" 647 1.1 christos WRITE CONFIG "our %disabled = ();" 648 1.1 christos WRITE CONFIG "our %withargs = ();" 649 1.1 christos WRITE CONFIG "our %unified_info = ();" 650 1.1 christos WRITE CONFIG "1;" 651 1.1 christos CLOSE CONFIG 652 1.1 christos 653 1.1 christos install_html_docs : check_INSTALLTOP 654 1.1 christos sourcedir = F$PARSE("{- $sourcedir -}A.;","[]") - "]A.;" + ".DOC]" 655 1.1 christos $(PERL) {- sourcefile("util", "process_docs.pl") -} - 656 1.1 christos --sourcedir='sourcedir' --destdir=ossl_installroot:[HTML] - 657 1.1 christos --type=html 658 1.1 christos 659 1.1 christos check_INSTALLTOP : 660 1.1 christos @ IF "$(INSTALLTOP)" .EQS. "" THEN - 661 1.1 christos WRITE SYS$ERROR "INSTALLTOP should not be empty" 662 1.1 christos @ IF "$(INSTALLTOP)" .EQS. "" THEN - 663 1.1 christos EXIT %x10000002 664 1.1 christos 665 1.1 christos # Helper targets ##################################################### 666 1.1 christos 667 1.1 christos # Developer targets ################################################## 668 1.1 christos 669 1.1 christos debug_logicals : 670 1.1 christos SH LOGICAL/PROC openssl,internal,ossl_installroot,ossl_dataroot 671 1.1 christos 672 1.1 christos # Building targets ################################################### 673 1.1 christos 674 1.1 christos configdata.pm : $(SRCDIR)Configure $(SRCDIR)config.com {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} 675 1.1 christos perl configdata.pm -r 676 1.1 christos @ WRITE SYS$OUTPUT "*************************************************" 677 1.1 christos @ WRITE SYS$OUTPUT "*** ***" 678 1.1 christos @ WRITE SYS$OUTPUT "*** Please run the same mms command again ***" 679 1.1 christos @ WRITE SYS$OUTPUT "*** ***" 680 1.1 christos @ WRITE SYS$OUTPUT "*************************************************" 681 1.1 christos @ PIPE ( EXIT %X10000000 ) 682 1.1 christos 683 1.1 christos reconfigure reconf : 684 1.1 christos perl configdata.pm -r 685 1.1 christos 686 1.1 christos {- 687 1.1 christos use File::Basename; 688 1.1 christos use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/; 689 1.1 christos 690 1.1 christos # Helper function to figure out dependencies on libraries 691 1.1 christos # It takes a list of library names and outputs a list of dependencies 692 1.1 christos sub compute_lib_depends { 693 1.1 christos if ($disabled{shared}) { 694 1.1 christos return map { $_ =~ /\.a$/ ? $`.".OLB" : $_.".OLB" } @_; 695 1.1 christos } 696 1.1 christos return map { $_ =~ /\.a$/ 697 1.1 christos ? $`.".OLB" 698 1.1 christos : $unified_info{sharednames}->{$_}.".EXE" } @_; 699 1.1 christos } 700 1.1 christos 701 1.1 christos # Helper function to deal with inclusion directory specs. 702 1.1 christos # We have to deal with two things: 703 1.1 christos # 1. comma separation and no possibility of trailing comma 704 1.1 christos # 2. no inclusion directories given at all 705 1.1 christos # 3. long compiler command lines 706 1.1 christos # To resolve 1, we need to iterate through the sources of inclusion 707 1.1 christos # directories, and only add a comma when needed. 708 1.1 christos # To resolve 2, we need to have a variable that will hold the whole 709 1.1 christos # inclusion qualifier, or be the empty string if there are no inclusion 710 1.1 christos # directories. That's the symbol 'qual_includes' that's used in CPPFLAGS 711 1.1 christos # To resolve 3, we creata a logical name TMP_INCLUDES: to hold the list 712 1.1 christos # of inclusion directories. 713 1.1 christos # 714 1.1 christos # This function returns a list of two lists, one being the collection of 715 1.1 christos # commands to execute before the compiler is called, and the other being 716 1.1 christos # the collection of commands to execute after. It takes as arguments the 717 1.1 christos # collection of strings to include as directory specs. 718 1.1 christos sub includes { 719 1.1 christos my @stuff = ( @_ ); 720 1.1 christos my @before = ( 721 1.1 christos 'qual_includes :=', 722 1.1 christos ); 723 1.1 christos my @after = ( 724 1.1 christos 'DELETE/SYMBOL/LOCAL qual_includes', 725 1.1 christos ); 726 1.1 christos 727 1.1 christos if (scalar @stuff > 0) { 728 1.1 christos push @before, 'tmp_includes := '.shift(@stuff); 729 1.1 christos while (@stuff) { 730 1.1 christos push @before, 'tmp_add := '.shift(@stuff); 731 1.1 christos push @before, 'IF tmp_includes .NES. "" .AND. tmp_add .NES. "" THEN tmp_includes = tmp_includes + ","'; 732 1.1 christos push @before, 'tmp_includes = tmp_includes + tmp_add'; 733 1.1 christos } 734 1.1 christos push @before, "IF tmp_includes .NES. \"\" THEN DEFINE tmp_includes 'tmp_includes'"; 735 1.1 christos push @before, 'IF tmp_includes .NES. "" THEN qual_includes := /INCLUDE=(tmp_includes:)'; 736 1.1 christos push @before, 'DELETE/SYMBOL/LOCAL tmp_includes'; 737 1.1 christos push @before, 'DELETE/SYMBOL/LOCAL tmp_add'; 738 1.1 christos push @after, 'DEASSIGN tmp_includes:' 739 1.1 christos } 740 1.1 christos return ([ @before ], [ @after ]); 741 1.1 christos } 742 1.1 christos 743 1.1 christos sub generatesrc { 744 1.1 christos my %args = @_; 745 1.1 christos (my $target = $args{src}) =~ s/\.[sS]$/.asm/; 746 1.1 christos my $generator = join(" ", @{$args{generator}}); 747 1.1 christos my $generator_incs = join("", map { ' "-I'.$_.'"' } @{$args{generator_incs}}); 748 1.1 christos my $deps = join(", -\n\t\t", @{$args{generator_deps}}, @{$args{deps}}); 749 1.1 christos 750 1.1 christos if ($target !~ /\.asm$/) { 751 1.1 christos if ($args{generator}->[0] =~ m|^.*\.in$|) { 752 1.1 christos my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 753 1.1 christos "util", "dofile.pl")), 754 1.1 christos rel2abs($config{builddir})); 755 1.1 christos return <<"EOF"; 756 1.1 christos $target : $args{generator}->[0] $deps 757 1.1 christos \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile \\ 758 1.1 christos "-o$target{build_file}" $generator > \$\@ 759 1.1 christos EOF 760 1.1 christos } else { 761 1.1 christos return <<"EOF"; 762 1.1 christos $target : $args{generator}->[0] $deps 763 1.1 christos \$(PERL)$generator_incs $generator > \$\@ 764 1.1 christos EOF 765 1.1 christos } 766 1.1 christos } else { 767 1.1 christos if ($args{generator}->[0] =~ /\.pl$/) { 768 1.1 christos $generator = '$(PERL)'.$generator_incs.' '.$generator; 769 1.1 christos } elsif ($args{generator}->[0] =~ /\.S$/) { 770 1.1 christos $generator = undef; 771 1.1 christos } else { 772 1.1 christos die "Generator type for $src unknown: $generator\n"; 773 1.1 christos } 774 1.1 christos 775 1.1 christos my $cppflags = { 776 1.1 christos lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 777 1.1 christos dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', 778 1.1 christos bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' 779 1.1 christos } -> {$args{intent}}; 780 1.1 christos my @incs_cmds = includes({ lib => '$(LIB_INCLUDES)', 781 1.1 christos dso => '$(DSO_INCLUDES)', 782 1.1 christos bin => '$(BIN_INCLUDES)' } -> {$args{intent}}, 783 1.1 christos '$(CNF_INCLUDES)', 784 1.1 christos '$(INCLUDES)', 785 1.1 christos @{$args{incs}}); 786 1.1 christos my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!'; 787 1.1 christos my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!'; 788 1.1 christos if (defined($generator)) { 789 1.1 christos # If the target is named foo.S in build.info, we want to 790 1.1 christos # end up generating foo.s in two steps. 791 1.1 christos if ($args{src} =~ /\.S$/) { 792 1.1 christos return <<"EOF"; 793 1.1 christos $target : $args{generator}->[0] $deps 794 1.1 christos $generator \$\@-S 795 1.1 christos \@ $incs_on 796 1.1 christos PIPE \$(CPP) $cppflags \$\@-S | - 797 1.1 christos \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@-i 798 1.1 christos \@ $incs_off 799 1.1 christos RENAME \$\@-i \$\@ 800 1.1 christos DELETE \$\@-S; 801 1.1 christos EOF 802 1.1 christos } 803 1.1 christos # Otherwise.... 804 1.1 christos return <<"EOF"; 805 1.1 christos $target : $args{generator}->[0] $deps 806 1.1 christos $generator \$\@ 807 1.1 christos EOF 808 1.1 christos } 809 1.1 christos return <<"EOF"; 810 1.1 christos $target : $args{generator}->[0] $deps 811 1.1 christos \@ $incs_on 812 1.1 christos SHOW SYMBOL qual_includes 813 1.1 christos PIPE \$(CPP) $cppflags $args{generator}->[0] | - 814 1.1 christos \$(PERL) "-ne" "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" > \$\@ 815 1.1 christos \@ $incs_off 816 1.1 christos EOF 817 1.1 christos } 818 1.1 christos } 819 1.1 christos 820 1.1 christos sub src2obj { 821 1.1 christos my %args = @_; 822 1.1 christos my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x 823 1.1 christos } ( @{$args{srcs}} ); 824 1.1 christos (my $obj = $args{obj}) =~ s|\.o$||; 825 1.1 christos my $deps = join(", -\n\t\t", @srcs, @{$args{deps}}); 826 1.1 christos 827 1.1 christos # Because VMS C isn't very good at combining a /INCLUDE path with 828 1.1 christos # #includes having a relative directory (like '#include "../foo.h"), 829 1.1 christos # the best choice is to move to the first source file's intended 830 1.1 christos # directory before compiling, and make sure to write the object file 831 1.1 christos # in the correct position (important when the object tree is other 832 1.1 christos # than the source tree). 833 1.1 christos my $forward = dirname($args{srcs}->[0]); 834 1.1 christos my $backward = abs2rel(rel2abs("."), rel2abs($forward)); 835 1.1 christos my $objd = abs2rel(rel2abs(dirname($obj)), rel2abs($forward)); 836 1.1 christos my $objn = basename($obj); 837 1.1 christos my $srcs = 838 1.1 christos join(", ", map { abs2rel(rel2abs($_), rel2abs($forward)) } @srcs); 839 1.1 christos my $before = $unified_info{before}->{$obj.".OBJ"} || "\@ !"; 840 1.1 christos my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !"; 841 1.1 christos 842 1.1 christos my $cflags; 843 1.1 christos if ($args{installed}) { 844 1.1 christos $cflags = { lib => '$(LIB_CFLAGS)', 845 1.1 christos dso => '$(DSO_CFLAGS)', 846 1.1 christos bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; 847 1.1 christos } else { 848 1.1 christos $cflags = { lib => '$(NO_INST_LIB_CFLAGS)', 849 1.1 christos dso => '$(NO_INST_DSO_CFLAGS)', 850 1.1 christos bin => '$(NO_INST_BIN_CFLAGS)' } -> {$args{intent}}; 851 1.1 christos } 852 1.1 christos $cflags .= { lib => '$(LIB_CPPFLAGS)', 853 1.1 christos dso => '$(DSO_CPPFLAGS)', 854 1.1 christos bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}}; 855 1.1 christos my $asflags = { lib => ' $(LIB_ASFLAGS)', 856 1.1 christos dso => ' $(DSO_ASFLAGS)', 857 1.1 christos bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}}; 858 1.1 christos 859 1.1 christos my @incs_cmds = includes({ lib => '$(LIB_INCLUDES)', 860 1.1 christos dso => '$(DSO_INCLUDES)', 861 1.1 christos bin => '$(BIN_INCLUDES)' } -> {$args{intent}}, 862 1.1 christos '$(INCLUDES)', 863 1.1 christos map { 864 1.1 christos file_name_is_absolute($_) 865 1.1 christos ? $_ : catdir($backward,$_) 866 1.1 christos } @{$args{incs}}); 867 1.1 christos my $incs_on = join("\n\t\@ ", @{$incs_cmds[0]}) || '!'; 868 1.1 christos my $incs_off = join("\n\t\@ ", @{$incs_cmds[1]}) || '!'; 869 1.1 christos 870 1.1 christos if ($srcs[0] =~ /\.asm$/) { 871 1.1 christos return <<"EOF"; 872 1.1 christos $obj.OBJ : $deps 873 1.1 christos ${before} 874 1.1 christos SET DEFAULT $forward 875 1.1 christos \$(AS) $asflags \$(ASOUTFLAG)${objd}${objn}.OBJ $srcs 876 1.1 christos SET DEFAULT $backward 877 1.1 christos ${after} 878 1.1 christos - PURGE $obj.OBJ 879 1.1 christos EOF 880 1.1 christos } elsif ($srcs[0] =~ /.S$/) { 881 1.1 christos return <<"EOF"; 882 1.1 christos $obj.OBJ : $deps 883 1.1 christos ${before} 884 1.1 christos SET DEFAULT $forward 885 1.1 christos \@ $incs_on 886 1.1 christos PIPE \$(CPP) ${cflags} $srcs | - 887 1.1 christos \$(PERL) -ne "/^#(\\s*line)?\\s*[0-9]+\\s+""/ or print" - 888 1.1 christos > ${objd}${objn}.asm 889 1.1 christos \@ $incs_off 890 1.1 christos SET DEFAULT $backward 891 1.1 christos ${after} 892 1.1 christos \$(AS) $asflags \$(ASOUTFLAG)$obj.OBJ $obj.asm 893 1.1 christos - PURGE $obj.OBJ 894 1.1 christos EOF 895 1.1 christos } 896 1.1 christos 897 1.1 christos my $depbuild = $disabled{makedepend} ? "" 898 1.1 christos : " /MMS=(FILE=${objd}${objn}.D,TARGET=$obj.OBJ)"; 899 1.1 christos 900 1.1 christos return <<"EOF"; 901 1.1 christos $obj.OBJ : $deps 902 1.1 christos ${before} 903 1.1 christos SET DEFAULT $forward 904 1.1 christos \@ $incs_on 905 1.1 christos \$(CC) ${cflags}${depbuild} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs 906 1.1 christos \@ $incs_off 907 1.1 christos SET DEFAULT $backward 908 1.1 christos ${after} 909 1.1 christos - PURGE $obj.OBJ 910 1.1 christos EOF 911 1.1 christos } 912 1.1 christos sub libobj2shlib { 913 1.1 christos my %args = @_; 914 1.1 christos my $lib = $args{lib}; 915 1.1 christos my $shlib = $args{shlib}; 916 1.1 christos my $libd = dirname($lib); 917 1.1 christos my $libn = basename($lib); 918 1.1 christos my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } 919 1.1 christos grep { $_ =~ m|\.o$| } 920 1.1 christos @{$args{objs}}; 921 1.1 christos my @defs = grep { $_ =~ /\.opt$/ } @{$args{objs}}; 922 1.1 christos my @deps = compute_lib_depends(@{$args{deps}}); 923 1.1 christos die "More than one symbol vector" if scalar @defs > 1; 924 1.1 christos my $deps = join(", -\n\t\t", @defs, @deps); 925 1.1 christos my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; 926 1.1 christos my $translatesyms_pl = abs2rel(rel2abs(catfile($config{sourcedir}, 927 1.1 christos "VMS", "translatesyms.pl")), 928 1.1 christos rel2abs($config{builddir})); 929 1.1 christos # The "[]" hack is because in .OPT files, each line inherits the 930 1.1 christos # previous line's file spec as default, so if no directory spec 931 1.1 christos # is present in the current line and the previous line has one that 932 1.1 christos # doesn't apply, you're in for a surprise. 933 1.1 christos my $write_opt1 = 934 1.1 christos join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; 935 1.1 christos "WRITE OPT_FILE \"$x" } @objs). 936 1.1 christos "\""; 937 1.1 christos my $write_opt2 = 938 1.1 christos join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; 939 1.1 christos $x =~ s|(\.EXE)|$1/SHARE|; 940 1.1 christos $x =~ s|(\.OLB)|$1/LIB|; 941 1.1 christos "WRITE OPT_FILE \"$x\"" } @deps) 942 1.1 christos || "\@ !"; 943 1.1 christos return <<"EOF" 944 1.1 christos $shlib.EXE : $lib.OLB $deps 945 1.1 christos \$(PERL) $translatesyms_pl \$(BLDDIR)CXX\$DEMANGLER_DB. < $defs[0] > $defs[0]-translated 946 1.1 christos OPEN/WRITE/SHARE=READ OPT_FILE $lib-components.OPT 947 1.1 christos $write_opt1 948 1.1 christos $write_opt2 949 1.1 christos CLOSE OPT_FILE 950 1.1 christos LINK \$(LIB_LDFLAGS)/SHARE=\$\@ $defs[0]-translated/OPT,- 951 1.1 christos $lib-components.OPT/OPT \$(LIB_EX_LIBS) 952 1.1 christos DELETE $defs[0]-translated;*,$lib-components.OPT;* 953 1.1 christos PURGE $shlib.EXE,$shlib.MAP 954 1.1 christos EOF 955 1.1 christos . ($config{target} =~ m|alpha| ? "" : <<"EOF" 956 1.1 christos SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@ 957 1.1 christos EOF 958 1.1 christos ); 959 1.1 christos } 960 1.1 christos sub obj2dso { 961 1.1 christos my %args = @_; 962 1.1 christos my $lib = $args{lib}; 963 1.1 christos my $libd = dirname($lib); 964 1.1 christos my $libn = basename($lib); 965 1.1 christos (my $libn_nolib = $libn) =~ s/^lib//; 966 1.1 christos my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}}; 967 1.1 christos my @deps = compute_lib_depends(@{$args{deps}}); 968 1.1 christos my $deps = join(", -\n\t\t", @objs, @deps); 969 1.1 christos my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; 970 1.1 christos my $engine_opt = abs2rel(rel2abs(catfile($config{sourcedir}, 971 1.1 christos "VMS", "engine.opt")), 972 1.1 christos rel2abs($config{builddir})); 973 1.1 christos # The "[]" hack is because in .OPT files, each line inherits the 974 1.1 christos # previous line's file spec as default, so if no directory spec 975 1.1 christos # is present in the current line and the previous line has one that 976 1.1 christos # doesn't apply, you're in for a surprise. 977 1.1 christos my $write_opt1 = 978 1.1 christos join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; 979 1.1 christos "WRITE OPT_FILE \"$x" } @objs). 980 1.1 christos "\""; 981 1.1 christos my $write_opt2 = 982 1.1 christos join("\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; 983 1.1 christos $x =~ s|(\.EXE)|$1/SHARE|; 984 1.1 christos $x =~ s|(\.OLB)|$1/LIB|; 985 1.1 christos "WRITE OPT_FILE \"$x\"" } @deps) 986 1.1 christos || "\@ !"; 987 1.1 christos return <<"EOF" 988 1.1 christos $lib.EXE : $deps 989 1.1 christos OPEN/WRITE/SHARE=READ OPT_FILE $lib.OPT 990 1.1 christos TYPE $engine_opt /OUTPUT=OPT_FILE: 991 1.1 christos $write_opt1 992 1.1 christos $write_opt2 993 1.1 christos CLOSE OPT_FILE 994 1.1 christos LINK \$(DSO_LDFLAGS)/SHARE=\$\@ $lib.OPT/OPT \$(DSO_EX_LIBS) 995 1.1 christos - PURGE $lib.EXE,$lib.OPT,$lib.MAP 996 1.1 christos EOF 997 1.1 christos . ($config{target} =~ m|alpha| ? "" : <<"EOF" 998 1.1 christos SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@ 999 1.1 christos EOF 1000 1.1 christos ); 1001 1.1 christos } 1002 1.1 christos sub obj2lib { 1003 1.1 christos my %args = @_; 1004 1.1 christos (my $lib = $args{lib}) =~ s/\.a$//; 1005 1.1 christos my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}}; 1006 1.1 christos my $objs = join(", -\n\t\t", @objs); 1007 1.1 christos my $fill_lib = join("\n\t", (map { "LIBRARY/REPLACE $lib.OLB $_" } 1008 1.1 christos @objs)); 1009 1.1 christos return <<"EOF"; 1010 1.1 christos $lib.OLB : $objs 1011 1.1 christos LIBRARY/CREATE/OBJECT $lib.OLB 1012 1.1 christos $fill_lib 1013 1.1 christos - PURGE $lib.OLB 1014 1.1 christos EOF 1015 1.1 christos } 1016 1.1 christos sub obj2bin { 1017 1.1 christos my %args = @_; 1018 1.1 christos my $bin = $args{bin}; 1019 1.1 christos my $bind = dirname($bin); 1020 1.1 christos my $binn = basename($bin); 1021 1.1 christos my @objs = map { (my $x = $_) =~ s|\.o$|.OBJ|; $x } @{$args{objs}}; 1022 1.1 christos my $objs = join(",", @objs); 1023 1.1 christos my @deps = compute_lib_depends(@{$args{deps}}); 1024 1.1 christos my $deps = join(", -\n\t\t", @objs, @deps); 1025 1.1 christos 1026 1.1 christos my $olb_count = scalar grep(m|\.OLB$|, @deps); 1027 1.1 christos my $analyse_objs = "@ !"; 1028 1.1 christos if ($olb_count > 0) { 1029 1.1 christos my $analyse_quals = 1030 1.1 christos $config{target} =~ m|alpha| ? "/GSD" : "/SECTIONS=SYMTAB"; 1031 1.1 christos $analyse_objs = "- pipe ANALYSE/OBJECT$analyse_quals $objs | SEARCH SYS\$INPUT \"\"\"main\"\"\" ; nomain = \$severity .NE. 1" 1032 1.1 christos } 1033 1.1 christos # The "[]" hack is because in .OPT files, each line inherits the 1034 1.1 christos # previous line's file spec as default, so if no directory spec 1035 1.1 christos # is present in the current line and the previous line has one that 1036 1.1 christos # doesn't apply, you're in for a surprise. 1037 1.1 christos my $write_opt1 = 1038 1.1 christos join(",-\"\n\t", map { my $x = $_ =~ /\[/ ? $_ : "[]".$_; 1039 1.1 christos "\@ WRITE OPT_FILE \"$x" } @objs). 1040 1.1 christos "\""; 1041 1.1 christos my $write_opt2 = 1042 1.1 christos join("\n\t", map { my @lines = (); 1043 1.1 christos my $x = $_ =~ /\[/ ? $_ : "[]".$_; 1044 1.1 christos if ($x =~ m|\.EXE$|) { 1045 1.1 christos push @lines, "\@ WRITE OPT_FILE \"$x/SHARE\""; 1046 1.1 christos } elsif ($x =~ m|\.OLB$|) { 1047 1.1 christos (my $l = $x) =~ s/\W/_/g; 1048 1.1 christos push @lines, 1049 1.1 christos "\@ IF nomain THEN WRITE OPT_FILE \"$x/LIB\$(INCLUDE_MAIN_$l)\"", 1050 1.1 christos "\@ IF .NOT. nomain THEN WRITE OPT_FILE \"$x/LIB\"" 1051 1.1 christos } 1052 1.1 christos @lines 1053 1.1 christos } @deps) 1054 1.1 christos || "\@ !"; 1055 1.1 christos # The linking commands looks a bit complex, but it's for good reason. 1056 1.1 christos # When you link, say, foo.obj, bar.obj and libsomething.exe/share, and 1057 1.1 christos # bar.obj happens to have a symbol that also exists in libsomething.exe, 1058 1.1 christos # the linker will warn about it, loudly, and will then choose to pick 1059 1.1 christos # the first copy encountered (the one in bar.obj in this example). 1060 1.1 christos # On Unix and on Windows, the corresponding maneuvre goes through 1061 1.1 christos # silently with the same effect. 1062 1.1 christos # With some test programs, made for checking the internals of OpenSSL, 1063 1.1 christos # we do this kind of linking deliberately, picking a few specific object 1064 1.1 christos # files from within [.crypto] or [.ssl] so we can reach symbols that are 1065 1.1 christos # otherwise unreachable (since the shareable images only exports the 1066 1.1 christos # symbols listed in [.util]*.num), and then with the shared libraries 1067 1.1 christos # themselves. So we need to silence the warning about multiply defined 1068 1.1 christos # symbols, to mimic the way linking work on Unix and Windows, and so 1069 1.1 christos # the build isn't interrupted (MMS stops when warnings are signaled, 1070 1.1 christos # by default), and so someone building doesn't have to worry where it 1071 1.1 christos # isn't necessary. If there are other warnings, however, we show them 1072 1.1 christos # and let it break the build. 1073 1.1 christos return <<"EOF" 1074 1.1 christos $bin.EXE : $deps 1075 1.1 christos $analyse_objs 1076 1.1 christos @ OPEN/WRITE/SHARE=READ OPT_FILE $bin.OPT 1077 1.1 christos $write_opt1 1078 1.1 christos $write_opt2 1079 1.1 christos @ CLOSE OPT_FILE 1080 1.1 christos TYPE $bin.opt ! For debugging 1081 1.1 christos - pipe SPAWN/WAIT/NOLOG/OUT=$bin.LINKLOG - 1082 1.1 christos LINK \$(BIN_LDFLAGS)/EXEC=\$\@ $bin.OPT/OPT \$(BIN_EX_LIBS) ; - 1083 1.1 christos link_status = \$status ; link_severity = link_status .AND. 7 1084 1.1 christos @ search_severity = 1 1085 1.1 christos -@ IF link_severity .EQ. 0 THEN - 1086 1.1 christos pipe SEARCH $bin.LINKLOG "%","-"/MATCH=AND | - 1087 1.1 christos SPAWN/WAIT/NOLOG/OUT=NLA0: - 1088 1.1 christos SEARCH SYS\$INPUT: "-W-MULDEF,"/MATCH=NOR ; - 1089 1.1 christos search_severity = \$severity 1090 1.1 christos @ ! search_severity is 3 when the last search didn't find any matching 1091 1.1 christos @ ! string: %SEARCH-I-NOMATCHES, no strings matched 1092 1.1 christos @ ! If that was the result, we pretend linking got through without 1093 1.1 christos @ ! fault or warning. 1094 1.1 christos @ IF search_severity .EQ. 3 THEN link_severity = 1 1095 1.1 christos @ ! At this point, if link_severity shows that there was a fault 1096 1.1 christos @ ! or warning, make sure to restore the linking status. 1097 1.1 christos -@ IF .NOT. link_severity THEN TYPE $bin.LINKLOG 1098 1.1 christos -@ DELETE $bin.LINKLOG;* 1099 1.1 christos @ IF .NOT. link_severity THEN SPAWN/WAIT/NOLOG EXIT 'link_status' 1100 1.1 christos - PURGE $bin.EXE,$bin.OPT 1101 1.1 christos EOF 1102 1.1 christos . ($config{target} =~ m|alpha| ? "" : <<"EOF" 1103 1.1 christos SET IMAGE/FLAGS=(NOCALL_DEBUG) \$\@ 1104 1.1 christos EOF 1105 1.1 christos ); 1106 1.1 christos } 1107 1.1 christos sub in2script { 1108 1.1 christos my %args = @_; 1109 1.1 christos my $script = $args{script}; 1110 1.1 christos return "" if grep { $_ eq $script } @{$args{sources}}; # No overwrite! 1111 1.1 christos my $sources = join(" ", @{$args{sources}}); 1112 1.1 christos my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 1113 1.1 christos "util", "dofile.pl")), 1114 1.1 christos rel2abs($config{builddir})); 1115 1.1 christos return <<"EOF"; 1116 1.1 christos $script : $sources 1117 1.1 christos \$(PERL) "-I\$(BLDDIR)" "-Mconfigdata" $dofile - 1118 1.1 christos "-o$target{build_file}" $sources > $script 1119 1.1 christos SET FILE/PROT=(S:RWED,O:RWED,G:RE,W:RE) $script 1120 1.1 christos PURGE $script 1121 1.1 christos EOF 1122 1.1 christos } 1123 1.1 christos "" # Important! This becomes part of the template result. 1124 1.1 christos -} 1125