2
0

descrip.mms.tmpl 53 KB

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