descrip.mms.tmpl 55 KB

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