unix-Makefile.tmpl 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072
  1. ##
  2. ## Makefile for OpenSSL
  3. ##
  4. ## {- join("\n## ", @autowarntext) -}
  5. {-
  6. use OpenSSL::Util;
  7. our $makedep_scheme = $config{makedep_scheme};
  8. our $makedepcmd = platform->makedepcmd();
  9. sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
  10. # Shared AIX support is special. We put libcrypto[64].so.ver into
  11. # libcrypto.a and use libcrypto_a.a as static one.
  12. sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ }
  13. our $sover_dirname = platform->shlib_version_as_filename();
  14. # This makes sure things get built in the order they need
  15. # to. You're welcome.
  16. sub dependmagic {
  17. my $target = shift;
  18. my $help = shift;
  19. return "$target: build_generated ## $help\n\t\"\$(MAKE)\" depend && \"\$(MAKE)\" _$target\n_$target";
  20. }
  21. our $COLUMNS = $ENV{COLUMNS};
  22. if ($COLUMNS =~ /^\d+$/) {
  23. $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \'
  24. } else {
  25. $COLUMNS = 76;
  26. }
  27. sub fill_lines {
  28. my $item_sep = shift; # string
  29. my $line_length = shift; # number of chars
  30. my @result = ();
  31. my $resultpos = 0;
  32. foreach (@_) {
  33. my $fill_line = $result[$resultpos] // '';
  34. my $newline =
  35. ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_;
  36. if (length($newline) > $line_length) {
  37. # If this is a single item and the intended result line
  38. # is empty, we put it there anyway
  39. if ($fill_line eq '') {
  40. $result[$resultpos++] = $newline;
  41. } else {
  42. $result[++$resultpos] = $_;
  43. }
  44. } else {
  45. $result[$resultpos] = $newline;
  46. }
  47. }
  48. return @result;
  49. }
  50. '';
  51. -}
  52. PLATFORM={- $config{target} -}
  53. OPTIONS={- $config{options} -}
  54. CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
  55. SRCDIR={- $config{sourcedir} -}
  56. BLDDIR={- $config{builddir} -}
  57. FIPSKEY={- $config{FIPSKEY} -}
  58. VERSION={- "$config{full_version}" -}
  59. VERSION_NUMBER={- "$config{version}" -}
  60. MAJOR={- $config{major} -}
  61. MINOR={- $config{minor} -}
  62. SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
  63. SHLIB_TARGET={- $target{shared_target} -}
  64. LIBS={- join(" \\\n" . ' ' x 5,
  65. fill_lines(" ", $COLUMNS - 5,
  66. map { platform->staticlib($_) // () }
  67. @{$unified_info{libraries}})) -}
  68. SHLIBS={- join(" \\\n" . ' ' x 7,
  69. fill_lines(" ", $COLUMNS - 7,
  70. map { platform->sharedlib($_) // () }
  71. @{$unified_info{libraries}})) -}
  72. SHLIB_INFO={- join(" \\\n" . ' ' x 11,
  73. fill_lines(" ", $COLUMNS - 11,
  74. map { my $x = platform->sharedlib($_);
  75. my $y = platform->sharedlib_simple($_) // '';
  76. my $z = platform->sharedlib_import($_) // '';
  77. $x ? "\"$x;$y;$z\"" : () }
  78. @{$unified_info{libraries}})) -}
  79. MODULES={- join(" \\\n" . ' ' x 8,
  80. fill_lines(" ", $COLUMNS - 8,
  81. map { platform->dso($_) }
  82. # Drop all modules that are dependencies, they will
  83. # be processed through their dependents
  84. grep { my $x = $_;
  85. !grep { grep { $_ eq $x } @$_ }
  86. values %{$unified_info{depends}} }
  87. @{$unified_info{modules}})) -}
  88. FIPSMODULE={- # We do some extra checking here, as there should be only one
  89. use File::Basename;
  90. our @fipsmodules =
  91. grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
  92. && $unified_info{attributes}->{modules}->{$_}->{fips} }
  93. @{$unified_info{modules}};
  94. die "More that one FIPS module" if scalar @fipsmodules > 1;
  95. join(" ", map { platform->dso($_) } @fipsmodules) -}
  96. FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1;
  97. join(" ", map { basename(platform->dso($_)) } @fipsmodules) -}
  98. PROGRAMS={- join(" \\\n" . ' ' x 9,
  99. fill_lines(" ", $COLUMNS - 9,
  100. map { platform->bin($_) }
  101. @{$unified_info{programs}})) -}
  102. SCRIPTS={- join(" \\\n" . ' ' x 8,
  103. fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -}
  104. {- output_off() if $disabled{makedepend}; "" -}
  105. DEPS={- join(" \\\n" . ' ' x 5,
  106. fill_lines(" ", $COLUMNS - 5,
  107. map { platform->isobj($_) ? platform->dep($_) : () }
  108. grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
  109. keys %{$unified_info{sources}})); -}
  110. {- output_on() if $disabled{makedepend}; "" -}
  111. GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20,
  112. fill_lines(" ", $COLUMNS - 20,
  113. @{$unified_info{depends}->{""}})) -}
  114. GENERATED_PODS={- # common0.tmpl provides @generated
  115. join(" \\\n" . ' ' x 15,
  116. fill_lines(" ", $COLUMNS - 15,
  117. map { my $x = $_;
  118. (
  119. grep {
  120. $unified_info{attributes}->{depends}
  121. ->{$x}->{$_}->{pod} // 0
  122. }
  123. keys %{$unified_info{attributes}->{depends}->{$x}}
  124. ) ? $x : ();
  125. }
  126. @generated)) -}
  127. GENERATED={- # common0.tmpl provides @generated
  128. join(" \\\n" . ' ' x 5,
  129. fill_lines(" ", $COLUMNS - 5,
  130. map { platform->convertext($_) } @generated )) -}
  131. INSTALL_LIBS={-
  132. join(" \\\n" . ' ' x 13,
  133. fill_lines(" ", $COLUMNS - 13,
  134. map { platform->staticlib($_) // () }
  135. grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
  136. @{$unified_info{libraries}}))
  137. -}
  138. INSTALL_SHLIBS={-
  139. join(" \\\n" . ' ' x 15,
  140. fill_lines(" ", $COLUMNS - 15,
  141. map { platform->sharedlib($_) // () }
  142. grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
  143. @{$unified_info{libraries}}))
  144. -}
  145. INSTALL_SHLIB_INFO={-
  146. join(" \\\n" . ' ' x 19,
  147. fill_lines(" ", $COLUMNS - 19,
  148. map { my $x = platform->sharedlib($_);
  149. my $y = platform->sharedlib_simple($_) // '';
  150. my $z = platform->sharedlib_import($_) // '';
  151. $x ? "\"$x;$y;$z\"" : () }
  152. grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
  153. @{$unified_info{libraries}}))
  154. -}
  155. INSTALL_ENGINES={-
  156. join(" \\\n" . ' ' x 16,
  157. fill_lines(" ", $COLUMNS - 16,
  158. map { platform->dso($_) }
  159. grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
  160. && $unified_info{attributes}->{modules}->{$_}->{engine} }
  161. @{$unified_info{modules}}))
  162. -}
  163. INSTALL_MODULES={-
  164. join(" \\\n" . ' ' x 16,
  165. fill_lines(" ", $COLUMNS - 16,
  166. map { platform->dso($_) }
  167. grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
  168. && !$unified_info{attributes}->{modules}->{$_}->{engine}
  169. && !$unified_info{attributes}->{modules}->{$_}->{fips} }
  170. @{$unified_info{modules}}))
  171. -}
  172. INSTALL_FIPSMODULE={-
  173. join(" \\\n" . ' ' x 16,
  174. fill_lines(" ", $COLUMNS - 16,
  175. map { platform->dso($_) }
  176. grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
  177. && $unified_info{attributes}->{modules}->{$_}->{fips} }
  178. @{$unified_info{modules}}))
  179. -}
  180. INSTALL_FIPSMODULECONF=providers/fipsmodule.cnf
  181. INSTALL_PROGRAMS={-
  182. join(" \\\n" . ' ' x 16,
  183. fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) }
  184. grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
  185. @{$unified_info{programs}}))
  186. -}
  187. BIN_SCRIPTS={-
  188. join(" \\\n" . ' ' x 12,
  189. fill_lines(" ", $COLUMNS - 12,
  190. map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
  191. $x ? "$_:$x" : $_ }
  192. grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
  193. && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
  194. @{$unified_info{scripts}}))
  195. -}
  196. MISC_SCRIPTS={-
  197. join(" \\\n" . ' ' x 13,
  198. fill_lines(" ", $COLUMNS - 13,
  199. map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname};
  200. $x ? "$_:$x" : $_ }
  201. grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
  202. && $unified_info{attributes}->{scripts}->{$_}->{misc} }
  203. @{$unified_info{scripts}}))
  204. -}
  205. IMAGEDOCS1={-
  206. join(" \\\n" . ' ' x 10,
  207. fill_lines(" ", $COLUMNS - 10,
  208. @{$unified_info{imagedocs}->{man1}})) -}
  209. IMAGEDOCS3={-
  210. join(" \\\n" . ' ' x 10,
  211. fill_lines(" ", $COLUMNS - 10,
  212. @{$unified_info{imagedocs}->{man3}})) -}
  213. IMAGEDOCS5={-
  214. join(" \\\n" . ' ' x 10,
  215. fill_lines(" ", $COLUMNS - 10,
  216. @{$unified_info{imagedocs}->{man5}})) -}
  217. IMAGEDOCS7={-
  218. join(" \\\n" . ' ' x 10,
  219. fill_lines(" ", $COLUMNS - 10,
  220. @{$unified_info{imagedocs}->{man7}})) -}
  221. HTMLDOCS1={-
  222. join(" \\\n" . ' ' x 10,
  223. fill_lines(" ", $COLUMNS - 10,
  224. @{$unified_info{htmldocs}->{man1}})) -}
  225. HTMLDOCS3={-
  226. join(" \\\n" . ' ' x 10,
  227. fill_lines(" ", $COLUMNS - 10,
  228. @{$unified_info{htmldocs}->{man3}})) -}
  229. HTMLDOCS5={-
  230. join(" \\\n" . ' ' x 10,
  231. fill_lines(" ", $COLUMNS - 10,
  232. @{$unified_info{htmldocs}->{man5}})) -}
  233. HTMLDOCS7={-
  234. join(" \\\n" . ' ' x 10,
  235. fill_lines(" ", $COLUMNS - 10,
  236. @{$unified_info{htmldocs}->{man7}})) -}
  237. MANDOCS1={-
  238. join(" \\\n" . ' ' x 9,
  239. fill_lines(" ", $COLUMNS - 9,
  240. @{$unified_info{mandocs}->{man1}})) -}
  241. MANDOCS3={-
  242. join(" \\\n" . ' ' x 9,
  243. fill_lines(" ", $COLUMNS - 9,
  244. @{$unified_info{mandocs}->{man3}})) -}
  245. MANDOCS5={-
  246. join(" \\\n" . ' ' x 9,
  247. fill_lines(" ", $COLUMNS - 9,
  248. @{$unified_info{mandocs}->{man5}})) -}
  249. MANDOCS7={-
  250. join(" \\\n" . ' ' x 9,
  251. fill_lines(" ", $COLUMNS - 9,
  252. @{$unified_info{mandocs}->{man7}})) -}
  253. APPS_OPENSSL="{- use File::Spec::Functions;
  254. catfile("apps","openssl") -}"
  255. # DESTDIR is for package builders so that they can configure for, say,
  256. # /usr/ and yet have everything installed to /tmp/somedir/usr/.
  257. # Normally it is left empty.
  258. DESTDIR=
  259. # Do not edit these manually. Use Configure with --prefix or --openssldir
  260. # to change this! Short explanation in the top comment in Configure
  261. INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
  262. #
  263. our $prefix = $config{prefix} || "/usr/local";
  264. $prefix -}
  265. OPENSSLDIR={- #
  266. # The logic here is that if no --openssldir was given,
  267. # OPENSSLDIR will get the value from $prefix plus "/ssl".
  268. # If --openssldir was given and the value is an absolute
  269. # path, OPENSSLDIR will get its value without change.
  270. # If the value from --openssldir is a relative path,
  271. # OPENSSLDIR will get $prefix with the --openssldir
  272. # value appended as a subdirectory.
  273. #
  274. use File::Spec::Functions;
  275. our $openssldir =
  276. $config{openssldir} ?
  277. (file_name_is_absolute($config{openssldir}) ?
  278. $config{openssldir}
  279. : catdir($prefix, $config{openssldir}))
  280. : catdir($prefix, "ssl");
  281. $openssldir -}
  282. LIBDIR={- our $libdir = $config{libdir};
  283. unless ($libdir) {
  284. $libdir = "lib$target{multilib}";
  285. }
  286. file_name_is_absolute($libdir) ? "" : $libdir -}
  287. # $(libdir) is chosen to be compatible with the GNU coding standards
  288. libdir={- file_name_is_absolute($libdir)
  289. ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
  290. ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
  291. MODULESDIR=$(libdir)/ossl-modules
  292. # Convenience variable for those who want to set the rpath in shared
  293. # libraries and applications
  294. LIBRPATH=$(libdir)
  295. BINDIR={- our $bindir = $config{bindir};
  296. unless ($bindir) {
  297. $bindir = "bin$target{multibin}";
  298. }
  299. file_name_is_absolute($bindir) ? "" : $bindir -}
  300. bindir={- file_name_is_absolute($bindir)
  301. ? $bindir : '$(INSTALLTOP)/$(BINDIR)' -}
  302. MANDIR=$(INSTALLTOP)/share/man
  303. DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
  304. HTMLDIR=$(DOCDIR)/html
  305. # MANSUFFIX is for the benefit of anyone who may want to have a suffix
  306. # appended after the manpage file section number. "ssl" is popular,
  307. # resulting in files such as config.5ssl rather than config.5.
  308. MANSUFFIX=ossl
  309. HTMLSUFFIX=html
  310. # For "optional" echo messages, to get "real" silence
  311. ECHO = echo
  312. ##### User defined commands and flags ################################
  313. # We let the C compiler driver to take care of .s files. This is done in
  314. # order to be excused from maintaining a separate set of architecture
  315. # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
  316. # gcc, then the driver will automatically translate it to -xarch=v8plus
  317. # and pass it down to assembler. In any case, we do not define AS or
  318. # ASFLAGS for this reason.
  319. CROSS_COMPILE={- $config{CROSS_COMPILE} -}
  320. CC=$(CROSS_COMPILE){- $config{CC} -}
  321. CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
  322. CPPFLAGS={- our $cppflags1 = join(" ",
  323. (map { "-D".$_} @{$config{CPPDEFINES}}),
  324. (map { "-I".$_} @{$config{CPPINCLUDES}}),
  325. @{$config{CPPFLAGS}}) -}
  326. CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
  327. CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
  328. LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
  329. EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
  330. MAKEDEPEND={- $config{makedepcmd} -}
  331. PERL={- $config{PERL} -}
  332. AR=$(CROSS_COMPILE){- $config{AR} -}
  333. ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
  334. RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
  335. RC= $(CROSS_COMPILE){- $config{RC} -}
  336. RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
  337. RM= rm -f
  338. RMDIR= rmdir
  339. TAR= {- $target{TAR} || "tar" -}
  340. TARFLAGS= {- $target{TARFLAGS} -}
  341. BASENAME= openssl
  342. NAME= $(BASENAME)-$(VERSION)
  343. # Relative to $(SRCDIR)
  344. TARFILE= ../$(NAME).tar
  345. ##### Project flags ##################################################
  346. # Variables starting with CNF_ are common variables for all product types
  347. CNF_CPPFLAGS={- our $cppflags2 =
  348. join(' ', $target{cppflags} || (),
  349. (map { "-D".$_} @{$target{defines}},
  350. @{$config{defines}}),
  351. (map { "-I".$_} @{$target{includes}},
  352. @{$config{includes}}),
  353. @{$config{cppflags}}) -}
  354. CNF_CFLAGS={- join(' ', $target{cflags} || (),
  355. @{$config{cflags}}) -}
  356. CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
  357. @{$config{cxxflags}}) -}
  358. CNF_LDFLAGS={- join(' ', $target{lflags} || (),
  359. @{$config{lflags}}) -}
  360. CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
  361. @{$config{ex_libs}}) -}
  362. # Variables starting with LIB_ are used to build library object files
  363. # and shared libraries.
  364. # Variables starting with DSO_ are used to build DSOs and their object files.
  365. # Variables starting with BIN_ are used to build programs and their object
  366. # files.
  367. LIB_CPPFLAGS={- our $lib_cppflags =
  368. join(' ', $target{lib_cppflags} || (),
  369. $target{shared_cppflag} || (),
  370. (map { '-D'.$_ }
  371. @{$target{lib_defines} || ()},
  372. @{$target{shared_defines} || ()},
  373. @{$config{lib_defines} || ()},
  374. @{$config{shared_defines} || ()}),
  375. (map { '-I'.quotify1($_) }
  376. @{$target{lib_includes}},
  377. @{$target{shared_includes}},
  378. @{$config{lib_includes}},
  379. @{$config{shared_includes}}),
  380. @{$config{lib_cppflags}},
  381. @{$config{shared_cppflag}});
  382. join(' ', $lib_cppflags,
  383. (map { '-D'.$_ }
  384. 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
  385. 'ENGINESDIR="\"$(ENGINESDIR)\""',
  386. 'MODULESDIR="\"$(MODULESDIR)\""'),
  387. '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
  388. LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
  389. $target{shared_cflag} || (),
  390. @{$config{lib_cflags}},
  391. @{$config{shared_cflag}},
  392. '$(CNF_CFLAGS)', '$(CFLAGS)') -}
  393. LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
  394. $target{shared_cxxflag} || (),
  395. @{$config{lib_cxxflags}},
  396. @{$config{shared_cxxflag}},
  397. '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
  398. LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
  399. $config{shared_ldflag} || (),
  400. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  401. LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  402. DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
  403. $target{module_cppflags} || (),
  404. (map { '-D'.$_ }
  405. @{$target{dso_defines}},
  406. @{$target{module_defines}},
  407. @{$config{dso_defines} || ()},
  408. @{$config{module_defines} || ()}),
  409. (map { '-I'.quotify1($_) }
  410. @{$target{dso_includes}},
  411. @{$target{module_includes}},
  412. @{$config{dso_includes}},
  413. @{$config{module_includes}}),
  414. @{$config{dso_cppflags}},
  415. @{$config{module_cppflags}},
  416. '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
  417. DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
  418. $target{module_cflags} || (),
  419. @{$config{dso_cflags}},
  420. @{$config{module_cflags}},
  421. '$(CNF_CFLAGS)', '$(CFLAGS)') -}
  422. DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
  423. $target{module_cxxflags} || (),
  424. @{$config{dso_cxxflags}},
  425. @{$config{module_cxxflag}},
  426. '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
  427. DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
  428. $target{module_ldflags} || (),
  429. @{$config{dso_ldflags}},
  430. @{$config{module_ldflags}},
  431. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  432. DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  433. BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
  434. (map { '-D'.$_ } @{$config{bin_defines} || ()}),
  435. @{$config{bin_cppflags}},
  436. '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
  437. BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
  438. @{$config{bin_cflags}},
  439. '$(CNF_CFLAGS)', '$(CFLAGS)') -}
  440. BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
  441. @{$config{bin_cxxflags}},
  442. '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
  443. BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
  444. @{$config{bin_lflags}},
  445. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  446. BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  447. # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
  448. CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
  449. $cppflags2 =~ s|([\\"])|\\$1|g;
  450. $lib_cppflags =~ s|([\\"])|\\$1|g;
  451. join(' ', $lib_cppflags || (), $cppflags2 || (),
  452. $cppflags1 || ()) -}
  453. PERLASM_SCHEME= {- $target{perlasm_scheme} -}
  454. # For x86 assembler: Set PROCESSOR to 386 if you want to support
  455. # the 80386.
  456. PROCESSOR= {- $config{processor} -}
  457. # We want error [and other] messages in English. Trouble is that make(1)
  458. # doesn't pass macros down as environment variables unless there already
  459. # was corresponding variable originally set. In other words we can only
  460. # reassign environment variables, but not set new ones, not in portable
  461. # manner that is. That's why we reassign several, just to be sure...
  462. LC_ALL=C
  463. LC_MESSAGES=C
  464. LANG=C
  465. # The main targets ###################################################
  466. ##@ Software
  467. {- dependmagic('build_sw', 'Build all the software (default target)'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
  468. {- dependmagic('build_libs', 'Build the libraries libssl and libcrypto'); -}: build_libs_nodep
  469. {- dependmagic('build_modules', 'Build the modules (i.e. providers and engines)'); -}: build_modules_nodep
  470. {- dependmagic('build_programs', 'Build the openssl executables and scripts'); -}: build_programs_nodep
  471. all: build_sw {- "build_docs" if !$disabled{docs}; -} ## Build software and documentation
  472. ##@ Documentation
  473. build_generated_pods: $(GENERATED_PODS)
  474. build_docs: build_man_docs build_html_docs ## Create documentation
  475. build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7) ## Create manpages
  476. build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) ## Create HTML documentation
  477. build_generated: $(GENERATED_MANDATORY)
  478. build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
  479. build_modules_nodep: $(MODULES)
  480. build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
  481. # Kept around for backward compatibility
  482. build_apps build_tests: build_programs
  483. # Convenience target to prebuild all generated files, not just the mandatory
  484. # ones
  485. build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
  486. @ : {- output_off() if $disabled{makedepend}; "" -}
  487. @echo "Warning: consider configuring with no-makedepend, because if"
  488. @echo " target system doesn't have $(PERL),"
  489. @echo " then make will fail..."
  490. @ : {- output_on() if $disabled{makedepend}; "" -}
  491. ##@ Help
  492. .PHONY: help
  493. help: ## Show this help screen
  494. @$(PERL) $(SRCDIR)/util/help.pl $(BLDDIR)/Makefile
  495. ##@ Testing
  496. test: tests ## Run tests (alias of "tests")
  497. {- dependmagic('tests', 'Run tests'); -}: build_programs_nodep build_modules_nodep link-utils
  498. "$(MAKE)" run_tests
  499. run_tests: FORCE
  500. @ : {- output_off() if $disabled{tests}; "" -}
  501. ( SRCTOP=$(SRCDIR) \
  502. BLDTOP=$(BLDDIR) \
  503. PERL="$(PERL)" \
  504. FIPSKEY="$(FIPSKEY)" \
  505. EXE_EXT={- platform->binext() -} \
  506. $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) )
  507. @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
  508. @echo "Tests are not supported with your chosen Configure options"
  509. @ : {- output_on() if !$disabled{tests}; "" -}
  510. list-tests: ## List available tests that can be invoked via "make test TESTS=<name>"
  511. @ : {- output_off() if $disabled{tests}; "" -}
  512. "$(MAKE)" run_tests TESTS=list
  513. @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
  514. @echo "Tests are not supported with your chosen Configure options"
  515. @ : {- output_on() if !$disabled{tests}; "" -}
  516. ##@ Workspace cleaning
  517. libclean:
  518. @set -e; for s in $(SHLIB_INFO); do \
  519. if [ "$$s" = ";" ]; then continue; fi; \
  520. s1=`echo "$$s" | cut -f1 -d";"`; \
  521. s2=`echo "$$s" | cut -f2 -d";"`; \
  522. s3=`echo "$$s" | cut -f3 -d";"`; \
  523. $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
  524. $(RM) apps/$$s1; \
  525. $(RM) test/$$s1; \
  526. $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
  527. $(RM) $$s1; \
  528. if [ "$$s2" != "" ]; then \
  529. $(ECHO) $(RM) $$s2; \
  530. $(RM) $$s2; \
  531. fi; \
  532. if [ "$$s3" != "" ]; then \
  533. $(ECHO) $(RM) $$s3; \
  534. $(RM) $$s3; \
  535. fi; \
  536. done
  537. $(RM) $(LIBS)
  538. $(RM) *{- platform->defext() -}
  539. clean: libclean ## Clean the workspace, keep the configuration
  540. $(RM) $(HTMLDOCS1)
  541. $(RM) $(HTMLDOCS3)
  542. $(RM) $(HTMLDOCS5)
  543. $(RM) $(HTMLDOCS7)
  544. $(RM) $(MANDOCS1)
  545. $(RM) $(MANDOCS3)
  546. $(RM) $(MANDOCS5)
  547. $(RM) $(MANDOCS7)
  548. $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(FIPSMODULE) $(SCRIPTS)
  549. $(RM) $(GENERATED_MANDATORY) $(GENERATED)
  550. -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
  551. -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \;
  552. $(RM) core
  553. $(RM) tags TAGS doc-nits md-nits
  554. $(RM) -r test/test-runs
  555. $(RM) providers/fips*.new
  556. $(RM) openssl.pc libcrypto.pc libssl.pc
  557. -find . -type l \! -name '.*' -exec $(RM) {} \;
  558. distclean: clean ## Clean and remove the configuration
  559. $(RM) include/openssl/configuration.h
  560. $(RM) configdata.pm
  561. $(RM) Makefile
  562. # We check if any depfile is newer than Makefile and decide to
  563. # concatenate only if that is true.
  564. depend: Makefile
  565. @: {- output_off() if $disabled{makedepend}; "" -}
  566. @$(PERL) $(SRCDIR)/util/add-depends.pl "{- $makedep_scheme -}"
  567. @: {- output_on() if $disabled{makedepend}; "" -}
  568. # Install helper targets #############################################
  569. ##@ Installation
  570. install: install_sw install_ssldirs {- "install_docs" if !$disabled{docs}; -} {- $disabled{fips} ? "" : "install_fips" -} ## Install software and documentation, create OpenSSL directories
  571. uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} ## Uninstall software and documentation
  572. install_sw: install_dev install_engines install_modules install_runtime ## Install just the software and libraries
  573. uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev ## Uninstall the software and libraries
  574. install_docs: install_man_docs install_html_docs ## Install manpages and HTML documentation
  575. uninstall_docs: uninstall_man_docs uninstall_html_docs ## Uninstall manpages and HTML documentation
  576. $(RM) -r "$(DESTDIR)$(DOCDIR)"
  577. {- output_off() if $disabled{fips}; "" -}
  578. install_fips: build_sw $(INSTALL_FIPSMODULECONF)
  579. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  580. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)"
  581. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)"
  582. @$(ECHO) "*** Installing FIPS module"
  583. @$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
  584. @cp "$(INSTALL_FIPSMODULE)" "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new"
  585. @chmod 755 "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new"
  586. @mv -f "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" \
  587. "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
  588. @$(ECHO) "*** Installing FIPS module configuration"
  589. @$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
  590. @cp $(INSTALL_FIPSMODULECONF) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
  591. uninstall_fips:
  592. @$(ECHO) "*** Uninstalling FIPS module configuration"
  593. $(RM) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf"
  594. @$(ECHO) "*** Uninstalling FIPS module"
  595. $(RM) "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)"
  596. {- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -}
  597. install_fips:
  598. @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option"
  599. uninstall_fips:
  600. @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option"
  601. {- output_on() if !$disabled{fips}; "" -}
  602. install_ssldirs:
  603. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs"
  604. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private"
  605. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc"
  606. @set -e; for x in dummy $(MISC_SCRIPTS); do \
  607. if [ "$$x" = "dummy" ]; then continue; fi; \
  608. x1=`echo "$$x" | cut -f1 -d:`; \
  609. x2=`echo "$$x" | cut -f2 -d:`; \
  610. fn=`basename $$x1`; \
  611. $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
  612. cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
  613. chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \
  614. mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \
  615. "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
  616. if [ "$$x1" != "$$x2" ]; then \
  617. ln=`basename "$$x2"`; \
  618. : {- output_off() unless windowsdll(); "" -}; \
  619. $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
  620. cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
  621. : {- output_on() unless windowsdll();
  622. output_off() if windowsdll(); "" -}; \
  623. $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
  624. ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \
  625. : {- output_on() if windowsdll(); "" -}; \
  626. fi; \
  627. done
  628. @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
  629. @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
  630. @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new"
  631. @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
  632. @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
  633. $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
  634. cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
  635. chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
  636. fi
  637. @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
  638. @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
  639. @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new"
  640. @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
  641. @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
  642. $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
  643. cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
  644. chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
  645. fi
  646. install_dev: install_runtime_libs
  647. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  648. @$(ECHO) "*** Installing development files"
  649. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl"
  650. @ : {- output_off() if $disabled{uplink}; "" -}
  651. @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
  652. @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
  653. @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
  654. @ : {- output_on() if $disabled{uplink}; "" -}
  655. @set -e; for i in $(SRCDIR)/include/openssl/*.h \
  656. $(BLDDIR)/include/openssl/*.h; do \
  657. fn=`basename $$i`; \
  658. $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
  659. cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
  660. chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
  661. done
  662. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
  663. @set -e; for l in $(INSTALL_LIBS); do \
  664. fn=`basename $$l`; \
  665. $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
  666. cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \
  667. $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \
  668. chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \
  669. mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
  670. "$(DESTDIR)$(libdir)/$$fn"; \
  671. done
  672. @ : {- output_off() if $disabled{shared}; "" -}
  673. @set -e; for s in $(INSTALL_SHLIB_INFO); do \
  674. s1=`echo "$$s" | cut -f1 -d";"`; \
  675. s2=`echo "$$s" | cut -f2 -d";"`; \
  676. s3=`echo "$$s" | cut -f3 -d";"`; \
  677. fn1=`basename "$$s1"`; \
  678. fn2=`basename "$$s2"`; \
  679. fn3=`basename "$$s3"`; \
  680. : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
  681. if [ "$$fn2" != "" ]; then \
  682. $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
  683. ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \
  684. fi; \
  685. : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
  686. if [ "$$fn3" != "" ]; then \
  687. $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \
  688. cp $$s3 "$(DESTDIR)$(libdir)/$$fn3.new"; \
  689. chmod 755 "$(DESTDIR)$(libdir)/$$fn3.new"; \
  690. mv -f "$(DESTDIR)$(libdir)/$$fn3.new" \
  691. "$(DESTDIR)$(libdir)/$$fn3"; \
  692. fi; \
  693. : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
  694. a="$(DESTDIR)$(libdir)/$$fn2"; \
  695. $(ECHO) "install $$s1 -> $$a"; \
  696. if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
  697. mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
  698. cp -f $$a $$a.new; \
  699. for so in `$(AR) t $$a`; do \
  700. $(AR) x $$a $$so; \
  701. chmod u+w $$so; \
  702. strip -X32_64 -e $$so; \
  703. $(AR) r $$a.new $$so; \
  704. done; \
  705. )); fi; \
  706. $(AR) r $$a.new $$s1; \
  707. mv -f $$a.new $$a; \
  708. : {- output_off() if sharedaix(); output_on(); "" -}; \
  709. done
  710. @ : {- output_on() if $disabled{shared}; "" -}
  711. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)/pkgconfig"
  712. @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
  713. @cp libcrypto.pc "$(DESTDIR)$(libdir)/pkgconfig"
  714. @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
  715. @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
  716. @cp libssl.pc "$(DESTDIR)$(libdir)/pkgconfig"
  717. @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
  718. @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
  719. @cp openssl.pc "$(DESTDIR)$(libdir)/pkgconfig"
  720. @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
  721. uninstall_dev: uninstall_runtime_libs
  722. @$(ECHO) "*** Uninstalling development files"
  723. @ : {- output_off() if $disabled{uplink}; "" -}
  724. @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
  725. @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
  726. @ : {- output_on() if $disabled{uplink}; "" -}
  727. @set -e; for i in $(SRCDIR)/include/openssl/*.h \
  728. $(BLDDIR)/include/openssl/*.h; do \
  729. fn=`basename $$i`; \
  730. $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
  731. $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
  732. done
  733. -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl"
  734. -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include"
  735. @set -e; for l in $(INSTALL_LIBS); do \
  736. fn=`basename $$l`; \
  737. $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
  738. $(RM) "$(DESTDIR)$(libdir)/$$fn"; \
  739. done
  740. @ : {- output_off() if $disabled{shared}; "" -}
  741. @set -e; for s in $(INSTALL_SHLIB_INFO); do \
  742. s1=`echo "$$s" | cut -f1 -d";"`; \
  743. s2=`echo "$$s" | cut -f2 -d";"`; \
  744. s3=`echo "$$s" | cut -f3 -d";"`; \
  745. fn1=`basename "$$s1"`; \
  746. fn2=`basename "$$s2"`; \
  747. fn3=`basename "$$s3"`; \
  748. : {- output_off() if windowsdll(); "" -}; \
  749. $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
  750. $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \
  751. if [ -n "$$fn2" ]; then \
  752. $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
  753. $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \
  754. fi; \
  755. : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
  756. if [ -n "$$fn3" ]; then \
  757. $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \
  758. $(RM) "$(DESTDIR)$(libdir)/$$fn3"; \
  759. fi; \
  760. : {- output_on() unless windowsdll(); "" -}; \
  761. done
  762. @ : {- output_on() if $disabled{shared}; "" -}
  763. $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
  764. $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
  765. $(RM) "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
  766. -$(RMDIR) "$(DESTDIR)$(libdir)/pkgconfig"
  767. -$(RMDIR) "$(DESTDIR)$(libdir)"
  768. _install_modules_deps: install_runtime_libs build_modules
  769. install_engines: _install_modules_deps
  770. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  771. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/"
  772. @$(ECHO) "*** Installing engines"
  773. @set -e; for e in dummy $(INSTALL_ENGINES); do \
  774. if [ "$$e" = "dummy" ]; then continue; fi; \
  775. fn=`basename $$e`; \
  776. $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
  777. cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
  778. chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \
  779. mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \
  780. "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
  781. done
  782. uninstall_engines:
  783. @$(ECHO) "*** Uninstalling engines"
  784. @set -e; for e in dummy $(INSTALL_ENGINES); do \
  785. if [ "$$e" = "dummy" ]; then continue; fi; \
  786. fn=`basename $$e`; \
  787. $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
  788. $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \
  789. done
  790. -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)"
  791. install_modules: _install_modules_deps
  792. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  793. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)/"
  794. @$(ECHO) "*** Installing modules"
  795. @set -e; for e in dummy $(INSTALL_MODULES); do \
  796. if [ "$$e" = "dummy" ]; then continue; fi; \
  797. fn=`basename $$e`; \
  798. $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \
  799. cp $$e "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \
  800. chmod 755 "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \
  801. mv -f "$(DESTDIR)$(MODULESDIR)/$$fn.new" \
  802. "$(DESTDIR)$(MODULESDIR)/$$fn"; \
  803. done
  804. uninstall_modules:
  805. @$(ECHO) "*** Uninstalling modules"
  806. @set -e; for e in dummy $(INSTALL_MODULES); do \
  807. if [ "$$e" = "dummy" ]; then continue; fi; \
  808. fn=`basename $$e`; \
  809. $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \
  810. $(RM) "$(DESTDIR)$(MODULESDIR)/$$fn"; \
  811. done
  812. -$(RMDIR) "$(DESTDIR)$(MODULESDIR)"
  813. install_runtime: install_programs
  814. install_runtime_libs: build_libs
  815. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  816. @ : {- output_off() if windowsdll(); "" -}
  817. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
  818. @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
  819. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)/"
  820. @ : {- output_on() unless windowsdll(); "" -}
  821. @$(ECHO) "*** Installing runtime libraries"
  822. @set -e; for s in dummy $(INSTALL_SHLIBS); do \
  823. if [ "$$s" = "dummy" ]; then continue; fi; \
  824. fn=`basename $$s`; \
  825. : {- output_off() unless windowsdll(); "" -}; \
  826. $(ECHO) "install $$s -> $(DESTDIR)$(bindir)/$$fn"; \
  827. cp $$s "$(DESTDIR)$(bindir)/$$fn.new"; \
  828. chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
  829. mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
  830. "$(DESTDIR)$(bindir)/$$fn"; \
  831. : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
  832. $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
  833. cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \
  834. chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \
  835. mv -f "$(DESTDIR)$(libdir)/$$fn.new" \
  836. "$(DESTDIR)$(libdir)/$$fn"; \
  837. : {- output_on() if windowsdll(); "" -}; \
  838. done
  839. install_programs: install_runtime_libs build_programs
  840. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  841. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)"
  842. @$(ECHO) "*** Installing runtime programs"
  843. @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
  844. if [ "$$x" = "dummy" ]; then continue; fi; \
  845. fn=`basename $$x`; \
  846. $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
  847. cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \
  848. chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
  849. mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
  850. "$(DESTDIR)$(bindir)/$$fn"; \
  851. done
  852. @set -e; for x in dummy $(BIN_SCRIPTS); do \
  853. if [ "$$x" = "dummy" ]; then continue; fi; \
  854. fn=`basename $$x`; \
  855. $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \
  856. cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \
  857. chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \
  858. mv -f "$(DESTDIR)$(bindir)/$$fn.new" \
  859. "$(DESTDIR)$(bindir)/$$fn"; \
  860. done
  861. uninstall_runtime: uninstall_programs uninstall_runtime_libs
  862. uninstall_programs:
  863. @$(ECHO) "*** Uninstalling runtime programs"
  864. @set -e; for x in dummy $(INSTALL_PROGRAMS); \
  865. do \
  866. if [ "$$x" = "dummy" ]; then continue; fi; \
  867. fn=`basename $$x`; \
  868. $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
  869. $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
  870. done;
  871. @set -e; for x in dummy $(BIN_SCRIPTS); \
  872. do \
  873. if [ "$$x" = "dummy" ]; then continue; fi; \
  874. fn=`basename $$x`; \
  875. $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
  876. $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
  877. done
  878. -$(RMDIR) "$(DESTDIR)$(bindir)"
  879. uninstall_runtime_libs:
  880. @$(ECHO) "*** Uninstalling runtime libraries"
  881. @ : {- output_off() unless windowsdll(); "" -}
  882. @set -e; for s in dummy $(INSTALL_SHLIBS); do \
  883. if [ "$$s" = "dummy" ]; then continue; fi; \
  884. fn=`basename $$s`; \
  885. $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \
  886. $(RM) "$(DESTDIR)$(bindir)/$$fn"; \
  887. done
  888. @ : {- output_on() unless windowsdll(); "" -}
  889. install_man_docs: build_man_docs
  890. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  891. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man1"
  892. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man3"
  893. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man5"
  894. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man7"
  895. @$(ECHO) "*** Installing manpages"
  896. @set -e; for x in dummy $(MANDOCS1); do \
  897. if [ "$$x" = "dummy" ]; then continue; fi; \
  898. fn=`basename $$x`; \
  899. $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
  900. cp $$x "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
  901. chmod 644 "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
  902. $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \
  903. done
  904. @set -e; for x in dummy $(MANDOCS3); do \
  905. if [ "$$x" = "dummy" ]; then continue; fi; \
  906. fn=`basename $$x`; \
  907. $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
  908. cp $$x "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
  909. chmod 644 "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
  910. $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \
  911. done
  912. @set -e; for x in dummy $(MANDOCS5); do \
  913. if [ "$$x" = "dummy" ]; then continue; fi; \
  914. fn=`basename $$x`; \
  915. $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
  916. cp $$x "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
  917. chmod 644 "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
  918. $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \
  919. done
  920. @set -e; for x in dummy $(MANDOCS7); do \
  921. if [ "$$x" = "dummy" ]; then continue; fi; \
  922. fn=`basename $$x`; \
  923. $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
  924. cp $$x "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
  925. chmod 644 "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
  926. $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \
  927. done
  928. uninstall_man_docs: build_man_docs
  929. @$(ECHO) "*** Uninstalling manpages"
  930. @set -e; for x in dummy $(MANDOCS1); do \
  931. if [ "$$x" = "dummy" ]; then continue; fi; \
  932. fn=`basename $$x`; \
  933. $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
  934. $(RM) "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \
  935. $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \
  936. done
  937. @set -e; for x in dummy $(MANDOCS3); do \
  938. if [ "$$x" = "dummy" ]; then continue; fi; \
  939. fn=`basename $$x`; \
  940. $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
  941. $(RM) "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \
  942. $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \
  943. done
  944. @set -e; for x in dummy $(MANDOCS5); do \
  945. if [ "$$x" = "dummy" ]; then continue; fi; \
  946. fn=`basename $$x`; \
  947. $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
  948. $(RM) "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \
  949. $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \
  950. done
  951. @set -e; for x in dummy $(MANDOCS7); do \
  952. if [ "$$x" = "dummy" ]; then continue; fi; \
  953. fn=`basename $$x`; \
  954. $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
  955. $(RM) "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \
  956. $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \
  957. done
  958. install_html_docs: install_image_docs build_html_docs
  959. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  960. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man1"
  961. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man3"
  962. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man5"
  963. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7"
  964. @$(ECHO) "*** Installing HTML manpages"
  965. @set -e; for x in dummy $(HTMLDOCS1); do \
  966. if [ "$$x" = "dummy" ]; then continue; fi; \
  967. fn=`basename $$x`; \
  968. $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
  969. cp $$x "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
  970. chmod 644 "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
  971. done
  972. @set -e; for x in dummy $(HTMLDOCS3); do \
  973. if [ "$$x" = "dummy" ]; then continue; fi; \
  974. fn=`basename $$x`; \
  975. $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
  976. cp $$x "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
  977. chmod 644 "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
  978. done
  979. @set -e; for x in dummy $(HTMLDOCS5); do \
  980. if [ "$$x" = "dummy" ]; then continue; fi; \
  981. fn=`basename $$x`; \
  982. $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
  983. cp $$x "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
  984. chmod 644 "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
  985. done
  986. @set -e; for x in dummy $(HTMLDOCS7); do \
  987. if [ "$$x" = "dummy" ]; then continue; fi; \
  988. fn=`basename $$x`; \
  989. $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
  990. cp $$x "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
  991. chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
  992. done
  993. uninstall_html_docs: uninstall_image_docs
  994. @$(ECHO) "*** Uninstalling HTML manpages"
  995. @set -e; for x in dummy $(HTMLDOCS1); do \
  996. if [ "$$x" = "dummy" ]; then continue; fi; \
  997. fn=`basename $$x`; \
  998. $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
  999. $(RM) "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \
  1000. done
  1001. @set -e; for x in dummy $(HTMLDOCS3); do \
  1002. if [ "$$x" = "dummy" ]; then continue; fi; \
  1003. fn=`basename $$x`; \
  1004. $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
  1005. $(RM) "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \
  1006. done
  1007. @set -e; for x in dummy $(HTMLDOCS5); do \
  1008. if [ "$$x" = "dummy" ]; then continue; fi; \
  1009. fn=`basename $$x`; \
  1010. $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
  1011. $(RM) "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \
  1012. done
  1013. @set -e; for x in dummy $(HTMLDOCS7); do \
  1014. if [ "$$x" = "dummy" ]; then continue; fi; \
  1015. fn=`basename $$x`; \
  1016. $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
  1017. $(RM) "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \
  1018. done
  1019. install_image_docs:
  1020. @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7/img"
  1021. @set -e; for x in dummy $(IMAGEDOCS7); do \
  1022. if [ "$$x" = "dummy" ]; then continue; fi; \
  1023. fn=`basename $$x`; \
  1024. $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
  1025. cp $(SRCDIR)/$$x "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
  1026. chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
  1027. done
  1028. uninstall_image_docs:
  1029. @set -e; for x in dummy $(IMAGEDOCS7); do \
  1030. if [ "$$x" = "dummy" ]; then continue; fi; \
  1031. fn=`basename $$x`; \
  1032. $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
  1033. $(RM) "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \
  1034. done
  1035. # Developer targets (note: these are only available on Unix) #########
  1036. ##@ Code maintenance
  1037. # It's important that generate_buildinfo comes after ordinals, as ordinals
  1038. # is sensitive to build.info changes.
  1039. update: generate errors ordinals generate_buildinfo ## Update errors, ordinals and build info
  1040. .PHONY: generate generate_apps generate_crypto_bn generate_crypto_objects \
  1041. generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
  1042. generate: generate_apps generate_crypto_bn generate_crypto_objects \
  1043. generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
  1044. .PHONY: generate_buildinfo generate_doc_buildinfo
  1045. generate_buildinfo: generate_doc_buildinfo
  1046. .PHONY: doc-nits md-nits
  1047. doc-nits: build_generated_pods ## Evaluate OpenSSL documentation
  1048. $(PERL) $(SRCDIR)/util/find-doc-nits -c -n -l -e
  1049. # This uses "mdl", the markdownlint application, which is written in ruby.
  1050. # The source is at https://github.com/markdownlint/markdownlint
  1051. # If you have ruby installed, "gem install mdl" should work.
  1052. # Another option is at https://snapcraft.io/install/mdl/debian
  1053. # Finally, there's a Node.js version, which we haven't tried, that
  1054. # can be found at https://github.com/DavidAnson/markdownlint
  1055. md-nits: ## Evaluate markdown files via "mdl"
  1056. mdl -s $(SRCDIR)/util/markdownlint.rb .
  1057. # Test coverage is a good idea for the future
  1058. #coverage: $(PROGRAMS) $(TESTPROGRAMS)
  1059. # ...
  1060. .PHONY: lint
  1061. lint: ## Evaluate C code via "splint"
  1062. @( cd $(SRCDIR); \
  1063. echo splint -DLINT -posixlib -preproc -D__gnuc_va_list=void \
  1064. -I. -Iinclude -Iapps/include $(CRYPTOHEADERS) $(SSLHEADERS) $(SRCS) )
  1065. .PHONY: check-format
  1066. check-format: ## Evaluate C code according to OpenSSL coding standards
  1067. ( cd $(SRCDIR); $(PERL) util/check-format.pl \
  1068. $(SRCS) \$(CRYPTOHEADERS) $(SSLHEADERS) )
  1069. generate_apps:
  1070. ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
  1071. < apps/openssl.cnf > apps/openssl-vms.cnf )
  1072. generate_crypto_bn:
  1073. ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
  1074. generate_crypto_objects:
  1075. ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
  1076. crypto/objects/objects.txt \
  1077. crypto/objects/obj_mac.num \
  1078. > crypto/objects/obj_mac.new && \
  1079. mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
  1080. ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
  1081. crypto/objects/objects.txt \
  1082. crypto/objects/obj_mac.num \
  1083. > include/openssl/obj_mac.h )
  1084. ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
  1085. include/openssl/obj_mac.h \
  1086. > crypto/objects/obj_dat.h )
  1087. ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
  1088. crypto/objects/obj_mac.num \
  1089. crypto/objects/obj_xref.txt \
  1090. > crypto/objects/obj_xref.h )
  1091. ( cd $(SRCDIR); sed -e '1,8d' crypto/objects/obj_compat.h >> include/openssl/obj_mac.h )
  1092. generate_crypto_conf:
  1093. ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
  1094. > crypto/conf/conf_def.h )
  1095. generate_crypto_asn1:
  1096. ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
  1097. > crypto/asn1/charmap.h )
  1098. generate_fuzz_oids:
  1099. ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
  1100. crypto/objects/obj_dat.h \
  1101. > fuzz/oids.txt )
  1102. generate_doc_buildinfo:
  1103. ( $(PERL) -I$(BLDDIR) -Mconfigdata \
  1104. $(SRCDIR)/util/dofile.pl -o Makefile \
  1105. $(SRCDIR)/doc/build.info.in \
  1106. > $(SRCDIR)/doc/build.info.new; \
  1107. if ( test -e $(SRCDIR)/doc/build.info \
  1108. && cmp $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info \
  1109. > /dev/null ); \
  1110. then \
  1111. rm $(SRCDIR)/doc/build.info.new; \
  1112. else \
  1113. mv $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info; \
  1114. fi )
  1115. generate_fips_sources: providers/fips.module.sources.new
  1116. providers/fips.module.sources.new: configdata.pm
  1117. rm -rf sources-tmp
  1118. mkdir sources-tmp
  1119. ( \
  1120. srcdir=`cd $(SRCDIR); pwd`; \
  1121. cd sources-tmp \
  1122. && $$srcdir/Configure --banner=Configured enable-fips -O0 \
  1123. && ./configdata.pm --query 'get_sources("providers/fips")' > sources1 \
  1124. && "$(MAKE)" -sj 4 build_generated providers/fips.so \
  1125. && find . -name '*.d' | xargs cat > dep1 \
  1126. && "$(MAKE)" distclean \
  1127. && $$srcdir/Configure --banner=Configured enable-fips no-asm -O0 \
  1128. && ./configdata.pm --query 'get_sources("providers/fips")' > sources2 \
  1129. && "$(MAKE)" -sj 4 build_generated providers/fips.so \
  1130. && find . -name '*.d' | xargs cat > dep2 \
  1131. && cat sources1 sources2 \
  1132. | grep -v ' : \\$$' | grep -v util/providers.num \
  1133. | sed -e 's/^ *//' -e 's/ *\\$$//' \
  1134. | sort | uniq > sources \
  1135. && cat dep1 dep2 \
  1136. | $(PERL) -p -e 's/\\\n//' \
  1137. | sed -e 's/^.*: *//' -e 's/ */ /g' \
  1138. | fgrep -f sources \
  1139. | tr ' ' '\n' \
  1140. | sort | uniq > deps.raw \
  1141. && cat deps.raw \
  1142. | xargs ./configdata.pm --query 'get_sources(@ARGV)' \
  1143. | $(PERL) -p -e 's/\\\n//' \
  1144. | sed -e 's/\./\\\./g' -e 's/ : */:/' -e 's/^/s:/' -e 's/$$/:/' \
  1145. > deps.sed \
  1146. && cat deps.raw | sed -f deps.sed > deps \
  1147. )
  1148. ( \
  1149. cat sources-tmp/sources sources-tmp/deps \
  1150. | $(PERL) -p -e 's:^ *\Q../\E:: ;' \
  1151. -e 's:^\Q$(SRCDIR)/\E:: if "$(SRCDIR)" ne "." ;' \
  1152. -e 'my $$x; do { $$x = $$_; s:(^|/)((?!\Q../\E)[^/]*/)\Q..\E($$|/):$$1: } while ($$x ne $$_) ;' ; \
  1153. cd $(SRCDIR); \
  1154. for x in crypto/bn/asm/*.pl crypto/bn/asm/*.S \
  1155. crypto/aes/asm/*.pl crypto/aes/asm/*.S \
  1156. crypto/ec/asm/*.pl \
  1157. crypto/modes/asm/*.pl \
  1158. crypto/sha/asm/*.pl \
  1159. crypto/*cpuid.pl crypto/*cpuid.S \
  1160. crypto/*cap.c; do \
  1161. echo "$$x"; \
  1162. done \
  1163. ) | grep -v sm2p256 | sort | uniq > providers/fips.module.sources.new
  1164. rm -rf sources-tmp
  1165. # Set to -force to force a rebuild
  1166. ERROR_REBUILD=
  1167. errors:
  1168. ( b=`pwd`; set -e; cd $(SRCDIR); \
  1169. $(PERL) util/ck_errf.pl -strict -internal; \
  1170. $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
  1171. ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
  1172. for E in *.ec ; do \
  1173. $(PERL) ../util/ck_errf.pl -strict \
  1174. -conf $$E `basename $$E .ec`.c; \
  1175. $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
  1176. -conf $$E `basename $$E .ec`.c ; \
  1177. done )
  1178. {- use File::Basename;
  1179. my @sslheaders_tmpl =
  1180. qw( include/openssl/ssl.h
  1181. include/openssl/ssl2.h
  1182. include/openssl/ssl3.h
  1183. include/openssl/sslerr.h
  1184. include/openssl/tls1.h
  1185. include/openssl/dtls1.h
  1186. include/openssl/srtp.h
  1187. include/openssl/quic.h
  1188. include/openssl/sslerr_legacy.h );
  1189. my @cryptoheaders_tmpl =
  1190. qw( include/internal/dso.h
  1191. include/internal/o_dir.h
  1192. include/internal/err.h
  1193. include/internal/evp.h
  1194. include/internal/pem.h
  1195. include/internal/asn1.h
  1196. include/internal/sslconf.h );
  1197. my @cryptoskipheaders = ( @sslheaders_tmpl,
  1198. qw( include/openssl/asn1_mac.h
  1199. include/openssl/conf_api.h
  1200. include/openssl/ebcdic.h
  1201. include/openssl/opensslconf.h
  1202. include/openssl/symhacks.h ) );
  1203. our %cryptoheaders = ();
  1204. our %sslheaders = ();
  1205. foreach my $d ( qw( include/openssl include/internal ) ) {
  1206. my @header_patterns =
  1207. map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' );
  1208. foreach my $f ( map { glob($_) } @header_patterns ) {
  1209. my $base = basename($f);
  1210. my $base_in = basename($f, '.in');
  1211. my $dir = catfile($config{sourcedir}, $d);
  1212. if ($base ne $base_in) {
  1213. # We have a .h.in file, which means the header file is in the
  1214. # build tree.
  1215. $base = $base_in;
  1216. $dir = catfile($config{builddir}, $d);
  1217. }
  1218. my $new_f = catfile($dir, $base);
  1219. my $fn = "$d/$base";
  1220. # The logic to add files to @cryptoheaders is a bit complex. The
  1221. # file to be added must be either in the public header directory
  1222. # or one of the pre-declared internal headers, and must under no
  1223. # circumstances be one of those that must be skipped.
  1224. $cryptoheaders{$new_f} = 1
  1225. if (($d eq 'include/openssl'
  1226. || ( grep { $_ eq $fn } @cryptoheaders_tmpl ))
  1227. && !( grep { $_ eq $fn } @cryptoskipheaders ));
  1228. # The logic to add files to @sslheaders is much simpler...
  1229. $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl;
  1230. }
  1231. }
  1232. "";
  1233. -}
  1234. SRCS={-
  1235. sub uniq { my %seen; grep !$seen{$_}++, @_; }
  1236. sub flat(@) { return map { ref eq 'ARRAY' ? @$_ : $_ } @_; }
  1237. join(" \\\n" . ' ' x 5, fill_lines(" ", $COLUMNS - 5,
  1238. uniq(grep /\.(c|cc|cpp)$/,
  1239. flat (map { $unified_info{sources}->{$_} }
  1240. (sort keys %{$unified_info{sources}})))))
  1241. -}
  1242. CRYPTOHEADERS={- join(" \\\n" . ' ' x 14,
  1243. fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -}
  1244. SSLHEADERS={- join(" \\\n" . ' ' x 11,
  1245. fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
  1246. renumber: build_generated
  1247. $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
  1248. --ordinals $(SRCDIR)/util/libcrypto.num \
  1249. --symhacks $(SRCDIR)/include/openssl/symhacks.h \
  1250. --renumber \
  1251. $(CRYPTOHEADERS)
  1252. $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
  1253. --ordinals $(SRCDIR)/util/libssl.num \
  1254. --symhacks $(SRCDIR)/include/openssl/symhacks.h \
  1255. --renumber \
  1256. $(SSLHEADERS)
  1257. .PHONY: ordinals
  1258. ordinals: build_generated
  1259. $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
  1260. --ordinals $(SRCDIR)/util/libcrypto.num \
  1261. --symhacks $(SRCDIR)/include/openssl/symhacks.h \
  1262. $(CRYPTOHEADERS)
  1263. $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
  1264. --ordinals $(SRCDIR)/util/libssl.num \
  1265. --symhacks $(SRCDIR)/include/openssl/symhacks.h \
  1266. $(SSLHEADERS)
  1267. test_ordinals:
  1268. "$(MAKE)" run_tests TESTS=test_ordinals
  1269. tags TAGS: FORCE
  1270. rm -f TAGS tags
  1271. -( cd $(SRCDIR); util/ctags.sh )
  1272. -etags `find . -name '*.[ch]' -o -name '*.pm'`
  1273. providers/fips.checksum.new: providers/fips.module.sources.new
  1274. @which unifdef > /dev/null || \
  1275. ( echo >&2 "ERROR: unifdef not in your \$$PATH, FIPS checksums not calculated"; \
  1276. false )
  1277. ( sources=`pwd`/providers/fips.module.sources.new; \
  1278. cd $(SRCDIR) \
  1279. && cat $$sources \
  1280. | xargs ./util/fips-checksums.sh ) \
  1281. > providers/fips-sources.checksums.new \
  1282. && sha256sum providers/fips-sources.checksums.new \
  1283. | sed -e 's|\.new||' > providers/fips.checksum.new
  1284. fips-checksums: providers/fips.checksum.new
  1285. $(SRCDIR)/providers/fips.checksum: providers/fips.checksum.new
  1286. cp -p providers/fips.module.sources.new $(SRCDIR)/providers/fips.module.sources
  1287. cp -p providers/fips-sources.checksums.new $(SRCDIR)/providers/fips-sources.checksums
  1288. cp -p providers/fips.checksum.new $(SRCDIR)/providers/fips.checksum
  1289. update-fips-checksums: $(SRCDIR)/providers/fips.checksum
  1290. diff-fips-checksums: fips-checksums
  1291. diff -u $(SRCDIR)/providers/fips.module.sources providers/fips.module.sources.new
  1292. diff -u $(SRCDIR)/providers/fips-sources.checksums providers/fips-sources.checksums.new
  1293. diff -u $(SRCDIR)/providers/fips.checksum providers/fips.checksum.new
  1294. # Release targets (note: only available on Unix) #####################
  1295. tar:
  1296. (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
  1297. # Helper targets #####################################################
  1298. link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/apps/openssl.cnf
  1299. $(BLDDIR)/util/opensslwrap.sh: Makefile
  1300. @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
  1301. mkdir -p "$(BLDDIR)/util"; \
  1302. ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \
  1303. fi
  1304. $(BLDDIR)/apps/openssl.cnf: Makefile
  1305. @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
  1306. mkdir -p "$(BLDDIR)/apps"; \
  1307. ln -sf "../$(SRCDIR)/apps/`basename "$@"`" "$(BLDDIR)/apps"; \
  1308. fi
  1309. FORCE:
  1310. # Building targets ###################################################
  1311. libcrypto.pc libssl.pc openssl.pc: Makefile $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
  1312. libcrypto.pc:
  1313. @ ( echo 'prefix=$(INSTALLTOP)'; \
  1314. echo 'exec_prefix=$${prefix}'; \
  1315. if [ -n "$(LIBDIR)" ]; then \
  1316. echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
  1317. else \
  1318. echo 'libdir=$(libdir)'; \
  1319. fi; \
  1320. echo 'includedir=$${prefix}/include'; \
  1321. echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
  1322. echo 'modulesdir=$${libdir}/ossl-modules'; \
  1323. echo ''; \
  1324. echo 'Name: OpenSSL-libcrypto'; \
  1325. echo 'Description: OpenSSL cryptography library'; \
  1326. echo 'Version: '$(VERSION); \
  1327. echo 'Libs: -L$${libdir} -lcrypto'; \
  1328. echo 'Libs.private: $(LIB_EX_LIBS)'; \
  1329. echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
  1330. libssl.pc:
  1331. @ ( echo 'prefix=$(INSTALLTOP)'; \
  1332. echo 'exec_prefix=$${prefix}'; \
  1333. if [ -n "$(LIBDIR)" ]; then \
  1334. echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
  1335. else \
  1336. echo 'libdir=$(libdir)'; \
  1337. fi; \
  1338. echo 'includedir=$${prefix}/include'; \
  1339. echo ''; \
  1340. echo 'Name: OpenSSL-libssl'; \
  1341. echo 'Description: Secure Sockets Layer and cryptography libraries'; \
  1342. echo 'Version: '$(VERSION); \
  1343. echo 'Requires.private: libcrypto'; \
  1344. echo 'Libs: -L$${libdir} -lssl'; \
  1345. echo 'Cflags: -I$${includedir}' ) > libssl.pc
  1346. openssl.pc:
  1347. @ ( echo 'prefix=$(INSTALLTOP)'; \
  1348. echo 'exec_prefix=$${prefix}'; \
  1349. if [ -n "$(LIBDIR)" ]; then \
  1350. echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
  1351. else \
  1352. echo 'libdir=$(libdir)'; \
  1353. fi; \
  1354. echo 'includedir=$${prefix}/include'; \
  1355. echo ''; \
  1356. echo 'Name: OpenSSL'; \
  1357. echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
  1358. echo 'Version: '$(VERSION); \
  1359. echo 'Requires: libssl libcrypto' ) > openssl.pc
  1360. Makefile: configdata.pm \
  1361. {- join(" \\\n" . ' ' x 10,
  1362. fill_lines(" ", $COLUMNS - 10,
  1363. @{$config{build_file_templates}})) -}
  1364. @echo "Detected changed: $?"
  1365. $(PERL) configdata.pm
  1366. @echo "**************************************************"
  1367. @echo "*** ***"
  1368. @echo "*** Please run the same make command again ***"
  1369. @echo "*** ***"
  1370. @echo "**************************************************"
  1371. @false
  1372. configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \
  1373. {- join(" \\\n" . ' ' x 15,
  1374. fill_lines(" ", $COLUMNS - 15,
  1375. @{$config{build_infos}},
  1376. @{$config{conf_files}})) -}
  1377. @echo "Detected changed: $?"
  1378. $(PERL) configdata.pm -r
  1379. @echo "**************************************************"
  1380. @echo "*** ***"
  1381. @echo "*** Please run the same make command again ***"
  1382. @echo "*** ***"
  1383. @echo "**************************************************"
  1384. @false
  1385. reconfigure reconf:
  1386. $(PERL) configdata.pm -r
  1387. {-
  1388. use File::Basename;
  1389. use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
  1390. # Helper function to convert dependencies in platform agnostic form to
  1391. # dependencies in platform form.
  1392. sub compute_platform_depends {
  1393. map { my $x = $_;
  1394. grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x)
  1395. or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x)
  1396. or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x)
  1397. or platform->convertext($x); } @_;
  1398. }
  1399. # Helper function to figure out dependencies on libraries
  1400. # It takes a list of library names and outputs a list of dependencies
  1401. sub compute_lib_depends {
  1402. # Depending on shared libraries:
  1403. # On Windows POSIX layers, we depend on {libname}.dll.a
  1404. # On Unix platforms, we depend on {shlibname}.so
  1405. return map { platform->sharedlib_simple($_)
  1406. // platform->sharedlib_import($_)
  1407. // platform->sharedlib($_)
  1408. // platform->staticlib($_)
  1409. } @_;
  1410. }
  1411. sub generatetarget {
  1412. my %args = @_;
  1413. my $deps = join(" ", compute_platform_depends(@{$args{deps}}));
  1414. return <<"EOF";
  1415. $args{target}: $deps
  1416. EOF
  1417. }
  1418. sub generatesrc {
  1419. my %args = @_;
  1420. my $gen0 = $args{generator}->[0];
  1421. my $gen_args = join('', map { " $_" }
  1422. @{$args{generator}}[1..$#{$args{generator}}]);
  1423. my $gen_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
  1424. my $incs = join("", map { " -I".$_ } @{$args{incs}});
  1425. my $defs = join("", map { " -D".$_ } @{$args{defs}});
  1426. my $deps = join(" ", compute_platform_depends(@{$args{generator_deps}},
  1427. @{$args{deps}}));
  1428. if ($args{src} =~ /\.html$/) {
  1429. #
  1430. # HTML generator
  1431. #
  1432. my $title = basename($args{src}, ".html");
  1433. my $pod = $gen0;
  1434. return <<"EOF";
  1435. $args{src}: $pod
  1436. \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc"
  1437. EOF
  1438. } elsif ($args{src} =~ /\.(\d)$/) {
  1439. #
  1440. # Man-page generator
  1441. #
  1442. my $section = $1;
  1443. my $name = uc basename($args{src}, ".$section");
  1444. my $pod = $gen0;
  1445. return <<"EOF";
  1446. $args{src}: $pod
  1447. pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\
  1448. --release=\$(VERSION) $pod >\$\@
  1449. EOF
  1450. } elsif (platform->isdef($args{src})) {
  1451. #
  1452. # Linker script-ish generator
  1453. #
  1454. my $target = platform->def($args{src});
  1455. (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
  1456. my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
  1457. my $ord_name = $args{generator}->[1] || $args{product};
  1458. return <<"EOF";
  1459. $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl
  1460. \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS $mkdef_os > $target
  1461. EOF
  1462. } elsif (platform->isasm($args{src})
  1463. || platform->iscppasm($args{src})) {
  1464. #
  1465. # Assembler generator
  1466. #
  1467. my $cppflags = {
  1468. shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  1469. lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  1470. dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
  1471. bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
  1472. } -> {$args{intent}};
  1473. my $generator;
  1474. if ($gen0 =~ /\.pl$/) {
  1475. $generator = 'CC="$(CC)" $(PERL)'.$gen_incs.' '.$gen0.$gen_args
  1476. .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)';
  1477. } elsif ($gen0 =~ /\.m4$/) {
  1478. $generator = 'm4 -B 8192'.$gen_incs.' '.$gen0.$gen_args.' >'
  1479. } elsif ($gen0 =~ /\.S$/) {
  1480. $generator = undef;
  1481. } else {
  1482. die "Generator type for $args{src} unknown: $gen0\n";
  1483. }
  1484. if (defined($generator)) {
  1485. return <<"EOF";
  1486. $args{src}: $gen0 $deps
  1487. $generator \$@
  1488. EOF
  1489. }
  1490. return <<"EOF";
  1491. $args{src}: $gen0 $deps
  1492. \$(CC) $incs $cppflags $defs -E $gen0 | \\
  1493. \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
  1494. EOF
  1495. } elsif ($gen0 =~ m|^.*\.in$|) {
  1496. #
  1497. # "dofile" generator (file.in -> file)
  1498. #
  1499. my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
  1500. "util", "dofile.pl")),
  1501. rel2abs($config{builddir}));
  1502. my @perlmodules = ();
  1503. my %perlmoduleincs = ();
  1504. my %perlmoduledeps = ();
  1505. foreach my $x (('configdata.pm', @{$args{deps}})) {
  1506. # Compute (i)nclusion directory, (m)odule name and (d)ependency
  1507. my $i, $m, $d;
  1508. if ($x =~ /\|/) {
  1509. $i = $`;
  1510. $d = $';
  1511. # Massage the module part to become a real perl module spec
  1512. $m = $d;
  1513. $m =~ s|\.pm$||;
  1514. # Directory specs are :: in perl package names
  1515. $m =~ s|/|::|g;
  1516. # Full file name of the dependency
  1517. $d = catfile($i, $d) if $i;
  1518. } elsif ($x =~ /\.pm$/) {
  1519. $i = dirname($x);
  1520. $m = basename($x, '.pm');
  1521. $d = $x;
  1522. } else {
  1523. # All other dependencies are simply collected
  1524. $d = $x;
  1525. }
  1526. push @perlmodules, '"-M'.$m.'"' if $m;
  1527. $perlmoduledeps{$d} = 1;
  1528. $perlmoduleincs{'"-I'.$i.'"'} = 1 if $i;
  1529. }
  1530. # Because of the special treatment of dependencies, we need to
  1531. # recompute $deps completely
  1532. my $deps
  1533. = join(" ", compute_platform_depends(@{$args{generator_deps}},
  1534. sort keys %perlmoduledeps));
  1535. my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules);
  1536. return <<"EOF";
  1537. $args{src}: $gen0 $deps
  1538. \$(PERL)$perlmodules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@
  1539. EOF
  1540. } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) {
  1541. #
  1542. # Generic generator using OpenSSL programs
  1543. #
  1544. # Redo $gen0, to ensure that we have the proper extension where
  1545. # necessary.
  1546. $gen0 = platform->bin($gen0);
  1547. # Use $(PERL) to execute wrap.pl directly to avoid calling env
  1548. return <<"EOF";
  1549. $args{src}: $gen0 $deps \$(BLDDIR)/util/wrap.pl
  1550. \$(PERL) \$(BLDDIR)/util/wrap.pl $gen0$gen_args > \$@
  1551. EOF
  1552. } else {
  1553. #
  1554. # Generic generator using Perl
  1555. #
  1556. return <<"EOF";
  1557. $args{src}: $gen0 $deps
  1558. \$(PERL)$gen_incs $gen0$gen_args > \$@
  1559. EOF
  1560. }
  1561. }
  1562. # Should one wonder about the end of the Perl snippet, it's because this
  1563. # second regexp eats up line endings as well, if the removed path is the
  1564. # last in the line. We may therefore need to put back a line ending.
  1565. sub src2obj {
  1566. my %args = @_;
  1567. my $obj = platform->convertext($args{obj});
  1568. my $dep = platform->dep($args{obj});
  1569. my @srcs = @{$args{srcs}};
  1570. my $srcs = join(" ", @srcs);
  1571. my $deps = join(" ", @srcs, @{$args{deps}});
  1572. my $incs = join("", map { " -I".$_ } @{$args{incs}});
  1573. my $defs = join("", map { " -D".$_ } @{$args{defs}});
  1574. my $cmd;
  1575. my $cmdflags;
  1576. my $cmdcompile;
  1577. if (grep /\.rc$/, @srcs) {
  1578. $cmd = '$(RC)';
  1579. $cmdflags = '$(RCFLAGS)';
  1580. $cmdcompile = '';
  1581. } elsif (grep /\.(cc|cpp)$/, @srcs) {
  1582. $cmd = '$(CXX)';
  1583. $cmdcompile = ' -c';
  1584. $cmdflags = {
  1585. shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
  1586. lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
  1587. dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
  1588. bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
  1589. } -> {$args{intent}};
  1590. } else {
  1591. $cmd = '$(CC)';
  1592. $cmdcompile = ' -c';
  1593. $cmdflags = {
  1594. shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  1595. lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  1596. dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
  1597. bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
  1598. } -> {$args{intent}};
  1599. }
  1600. my $recipe;
  1601. # extension-specific rules
  1602. if (grep /\.s$/, @srcs) {
  1603. $recipe .= <<"EOF";
  1604. $obj: $deps
  1605. $cmd $cmdflags -c -o \$\@ $srcs
  1606. EOF
  1607. } elsif (grep /\.S$/, @srcs) {
  1608. # Originally there was multi-step rule with $(CC) -E file.S
  1609. # followed by $(CC) -c file.s. It compensated for one of
  1610. # legacy platform compiler's inability to handle .S files.
  1611. # The platform is long discontinued by vendor so there is
  1612. # hardly a point to drag it along...
  1613. $recipe .= <<"EOF";
  1614. $obj: $deps
  1615. $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
  1616. EOF
  1617. } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) {
  1618. $recipe .= <<"EOF";
  1619. $obj: $deps
  1620. $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
  1621. \@touch $dep.tmp
  1622. \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
  1623. rm -f $dep.tmp; \\
  1624. else \\
  1625. mv $dep.tmp $dep; \\
  1626. fi
  1627. EOF
  1628. } else {
  1629. $recipe .= <<"EOF";
  1630. $obj: $deps
  1631. $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
  1632. EOF
  1633. if ($makedep_scheme eq 'makedepend') {
  1634. $recipe .= <<"EOF";
  1635. \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
  1636. > $dep
  1637. EOF
  1638. }
  1639. }
  1640. return $recipe;
  1641. }
  1642. # We *know* this routine is only called when we've configure 'shared'.
  1643. sub obj2shlib {
  1644. my %args = @_;
  1645. my @linkdirs = ();
  1646. my @linklibs = ();
  1647. foreach (@{$args{deps}}) {
  1648. if (platform->isstaticlib($_)) {
  1649. push @linklibs, platform->convertext($_);
  1650. } else {
  1651. my $d = "-L" . dirname($_);
  1652. my $l = basename($_);
  1653. $l =~ s/^lib//;
  1654. $l = "-l" . $l;
  1655. push @linklibs, $l;
  1656. push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
  1657. }
  1658. }
  1659. my $linkflags = join("", map { $_." " } @linkdirs);
  1660. my $linklibs = join("", map { $_." " } @linklibs);
  1661. my @objs = map { platform->convertext($_) }
  1662. grep { !platform->isdef($_) }
  1663. @{$args{objs}};
  1664. my @defs = map { platform->def($_) }
  1665. grep { platform->isdef($_) }
  1666. @{$args{objs}};
  1667. my @deps = compute_lib_depends(@{$args{deps}});
  1668. die "More than one exported symbol map" if scalar @defs > 1;
  1669. my $full = platform->sharedlib($args{lib});
  1670. # $import is for Windows and subsystems thereof, where static import
  1671. # libraries for DLLs are a thing. On platforms that have this mechanism,
  1672. # $import has the name of this import library. On platforms that don't
  1673. # have this mechanism, $import will be |undef|.
  1674. my $import = platform->sharedlib_import($args{lib});
  1675. # $simple is for platforms where full shared library names include the
  1676. # shared library version, and there's a simpler name that doesn't include
  1677. # that version. On such platforms, $simple has the simpler name. On
  1678. # other platforms, it will be |undef|.
  1679. my $simple = platform->sharedlib_simple($args{lib});
  1680. my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef;
  1681. my $shared_soname = "";
  1682. $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
  1683. if defined $target{shared_sonameflag};
  1684. my $shared_imp = "";
  1685. $shared_imp .= ' '.$target{shared_impflag}.basename($import)
  1686. if defined $target{shared_impflag} && defined $import;
  1687. my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
  1688. # There is at least one platform where the compiler-as-linker needs to
  1689. # have one object file directly on the command line. That won't hurt
  1690. # any other platform, so we do that for everyone when there's an argfile
  1691. # to be had. This depends heavily on splice, which removes elements from
  1692. # the given array, and returns them so they can be captured.
  1693. my @argfileobjs = $argfile
  1694. ? splice(@objs, 1)
  1695. : ();
  1696. my $argfilecmds = $argfile
  1697. ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs)
  1698. : undef;
  1699. my $argfiledeps = $argfile
  1700. ? join(" \\\n" . ' ' x (length($argfile) + 2),
  1701. fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs))
  1702. : undef;
  1703. my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps);
  1704. my @fullobjs = (
  1705. @objs,
  1706. ($argfile ? $target{shared_argfileflag}.$argfile : ())
  1707. );
  1708. my $fulldeps =
  1709. join(" \\\n" . ' ' x (length($full) + 2),
  1710. fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps));
  1711. my $fullobjs =
  1712. join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs));
  1713. my $recipe = '';
  1714. if (defined $simple && $simple ne $full) {
  1715. if (sharedaix()) {
  1716. $recipe .= <<"EOF";
  1717. $simple: $full
  1718. rm -f $simple && \\
  1719. \$(AR) r $simple $full
  1720. EOF
  1721. } else {
  1722. $recipe .= <<"EOF";
  1723. $simple: $full
  1724. rm -f $simple && \\
  1725. ln -s $full $simple
  1726. EOF
  1727. }
  1728. }
  1729. if (defined $import) {
  1730. $recipe .= <<"EOF";
  1731. $import: $full
  1732. EOF
  1733. }
  1734. $recipe .= <<"EOF";
  1735. $full: $fulldeps
  1736. \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
  1737. -o $full$shared_def \\
  1738. $fullobjs \\
  1739. $linklibs \$(LIB_EX_LIBS)
  1740. EOF
  1741. if (windowsdll()) {
  1742. $recipe .= <<"EOF";
  1743. rm -f apps/$full
  1744. rm -f fuzz/$full
  1745. cp -p $full apps/
  1746. cp -p $full fuzz/
  1747. EOF
  1748. if (!$disabled{tests}) {
  1749. $recipe .= <<"EOF";
  1750. rm -f test/$full
  1751. cp -p $full test/
  1752. EOF
  1753. }
  1754. }
  1755. $recipe .= <<"EOF" if defined $argfile;
  1756. $argfile: $argfiledeps
  1757. \$(RM) $argfile
  1758. $argfilecmds
  1759. EOF
  1760. return $recipe;
  1761. }
  1762. sub obj2dso {
  1763. my %args = @_;
  1764. my $dso = platform->dso($args{module});
  1765. my @linkdirs = ();
  1766. my @linklibs = ();
  1767. foreach (@{$args{deps}}) {
  1768. next unless defined $_;
  1769. if (platform->isstaticlib($_)) {
  1770. push @linklibs, platform->convertext($_);
  1771. } else {
  1772. my $d = "-L" . dirname($_);
  1773. my $l = basename($_);
  1774. $l =~ s/^lib//;
  1775. $l = "-l" . $l;
  1776. push @linklibs, $l;
  1777. push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
  1778. }
  1779. }
  1780. my $linkflags = join("", map { $_." " } @linkdirs);
  1781. my $linklibs = join("", map { $_." " } @linklibs);
  1782. my @objs = map { platform->convertext($_) }
  1783. grep { !platform->isdef($_) }
  1784. @{$args{objs}};
  1785. my @defs = map { platform->def($_) }
  1786. grep { platform->isdef($_) }
  1787. @{$args{objs}};
  1788. my @deps = compute_lib_depends(@{$args{deps}});
  1789. my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
  1790. # Next line needs to become "less magic" (see PR #11950)
  1791. $shared_def .= ' '.$target{shared_fipsflag} if (defined $target{shared_fipsflag} && $shared_def =~ m/providers\/fips/);
  1792. my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
  1793. my $deps = join(" \\\n" . ' ' x (length($dso) + 2),
  1794. fill_lines(' ', $COLUMNS - length($dso) - 2,
  1795. @objs, @defs, @deps));
  1796. return <<"EOF";
  1797. $dso: $deps
  1798. \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
  1799. -o $dso$shared_def \\
  1800. $objs \\
  1801. $linklibs\$(DSO_EX_LIBS)
  1802. EOF
  1803. }
  1804. sub obj2lib {
  1805. my %args = @_;
  1806. my $lib = platform->staticlib($args{lib});
  1807. my @objs = map { platform->obj($_) } @{$args{objs}};
  1808. my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
  1809. fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
  1810. my $max_per_call = 500;
  1811. my @objs_grouped;
  1812. push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
  1813. my $fill_lib =
  1814. join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped));
  1815. return <<"EOF";
  1816. $lib: $deps
  1817. \$(RM) $lib
  1818. $fill_lib
  1819. \$(RANLIB) \$\@ || echo Never mind.
  1820. EOF
  1821. }
  1822. sub obj2bin {
  1823. my %args = @_;
  1824. my $bin = platform->bin($args{bin});
  1825. my @objs = map { platform->obj($_) } @{$args{objs}};
  1826. my @deps = compute_lib_depends(@{$args{deps}});
  1827. my $objs = join(" \\\n" . ' ' x (length($bin) + 2),
  1828. fill_lines(' ', $COLUMNS - length($bin) - 2, @objs));
  1829. my @linkdirs = ();
  1830. my @linklibs = ();
  1831. foreach (@{$args{deps}}) {
  1832. next unless defined $_;
  1833. if (platform->isstaticlib($_)) {
  1834. push @linklibs, platform->convertext($_);
  1835. } else {
  1836. my $d = "-L" . dirname($_);
  1837. my $l = basename($_);
  1838. $l =~ s/^lib//;
  1839. $l = "-l" . $l;
  1840. push @linklibs, $l;
  1841. push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
  1842. }
  1843. }
  1844. my $linkflags = join("", map { $_." " } @linkdirs);
  1845. my $linklibs = join("", map { $_." " } @linklibs);
  1846. my $cmd = '$(CC)';
  1847. my $cmdflags = '$(BIN_CFLAGS)';
  1848. if (grep /_cc\.o$/, @{$args{objs}}) {
  1849. $cmd = '$(CXX)';
  1850. $cmdflags = '$(BIN_CXXFLAGS)';
  1851. }
  1852. my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs));
  1853. my $deps = join(" \\\n" . ' ' x (length($bin) + 2),
  1854. fill_lines(' ', $COLUMNS - length($bin) - 2,
  1855. @objs, @deps));
  1856. return <<"EOF";
  1857. $bin: $deps
  1858. rm -f $bin
  1859. \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
  1860. -o $bin \\
  1861. $objs \\
  1862. $linklibs\$(BIN_EX_LIBS)
  1863. EOF
  1864. }
  1865. sub in2script {
  1866. my %args = @_;
  1867. my $script = $args{script};
  1868. my $sources = join(" ", @{$args{sources}});
  1869. my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
  1870. "util", "dofile.pl")),
  1871. rel2abs($config{builddir}));
  1872. return <<"EOF";
  1873. $script: $sources configdata.pm
  1874. \$(RM) "$script"
  1875. \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
  1876. "-o$target{build_file}" $sources > "$script"
  1877. chmod a+x $script
  1878. EOF
  1879. }
  1880. sub generatedir {
  1881. my %args = @_;
  1882. my $dir = $args{dir};
  1883. my @deps = compute_platform_depends(@{$args{deps}});
  1884. my @comments = ();
  1885. # We already have a 'test' target, and the top directory is just plain
  1886. # silly
  1887. return if $dir eq "test" || $dir eq ".";
  1888. foreach my $type (("dso", "lib", "bin", "script")) {
  1889. next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
  1890. # For lib object files, we could update the library. However, it
  1891. # was decided that it's enough to build the directory local object
  1892. # files, so we don't need to add any actions, and the dependencies
  1893. # are already taken care of.
  1894. if ($type ne "lib") {
  1895. foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
  1896. if (dirname($prod) eq $dir) {
  1897. push @deps, compute_platform_depends($prod);
  1898. } else {
  1899. push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
  1900. }
  1901. }
  1902. }
  1903. }
  1904. my $target = "$dir $dir/";
  1905. my $deps = join(" \\\n\t",
  1906. fill_lines(' ', $COLUMNS - 8, @deps));
  1907. my $comments = join("\n", "", @comments);
  1908. return <<"EOF";
  1909. $target: \\
  1910. $deps$comments
  1911. EOF
  1912. }
  1913. "" # Important! This becomes part of the template result.
  1914. -}