descrip.mms.tmpl 51 KB

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