descrip.mms.tmpl 56 KB

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