unix-Makefile.tmpl 79 KB

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