descrip.mms.tmpl 56 KB

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