2
0

unix-Makefile.tmpl 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276
  1. ##
  2. ## Makefile for OpenSSL
  3. ##
  4. ## {- join("\n## ", @autowarntext) -}
  5. {-
  6. our $makedepprog = platform->makedepprog();
  7. sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
  8. # Shared AIX support is special. We put libcrypto[64].so.ver into
  9. # libcrypto.a and use libcrypto_a.a as static one.
  10. sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ }
  11. our $sover_dirname = platform->shlib_version_as_filename();
  12. # This makes sure things get built in the order they need
  13. # to. You're welcome.
  14. sub dependmagic {
  15. my $target = shift;
  16. return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
  17. }
  18. '';
  19. -}
  20. PLATFORM={- $config{target} -}
  21. OPTIONS={- $config{options} -}
  22. CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
  23. SRCDIR={- $config{sourcedir} -}
  24. BLDDIR={- $config{builddir} -}
  25. VERSION={- "$config{full_version}" -}
  26. MAJOR={- $config{major} -}
  27. MINOR={- $config{minor} -}
  28. SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
  29. SHLIB_TARGET={- $target{shared_target} -}
  30. LIBS={- join(" ", map { platform->staticlib($_) // () } @{$unified_info{libraries}}) -}
  31. SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
  32. SHLIB_INFO={- join(" ", map { my $x = platform->sharedlib($_);
  33. my $y = platform->sharedlib_simple($_);
  34. $x ? "\"$x;$y\"" : () }
  35. @{$unified_info{libraries}}) -}
  36. MODULES={- join(" ", map { platform->dso($_) } @{$unified_info{modules}}) -}
  37. PROGRAMS={- join(" ", map { platform->bin($_) } @{$unified_info{programs}}) -}
  38. SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
  39. {- output_off() if $disabled{makedepend}; "" -}
  40. DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () }
  41. grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
  42. keys %{$unified_info{sources}}); -}
  43. {- output_on() if $disabled{makedepend}; "" -}
  44. GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}}) -}
  45. GENERATED={- # common0.tmpl provides @generated
  46. join(" ", map { platform->convertext($_) } @generated ) -}
  47. INSTALL_LIBS={-
  48. join(" ", map { platform->staticlib($_) // () }
  49. grep { !$unified_info{attributes}->{$_}->{noinst} }
  50. @{$unified_info{libraries}})
  51. -}
  52. INSTALL_SHLIBS={-
  53. join(" ", map { platform->sharedlib($_) // () }
  54. grep { !$unified_info{attributes}->{$_}->{noinst} }
  55. @{$unified_info{libraries}})
  56. -}
  57. INSTALL_SHLIB_INFO={-
  58. join(" ", map { my $x = platform->sharedlib($_);
  59. my $y = platform->sharedlib_simple($_);
  60. $x ? "\"$x;$y\"" : () }
  61. grep { !$unified_info{attributes}->{$_}->{noinst} }
  62. @{$unified_info{libraries}})
  63. -}
  64. INSTALL_ENGINES={-
  65. join(" ", map { platform->dso($_) }
  66. grep { !$unified_info{attributes}->{$_}->{noinst}
  67. && $unified_info{attributes}->{$_}->{engine} }
  68. @{$unified_info{modules}})
  69. -}
  70. INSTALL_PROGRAMS={-
  71. join(" ", map { platform->bin($_) }
  72. grep { !$unified_info{attributes}->{$_}->{noinst} }
  73. @{$unified_info{programs}})
  74. -}
  75. BIN_SCRIPTS={-
  76. join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
  77. $x ? "$_:$x" : $_ }
  78. grep { !$unified_info{attributes}->{$_}->{noinst}
  79. && !$unified_info{attributes}->{$_}->{misc} }
  80. @{$unified_info{scripts}})
  81. -}
  82. MISC_SCRIPTS={-
  83. join(" ", map { my $x = $unified_info{attributes}->{$_}->{linkname};
  84. $x ? "$_:$x" : $_ }
  85. grep { !$unified_info{attributes}->{$_}->{noinst}
  86. && $unified_info{attributes}->{$_}->{misc} }
  87. @{$unified_info{scripts}})
  88. -}
  89. APPS_OPENSSL={- use File::Spec::Functions;
  90. catfile("apps","openssl") -}
  91. # DESTDIR is for package builders so that they can configure for, say,
  92. # /usr/ and yet have everything installed to /tmp/somedir/usr/.
  93. # Normally it is left empty.
  94. DESTDIR=
  95. # Do not edit these manually. Use Configure with --prefix or --openssldir
  96. # to change this! Short explanation in the top comment in Configure
  97. INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
  98. #
  99. our $prefix = $config{prefix} || "/usr/local";
  100. $prefix -}
  101. OPENSSLDIR={- #
  102. # The logic here is that if no --openssldir was given,
  103. # OPENSSLDIR will get the value from $prefix plus "/ssl".
  104. # If --openssldir was given and the value is an absolute
  105. # path, OPENSSLDIR will get its value without change.
  106. # If the value from --openssldir is a relative path,
  107. # OPENSSLDIR will get $prefix with the --openssldir
  108. # value appended as a subdirectory.
  109. #
  110. use File::Spec::Functions;
  111. our $openssldir =
  112. $config{openssldir} ?
  113. (file_name_is_absolute($config{openssldir}) ?
  114. $config{openssldir}
  115. : catdir($prefix, $config{openssldir}))
  116. : catdir($prefix, "ssl");
  117. $openssldir -}
  118. LIBDIR={- our $libdir = $config{libdir};
  119. unless ($libdir) {
  120. #
  121. # if $prefix/lib$target{multilib} is not an existing
  122. # directory, then assume that it's not searched by linker
  123. # automatically, in which case adding $target{multilib} suffix
  124. # causes more grief than we're ready to tolerate, so don't...
  125. our $multilib =
  126. -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
  127. $libdir = "lib$multilib";
  128. }
  129. file_name_is_absolute($libdir) ? "" : $libdir -}
  130. # $(libdir) is chosen to be compatible with the GNU coding standards
  131. libdir={- file_name_is_absolute($libdir)
  132. ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
  133. ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
  134. MODULESDIR=$(libdir)/ossl-modules
  135. # Convenience variable for those who want to set the rpath in shared
  136. # libraries and applications
  137. LIBRPATH=$(libdir)
  138. MANDIR=$(INSTALLTOP)/share/man
  139. DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
  140. HTMLDIR=$(DOCDIR)/html
  141. # MANSUFFIX is for the benefit of anyone who may want to have a suffix
  142. # appended after the manpage file section number. "ssl" is popular,
  143. # resulting in files such as config.5ssl rather than config.5.
  144. MANSUFFIX=
  145. HTMLSUFFIX=html
  146. # For "optional" echo messages, to get "real" silence
  147. ECHO = echo
  148. ##### User defined commands and flags ################################
  149. # We let the C compiler driver to take care of .s files. This is done in
  150. # order to be excused from maintaining a separate set of architecture
  151. # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
  152. # gcc, then the driver will automatically translate it to -xarch=v8plus
  153. # and pass it down to assembler. In any case, we do not define AS or
  154. # ASFLAGS for this reason.
  155. CROSS_COMPILE={- $config{CROSS_COMPILE} -}
  156. CC=$(CROSS_COMPILE){- $config{CC} -}
  157. CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -}
  158. CPPFLAGS={- our $cppflags1 = join(" ",
  159. (map { "-D".$_} @{$config{CPPDEFINES}}),
  160. (map { "-I".$_} @{$config{CPPINCLUDES}}),
  161. @{$config{CPPFLAGS}}) -}
  162. CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
  163. CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -}
  164. LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -}
  165. EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -}
  166. MAKEDEPEND={- $config{makedepprog} -}
  167. PERL={- $config{PERL} -}
  168. AR=$(CROSS_COMPILE){- $config{AR} -}
  169. ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
  170. RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -}
  171. RC= $(CROSS_COMPILE){- $config{RC} -}
  172. RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -}
  173. RM= rm -f
  174. RMDIR= rmdir
  175. TAR= {- $target{TAR} || "tar" -}
  176. TARFLAGS= {- $target{TARFLAGS} -}
  177. BASENAME= openssl
  178. NAME= $(BASENAME)-$(VERSION)
  179. # Relative to $(SRCDIR)
  180. TARFILE= ../$(NAME).tar
  181. ##### Project flags ##################################################
  182. # Variables starting with CNF_ are common variables for all product types
  183. CNF_CPPFLAGS={- our $cppflags2 =
  184. join(' ', $target{cppflags} || (),
  185. (map { "-D".$_} @{$target{defines}},
  186. @{$config{defines}}),
  187. (map { "-I".$_} @{$target{includes}},
  188. @{$config{includes}}),
  189. @{$config{cppflags}}) -}
  190. CNF_CFLAGS={- join(' ', $target{cflags} || (),
  191. @{$config{cflags}}) -}
  192. CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
  193. @{$config{cxxflags}}) -}
  194. CNF_LDFLAGS={- join(' ', $target{lflags} || (),
  195. @{$config{lflags}}) -}
  196. CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
  197. @{$config{ex_libs}}) -}
  198. # Variables starting with LIB_ are used to build library object files
  199. # and shared libraries.
  200. # Variables starting with DSO_ are used to build DSOs and their object files.
  201. # Variables starting with BIN_ are used to build programs and their object
  202. # files.
  203. LIB_CPPFLAGS={- our $lib_cppflags =
  204. join(' ', $target{lib_cppflags} || (),
  205. $target{shared_cppflag} || (),
  206. (map { '-D'.$_ }
  207. @{$config{lib_defines} || ()},
  208. @{$config{shared_defines} || ()}),
  209. @{$config{lib_cppflags}},
  210. @{$config{shared_cppflag}});
  211. join(' ', $lib_cppflags,
  212. (map { '-D'.$_ }
  213. 'OPENSSLDIR="\"$(OPENSSLDIR)\""',
  214. 'ENGINESDIR="\"$(ENGINESDIR)\""',
  215. 'MODULESDIR="\"$(MODULESDIR)\""'),
  216. '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
  217. LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
  218. $target{shared_cflag} || (),
  219. @{$config{lib_cflags}},
  220. @{$config{shared_cflag}},
  221. '$(CNF_CFLAGS)', '$(CFLAGS)') -}
  222. LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
  223. $target{shared_cxxflag} || (),
  224. @{$config{lib_cxxflags}},
  225. @{$config{shared_cxxflag}},
  226. '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
  227. LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
  228. $config{shared_ldflag} || (),
  229. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  230. LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  231. DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
  232. $target{module_cppflags} || (),
  233. (map { '-D'.$_ }
  234. @{$config{dso_defines} || ()},
  235. @{$config{module_defines} || ()}),
  236. @{$config{dso_cppflags}},
  237. @{$config{module_cppflags}},
  238. '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
  239. DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
  240. $target{module_cflags} || (),
  241. @{$config{dso_cflags}},
  242. @{$config{module_cflags}},
  243. '$(CNF_CFLAGS)', '$(CFLAGS)') -}
  244. DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (),
  245. $target{module_cxxflags} || (),
  246. @{$config{dso_cxxflags}},
  247. @{$config{module_cxxflag}},
  248. '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
  249. DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (),
  250. $target{module_ldflags} || (),
  251. @{$config{dso_ldflags}},
  252. @{$config{module_ldflags}},
  253. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  254. DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  255. BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
  256. (map { '-D'.$_ } @{$config{bin_defines} || ()}),
  257. @{$config{bin_cppflags}},
  258. '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
  259. BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
  260. @{$config{bin_cflags}},
  261. '$(CNF_CFLAGS)', '$(CFLAGS)') -}
  262. BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (),
  263. @{$config{bin_cxxflags}},
  264. '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -}
  265. BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
  266. @{$config{bin_lflags}},
  267. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  268. BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  269. # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
  270. CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
  271. $cppflags2 =~ s|([\\"])|\\$1|g;
  272. $lib_cppflags =~ s|([\\"])|\\$1|g;
  273. join(' ', $lib_cppflags || (), $cppflags2 || (),
  274. $cppflags1 || ()) -}
  275. PERLASM_SCHEME= {- $target{perlasm_scheme} -}
  276. # For x86 assembler: Set PROCESSOR to 386 if you want to support
  277. # the 80386.
  278. PROCESSOR= {- $config{processor} -}
  279. # We want error [and other] messages in English. Trouble is that make(1)
  280. # doesn't pass macros down as environment variables unless there already
  281. # was corresponding variable originally set. In other words we can only
  282. # reassign environment variables, but not set new ones, not in portable
  283. # manner that is. That's why we reassign several, just to be sure...
  284. LC_ALL=C
  285. LC_MESSAGES=C
  286. LANG=C
  287. # The main targets ###################################################
  288. {- dependmagic('all'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils
  289. {- dependmagic('build_libs'); -}: build_libs_nodep
  290. {- dependmagic('build_modules'); -}: build_modules_nodep
  291. {- dependmagic('build_programs'); -}: build_programs_nodep
  292. build_generated: $(GENERATED_MANDATORY)
  293. build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
  294. build_modules_nodep: $(MODULES)
  295. build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
  296. # Kept around for backward compatibility
  297. build_apps build_tests: build_programs
  298. # Convenience target to prebuild all generated files, not just the mandatory
  299. # ones
  300. build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
  301. @ : {- output_off() if $disabled{makedepend}; "" -}
  302. @echo "Warning: consider configuring with no-makedepend, because if"
  303. @echo " target system doesn't have $(PERL),"
  304. @echo " then make will fail..."
  305. @ : {- output_on() if $disabled{makedepend}; "" -}
  306. test: tests
  307. {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
  308. @ : {- output_off() if $disabled{tests}; "" -}
  309. ( cd test; \
  310. mkdir -p test-runs; \
  311. SRCTOP=../$(SRCDIR) \
  312. BLDTOP=../$(BLDDIR) \
  313. RESULT_D=test-runs \
  314. PERL="$(PERL)" \
  315. EXE_EXT={- platform->binext() -} \
  316. OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines 2>/dev/null && pwd` \
  317. OPENSSL_DEBUG_MEMORY=on \
  318. $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
  319. @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
  320. @echo "Tests are not supported with your chosen Configure options"
  321. @ : {- output_on() if !$disabled{tests}; "" -}
  322. list-tests:
  323. @ : {- output_off() if $disabled{tests}; "" -}
  324. @SRCTOP="$(SRCDIR)" \
  325. $(PERL) $(SRCDIR)/test/run_tests.pl list
  326. @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
  327. @echo "Tests are not supported with your chosen Configure options"
  328. @ : {- output_on() if !$disabled{tests}; "" -}
  329. install: install_sw install_ssldirs install_docs
  330. uninstall: uninstall_docs uninstall_sw
  331. libclean:
  332. @set -e; for s in $(SHLIB_INFO); do \
  333. if [ "$$s" = ";" ]; then continue; fi; \
  334. s1=`echo "$$s" | cut -f1 -d";"`; \
  335. s2=`echo "$$s" | cut -f2 -d";"`; \
  336. $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\
  337. $(RM) apps/$$s1; \
  338. $(RM) test/$$s1; \
  339. $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\
  340. $(RM) $$s1; \
  341. if [ "$$s1" != "$$s2" ]; then \
  342. $(ECHO) $(RM) $$s2; \
  343. $(RM) $$s2; \
  344. fi; \
  345. done
  346. $(RM) $(LIBS)
  347. $(RM) *{- platform->defext() -}
  348. clean: libclean
  349. $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(SCRIPTS)
  350. $(RM) $(GENERATED_MANDATORY) $(GENERATED)
  351. -$(RM) `find . -name .git -prune -o -name '*{- platform->depext() -}' -print`
  352. -$(RM) `find . -name .git -prune -o -name '*{- platform->objext() -}' -print`
  353. $(RM) core
  354. $(RM) tags TAGS doc-nits
  355. $(RM) -r test/test-runs
  356. $(RM) openssl.pc libcrypto.pc libssl.pc
  357. -$(RM) `find . -name .git -prune -o -type l -print`
  358. $(RM) $(TARFILE)
  359. distclean: clean
  360. $(RM) configdata.pm
  361. $(RM) Makefile
  362. # We check if any depfile is newer than Makefile and decide to
  363. # concatenate only if that is true.
  364. depend:
  365. @: {- output_off() if $disabled{makedepend}; "" -}
  366. @$(PERL) $(SRCDIR)/util/add-depends.pl {-
  367. defined $makedepprog && $makedepprog =~ /\/makedepend/
  368. ? 'makedepend' : 'gcc' -}
  369. @: {- output_on() if $disabled{makedepend}; "" -}
  370. # Install helper targets #############################################
  371. install_sw: install_dev install_engines install_runtime
  372. uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
  373. install_docs: install_man_docs install_html_docs
  374. uninstall_docs: uninstall_man_docs uninstall_html_docs
  375. $(RM) -r -v $(DESTDIR)$(DOCDIR)
  376. install_ssldirs:
  377. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
  378. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
  379. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
  380. @set -e; for x in dummy $(MISC_SCRIPTS); do \
  381. if [ "$$x" = "dummy" ]; then continue; fi; \
  382. x1=`echo "$$x" | cut -f1 -d:`; \
  383. x2=`echo "$$x" | cut -f2 -d:`; \
  384. fn=`basename $$x1`; \
  385. $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
  386. cp $$x1 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
  387. chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
  388. mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
  389. $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
  390. if [ "$$x1" != "$$x2" ]; then \
  391. ln=`basename "$$x2"`; \
  392. : {- output_off() unless windowsdll(); "" -}; \
  393. $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
  394. cp $(DESTDIR)$(OPENSSLDIR)/misc/$$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
  395. : {- output_on() unless windowsdll();
  396. output_off() if windowsdll(); "" -}; \
  397. $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
  398. ln -sf $$fn $(DESTDIR)$(OPENSSLDIR)/misc/$$ln; \
  399. : {- output_on() if windowsdll(); "" -}; \
  400. fi; \
  401. done
  402. @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
  403. @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
  404. @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
  405. @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
  406. @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
  407. $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
  408. cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
  409. chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
  410. fi
  411. @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist"
  412. @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
  413. @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new
  414. @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist
  415. @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \
  416. $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
  417. cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
  418. chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \
  419. fi
  420. install_dev: install_runtime_libs
  421. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  422. @$(ECHO) "*** Installing development files"
  423. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
  424. @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
  425. @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
  426. @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
  427. @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
  428. @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
  429. @set -e; for i in $(SRCDIR)/include/openssl/*.h \
  430. $(BLDDIR)/include/openssl/*.h; do \
  431. fn=`basename $$i`; \
  432. $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
  433. cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
  434. chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
  435. done
  436. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
  437. @set -e; for l in $(INSTALL_LIBS); do \
  438. fn=`basename $$l`; \
  439. $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
  440. cp $$l $(DESTDIR)$(libdir)/$$fn.new; \
  441. $(RANLIB) $(DESTDIR)$(libdir)/$$fn.new; \
  442. chmod 644 $(DESTDIR)$(libdir)/$$fn.new; \
  443. mv -f $(DESTDIR)$(libdir)/$$fn.new \
  444. $(DESTDIR)$(libdir)/$$fn; \
  445. done
  446. @ : {- output_off() if $disabled{shared}; "" -}
  447. @set -e; for s in $(INSTALL_SHLIB_INFO); do \
  448. s1=`echo "$$s" | cut -f1 -d";"`; \
  449. s2=`echo "$$s" | cut -f2 -d";"`; \
  450. fn1=`basename $$s1`; \
  451. fn2=`basename $$s2`; \
  452. : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \
  453. if [ "$$fn1" != "$$fn2" ]; then \
  454. $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \
  455. ln -sf $$fn1 $(DESTDIR)$(libdir)/$$fn2; \
  456. fi; \
  457. : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \
  458. $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \
  459. cp $$s2 $(DESTDIR)$(libdir)/$$fn2.new; \
  460. chmod 755 $(DESTDIR)$(libdir)/$$fn2.new; \
  461. mv -f $(DESTDIR)$(libdir)/$$fn2.new \
  462. $(DESTDIR)$(libdir)/$$fn2; \
  463. : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \
  464. a=$(DESTDIR)$(libdir)/$$fn2; \
  465. $(ECHO) "install $$s1 -> $$a"; \
  466. if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \
  467. mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \
  468. cp -f $$a $$a.new; \
  469. for so in `$(AR) t $$a`; do \
  470. $(AR) x $$a $$so; \
  471. chmod u+w $$so; \
  472. strip -X32_64 -e $$so; \
  473. $(AR) r $$a.new $$so; \
  474. done; \
  475. )); fi; \
  476. $(AR) r $$a.new $$s1; \
  477. mv -f $$a.new $$a; \
  478. : {- output_off() if sharedaix(); output_on(); "" -}; \
  479. done
  480. @ : {- output_on() if $disabled{shared}; "" -}
  481. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)/pkgconfig
  482. @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc"
  483. @cp libcrypto.pc $(DESTDIR)$(libdir)/pkgconfig
  484. @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
  485. @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc"
  486. @cp libssl.pc $(DESTDIR)$(libdir)/pkgconfig
  487. @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
  488. @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc"
  489. @cp openssl.pc $(DESTDIR)$(libdir)/pkgconfig
  490. @chmod 644 $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
  491. uninstall_dev: uninstall_runtime_libs
  492. @$(ECHO) "*** Uninstalling development files"
  493. @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
  494. @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
  495. @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
  496. @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
  497. @set -e; for i in $(SRCDIR)/include/openssl/*.h \
  498. $(BLDDIR)/include/openssl/*.h; do \
  499. fn=`basename $$i`; \
  500. $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
  501. $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
  502. done
  503. -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
  504. -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
  505. @set -e; for l in $(INSTALL_LIBS); do \
  506. fn=`basename $$l`; \
  507. $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \
  508. $(RM) $(DESTDIR)$(libdir)/$$fn; \
  509. done
  510. @ : {- output_off() if $disabled{shared}; "" -}
  511. @set -e; for s in $(INSTALL_SHLIB_INFO); do \
  512. s1=`echo "$$s" | cut -f1 -d";"`; \
  513. s2=`echo "$$s" | cut -f2 -d";"`; \
  514. fn1=`basename $$s1`; \
  515. fn2=`basename $$s2`; \
  516. : {- output_off() if windowsdll(); "" -}; \
  517. $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
  518. $(RM) $(DESTDIR)$(libdir)/$$fn2; \
  519. if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \
  520. $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \
  521. $(RM) $(DESTDIR)$(libdir)/$$fn1; \
  522. fi; \
  523. : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
  524. $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \
  525. $(RM) $(DESTDIR)$(libdir)/$$fn2; \
  526. : {- output_on() unless windowsdll(); "" -}; \
  527. done
  528. @ : {- output_on() if $disabled{shared}; "" -}
  529. $(RM) $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc
  530. $(RM) $(DESTDIR)$(libdir)/pkgconfig/libssl.pc
  531. $(RM) $(DESTDIR)$(libdir)/pkgconfig/openssl.pc
  532. -$(RMDIR) $(DESTDIR)$(libdir)/pkgconfig
  533. -$(RMDIR) $(DESTDIR)$(libdir)
  534. install_engines: install_runtime_libs build_modules
  535. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  536. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
  537. @$(ECHO) "*** Installing ENGINE modules"
  538. @set -e; for e in dummy $(INSTALL_ENGINES); do \
  539. if [ "$$e" = "dummy" ]; then continue; fi; \
  540. fn=`basename $$e`; \
  541. $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
  542. cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
  543. chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
  544. mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
  545. $(DESTDIR)$(ENGINESDIR)/$$fn; \
  546. done
  547. uninstall_engines:
  548. @$(ECHO) "*** Uninstalling ENGINE modules"
  549. @set -e; for e in dummy $(INSTALL_ENGINES); do \
  550. if [ "$$e" = "dummy" ]; then continue; fi; \
  551. fn=`basename $$e`; \
  552. if [ "$$fn" = '{- platform->dso("ossltest") -}' ]; then \
  553. continue; \
  554. fi; \
  555. $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
  556. $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
  557. done
  558. -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
  559. install_runtime: install_programs
  560. install_runtime_libs: build_libs
  561. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  562. @ : {- output_off() if windowsdll(); "" -}
  563. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(libdir)
  564. @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -}
  565. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
  566. @ : {- output_on() unless windowsdll(); "" -}
  567. @$(ECHO) "*** Installing runtime libraries"
  568. @set -e; for s in dummy $(INSTALL_SHLIBS); do \
  569. if [ "$$s" = "dummy" ]; then continue; fi; \
  570. fn=`basename $$s`; \
  571. : {- output_off() unless windowsdll(); "" -}; \
  572. $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  573. cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  574. chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  575. mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
  576. $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  577. : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
  578. $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \
  579. cp $$s $(DESTDIR)$(libdir)/$$fn.new; \
  580. chmod 755 $(DESTDIR)$(libdir)/$$fn.new; \
  581. mv -f $(DESTDIR)$(libdir)/$$fn.new \
  582. $(DESTDIR)$(libdir)/$$fn; \
  583. : {- output_on() if windowsdll(); "" -}; \
  584. done
  585. install_programs: install_runtime_libs build_programs
  586. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  587. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
  588. @$(ECHO) "*** Installing runtime programs"
  589. @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
  590. if [ "$$x" = "dummy" ]; then continue; fi; \
  591. fn=`basename $$x`; \
  592. $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  593. cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  594. chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  595. mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
  596. $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  597. done
  598. @set -e; for x in dummy $(BIN_SCRIPTS); do \
  599. if [ "$$x" = "dummy" ]; then continue; fi; \
  600. fn=`basename $$x`; \
  601. $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  602. cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  603. chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  604. mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
  605. $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  606. done
  607. uninstall_runtime: uninstall_programs uninstall_runtime_libs
  608. uninstall_programs:
  609. @$(ECHO) "*** Uninstalling runtime programs"
  610. @set -e; for x in dummy $(INSTALL_PROGRAMS); \
  611. do \
  612. if [ "$$x" = "dummy" ]; then continue; fi; \
  613. fn=`basename $$x`; \
  614. $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  615. $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  616. done;
  617. @set -e; for x in dummy $(BIN_SCRIPTS); \
  618. do \
  619. if [ "$$x" = "dummy" ]; then continue; fi; \
  620. fn=`basename $$x`; \
  621. $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  622. $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  623. done
  624. -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
  625. uninstall_runtime_libs:
  626. @$(ECHO) "*** Uninstalling runtime libraries"
  627. @ : {- output_off() unless windowsdll(); "" -}
  628. @set -e; for s in dummy $(INSTALL_SHLIBS); do \
  629. if [ "$$s" = "dummy" ]; then continue; fi; \
  630. fn=`basename $$s`; \
  631. $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  632. $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  633. done
  634. @ : {- output_on() unless windowsdll(); "" -}
  635. install_man_docs:
  636. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  637. @$(ECHO) "*** Installing manpages"
  638. $(PERL) $(SRCDIR)/util/process_docs.pl \
  639. --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
  640. uninstall_man_docs:
  641. @$(ECHO) "*** Uninstalling manpages"
  642. $(PERL) $(SRCDIR)/util/process_docs.pl \
  643. --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
  644. --remove
  645. install_html_docs:
  646. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  647. @$(ECHO) "*** Installing HTML manpages"
  648. $(PERL) $(SRCDIR)/util/process_docs.pl \
  649. --destdir=$(DESTDIR)$(HTMLDIR) --type=html
  650. uninstall_html_docs:
  651. @$(ECHO) "*** Uninstalling manpages"
  652. $(PERL) $(SRCDIR)/util/process_docs.pl \
  653. --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
  654. # Developer targets (note: these are only available on Unix) #########
  655. update: generate errors ordinals
  656. generate: generate_apps generate_crypto_bn generate_crypto_objects \
  657. generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids
  658. .PHONY: doc-nits
  659. doc-nits: build_generated
  660. (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits
  661. @if [ -s doc-nits ] ; then cat doc-nits ; exit 1; \
  662. else echo 'doc-nits: no errors.'; rm doc-nits ; fi
  663. # Test coverage is a good idea for the future
  664. #coverage: $(PROGRAMS) $(TESTPROGRAMS)
  665. # ...
  666. lint:
  667. lint -DLINT $(INCLUDES) $(SRCS)
  668. generate_apps:
  669. ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
  670. < apps/openssl.cnf > apps/openssl-vms.cnf )
  671. generate_crypto_bn:
  672. ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
  673. generate_crypto_objects:
  674. ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \
  675. crypto/objects/objects.txt \
  676. crypto/objects/obj_mac.num \
  677. > crypto/objects/obj_mac.new && \
  678. mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num )
  679. ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
  680. crypto/objects/objects.txt \
  681. crypto/objects/obj_mac.num \
  682. > include/openssl/obj_mac.h )
  683. ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
  684. include/openssl/obj_mac.h \
  685. > crypto/objects/obj_dat.h )
  686. ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
  687. crypto/objects/obj_mac.num \
  688. crypto/objects/obj_xref.txt \
  689. > crypto/objects/obj_xref.h )
  690. generate_crypto_conf:
  691. ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
  692. > crypto/conf/conf_def.h )
  693. generate_crypto_asn1:
  694. ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
  695. > crypto/asn1/charmap.h )
  696. generate_fuzz_oids:
  697. ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \
  698. crypto/objects/obj_dat.h \
  699. > fuzz/oids.txt )
  700. # Set to -force to force a rebuild
  701. ERROR_REBUILD=
  702. errors:
  703. ( b=`pwd`; set -e; cd $(SRCDIR); \
  704. $(PERL) util/ck_errf.pl -strict -internal; \
  705. $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal )
  706. ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \
  707. for E in *.ec ; do \
  708. $(PERL) ../util/ck_errf.pl -strict \
  709. -conf $$E `basename $$E .ec`.c; \
  710. $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \
  711. -conf $$E `basename $$E .ec`.c ; \
  712. done )
  713. {- use File::Basename;
  714. our @sslheaders =
  715. qw( include/openssl/ssl.h
  716. include/openssl/ssl2.h
  717. include/openssl/ssl3.h
  718. include/openssl/sslerr.h
  719. include/openssl/tls1.h
  720. include/openssl/dtls1.h
  721. include/openssl/srtp.h );
  722. our @cryptoheaders =
  723. qw( include/internal/dso.h
  724. include/internal/o_dir.h
  725. include/internal/o_str.h
  726. include/internal/err.h
  727. include/internal/sslconf.h );
  728. our @cryptoskipheaders = ( @sslheaders,
  729. qw( include/openssl/conf_api.h
  730. include/openssl/ebcdic.h
  731. include/openssl/opensslconf.h
  732. include/openssl/symhacks.h ) );
  733. foreach my $f ( glob(catfile($config{sourcedir},
  734. 'include','openssl','*.h')) ) {
  735. my $fn = "include/openssl/" . basename($f);
  736. push @cryptoheaders, $fn unless grep { $_ eq $fn } @cryptoskipheaders;
  737. }
  738. "";
  739. -}
  740. CRYPTOHEADERS={- join(" \\\n\t", sort @cryptoheaders) -}
  741. SSLHEADERS={- join(" \\\n\t", sort @sslheaders) -}
  742. ordinals:
  743. ( cd $(SRCDIR); \
  744. $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
  745. --ordinals util/libcrypto.num \
  746. --symhacks include/openssl/symhacks.h \
  747. $(CRYPTOHEADERS) )
  748. ( cd $(SRCDIR); \
  749. $(PERL) util/mknum.pl --version $(VERSION) --no-warnings \
  750. --ordinals util/libssl.num \
  751. --symhacks include/openssl/symhacks.h \
  752. $(SSLHEADERS))
  753. test_ordinals:
  754. ( cd test; \
  755. SRCTOP=../$(SRCDIR) \
  756. BLDTOP=../$(BLDDIR) \
  757. $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
  758. tags TAGS: FORCE
  759. rm -f TAGS tags
  760. -ctags -R .
  761. -etags `find . -name '*.[ch]' -o -name '*.pm'`
  762. # Release targets (note: only available on Unix) #####################
  763. tar:
  764. (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
  765. # Helper targets #####################################################
  766. link-utils: $(BLDDIR)/util/opensslwrap.sh
  767. $(BLDDIR)/util/opensslwrap.sh: configdata.pm
  768. @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
  769. mkdir -p "$(BLDDIR)/util"; \
  770. ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
  771. fi
  772. FORCE:
  773. # Building targets ###################################################
  774. libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // () } @{$unified_info{libraries}}) -}
  775. libcrypto.pc:
  776. @ ( echo 'prefix=$(INSTALLTOP)'; \
  777. echo 'exec_prefix=$${prefix}'; \
  778. if [ -n "$(LIBDIR)" ]; then \
  779. echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
  780. else \
  781. echo 'libdir=$(libdir)'; \
  782. fi; \
  783. echo 'includedir=$${prefix}/include'; \
  784. echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \
  785. echo ''; \
  786. echo 'Name: OpenSSL-libcrypto'; \
  787. echo 'Description: OpenSSL cryptography library'; \
  788. echo 'Version: '$(VERSION); \
  789. echo 'Libs: -L$${libdir} -lcrypto'; \
  790. echo 'Libs.private: $(LIB_EX_LIBS)'; \
  791. echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
  792. libssl.pc:
  793. @ ( echo 'prefix=$(INSTALLTOP)'; \
  794. echo 'exec_prefix=$${prefix}'; \
  795. if [ -n "$(LIBDIR)" ]; then \
  796. echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
  797. else \
  798. echo 'libdir=$(libdir)'; \
  799. fi; \
  800. echo 'includedir=$${prefix}/include'; \
  801. echo ''; \
  802. echo 'Name: OpenSSL-libssl'; \
  803. echo 'Description: Secure Sockets Layer and cryptography libraries'; \
  804. echo 'Version: '$(VERSION); \
  805. echo 'Requires.private: libcrypto'; \
  806. echo 'Libs: -L$${libdir} -lssl'; \
  807. echo 'Cflags: -I$${includedir}' ) > libssl.pc
  808. openssl.pc:
  809. @ ( echo 'prefix=$(INSTALLTOP)'; \
  810. echo 'exec_prefix=$${prefix}'; \
  811. if [ -n "$(LIBDIR)" ]; then \
  812. echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
  813. else \
  814. echo 'libdir=$(libdir)'; \
  815. fi; \
  816. echo 'includedir=$${prefix}/include'; \
  817. echo ''; \
  818. echo 'Name: OpenSSL'; \
  819. echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
  820. echo 'Version: '$(VERSION); \
  821. echo 'Requires: libssl libcrypto' ) > openssl.pc
  822. configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
  823. @echo "Detected changed: $?"
  824. $(PERL) configdata.pm -r
  825. @echo "**************************************************"
  826. @echo "*** ***"
  827. @echo "*** Please run the same make command again ***"
  828. @echo "*** ***"
  829. @echo "**************************************************"
  830. @false
  831. reconfigure reconf:
  832. $(PERL) configdata.pm -r
  833. {-
  834. use File::Basename;
  835. use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
  836. # Helper function to figure out dependencies on libraries
  837. # It takes a list of library names and outputs a list of dependencies
  838. sub compute_lib_depends {
  839. # Depending on shared libraries:
  840. # On Windows POSIX layers, we depend on {libname}.dll.a
  841. # On Unix platforms, we depend on {shlibname}.so
  842. return map { platform->sharedlib_simple($_) // platform->staticlib($_) } @_;
  843. }
  844. sub generatesrc {
  845. my %args = @_;
  846. my $generator = join(" ", @{$args{generator}});
  847. my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
  848. my $incs = join("", map { " -I".$_ } @{$args{incs}});
  849. my $defs = join("", map { " -D".$_ } @{$args{defs}});
  850. my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
  851. if (platform->isdef($args{src})) {
  852. my $target = platform->def($args{src});
  853. (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
  854. my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
  855. my $ord_name = $args{generator}->[1] || $args{product};
  856. return <<"EOF";
  857. $target: $args{generator}->[0] $deps \$(SRCDIR)/util/mkdef.pl
  858. \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS $mkdef_os > $target
  859. EOF
  860. } elsif (!platform->isasm($args{src})) {
  861. if ($args{generator}->[0] =~ m|^.*\.in$|) {
  862. my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
  863. "util", "dofile.pl")),
  864. rel2abs($config{builddir}));
  865. return <<"EOF";
  866. $args{src}: $args{generator}->[0] $deps
  867. \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
  868. "-o$target{build_file}" $generator > \$@
  869. EOF
  870. } else {
  871. return <<"EOF";
  872. $args{src}: $args{generator}->[0] $deps
  873. \$(PERL)$generator_incs $generator > \$@
  874. EOF
  875. }
  876. } else {
  877. if ($args{generator}->[0] =~ /\.pl$/) {
  878. $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
  879. } elsif ($args{generator}->[0] =~ /\.m4$/) {
  880. $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
  881. } elsif ($args{generator}->[0] =~ /\.S$/) {
  882. $generator = undef;
  883. } else {
  884. die "Generator type for $args{src} unknown: $generator\n";
  885. }
  886. my $cppflags = {
  887. shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  888. lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  889. dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
  890. bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
  891. } -> {$args{intent}};
  892. if (defined($generator)) {
  893. return <<"EOF";
  894. $args{src}: $args{generator}->[0] $deps
  895. $generator \$@
  896. EOF
  897. }
  898. return <<"EOF";
  899. $args{src}: $args{generator}->[0] $deps
  900. \$(CC) $incs $cppflags $defs -E $args{generator}->[0] | \\
  901. \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
  902. EOF
  903. }
  904. }
  905. # Should one wonder about the end of the Perl snippet, it's because this
  906. # second regexp eats up line endings as well, if the removed path is the
  907. # last in the line. We may therefore need to put back a line ending.
  908. sub src2obj {
  909. my %args = @_;
  910. my $obj = platform->obj($args{obj});
  911. my $dep = platform->dep($args{obj});
  912. my @srcs = @{$args{srcs}};
  913. my $srcs = join(" ", @srcs);
  914. my $deps = join(" ", @srcs, @{$args{deps}});
  915. my $incs = join("", map { " -I".$_ } @{$args{incs}});
  916. my $defs = join("", map { " -D".$_ } @{$args{defs}});
  917. my $cmd;
  918. my $cmdflags;
  919. my $cmdcompile;
  920. if (grep /\.rc$/, @srcs) {
  921. $cmd = '$(RC)';
  922. $cmdflags = '$(RCFLAGS)';
  923. $cmdcompile = '';
  924. } elsif (grep /\.(cc|cpp)$/, @srcs) {
  925. $cmd = '$(CXX)';
  926. $cmdcompile = ' -c';
  927. $cmdflags = {
  928. shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
  929. lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)',
  930. dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)',
  931. bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)'
  932. } -> {$args{intent}};
  933. } else {
  934. $cmd = '$(CC)';
  935. $cmdcompile = ' -c';
  936. $cmdflags = {
  937. shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  938. lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  939. dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
  940. bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
  941. } -> {$args{intent}};
  942. }
  943. my $recipe;
  944. # extension-specific rules
  945. if (grep /\.s$/, @srcs) {
  946. $recipe .= <<"EOF";
  947. $obj: $deps
  948. $cmd $cmdflags -c -o \$\@ $srcs
  949. EOF
  950. } elsif (grep /\.S$/, @srcs) {
  951. # Originally there was mutli-step rule with $(CC) -E file.S
  952. # followed by $(CC) -c file.s. It compensated for one of
  953. # legacy platform compiler's inability to handle .S files.
  954. # The platform is long discontinued by vendor so there is
  955. # hardly a point to drag it along...
  956. $recipe .= <<"EOF";
  957. $obj: $deps
  958. $cmd $incs $defs $cmdflags -c -o \$\@ $srcs
  959. EOF
  960. } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/
  961. && !grep /\.rc$/, @srcs) {
  962. $recipe .= <<"EOF";
  963. $obj: $deps
  964. $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -MT \$\@ -c -o \$\@ $srcs
  965. \@touch $dep.tmp
  966. \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\
  967. rm -f $dep.tmp; \\
  968. else \\
  969. mv $dep.tmp $dep; \\
  970. fi
  971. EOF
  972. } else {
  973. $recipe .= <<"EOF";
  974. $obj: $deps
  975. $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs
  976. EOF
  977. if (defined $makedepprog && $makedepprog =~ /\/makedepend/) {
  978. $recipe .= <<"EOF";
  979. \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\
  980. > $dep
  981. EOF
  982. }
  983. }
  984. return $recipe;
  985. }
  986. # We *know* this routine is only called when we've configure 'shared'.
  987. sub obj2shlib {
  988. my %args = @_;
  989. my @linkdirs = ();
  990. foreach (@{args{deps}}) {
  991. my $d = dirname($_);
  992. push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
  993. }
  994. my $linkflags = join("", map { "-L$_ " } @linkdirs);
  995. my $linklibs = join("", map { my $f = basename($_);
  996. (my $l = $f) =~ s/^lib//;
  997. " -l$l" } @{$args{deps}});
  998. my @objs = map { platform->obj($_) }
  999. grep { !platform->isdef($_) }
  1000. @{$args{objs}};
  1001. my @defs = map { platform->def($_) }
  1002. grep { platform->isdef($_) }
  1003. @{$args{objs}};
  1004. my @deps = compute_lib_depends(@{$args{deps}});
  1005. die "More than one exported symbol map" if scalar @defs > 1;
  1006. my $objs = join(" ", @objs);
  1007. my $deps = join(" ", @objs, @defs, @deps);
  1008. my $simple = platform->sharedlib_simple($args{lib});
  1009. my $full = platform->sharedlib($args{lib});
  1010. my $shared_soname = "";
  1011. $shared_soname .= ' '.$target{shared_sonameflag}.basename($full)
  1012. if defined $target{shared_sonameflag};
  1013. my $shared_imp = "";
  1014. $shared_imp .= ' '.$target{shared_impflag}.basename($simple)
  1015. if defined $target{shared_impflag};
  1016. my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
  1017. my $recipe = <<"EOF";
  1018. $simple: $full
  1019. EOF
  1020. if (sharedaix()) {
  1021. $recipe .= <<"EOF";
  1022. rm -f $simple && \\
  1023. \$(AR) r $simple $full
  1024. EOF
  1025. } elsif ($simple ne $full) {
  1026. $recipe .= <<"EOF";
  1027. rm -f $simple && \\
  1028. ln -s $full $simple
  1029. EOF
  1030. }
  1031. $recipe .= <<"EOF";
  1032. $full: $deps
  1033. \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\
  1034. -o $full$shared_def $objs \\
  1035. $linklibs \$(LIB_EX_LIBS)
  1036. EOF
  1037. if (windowsdll()) {
  1038. $recipe .= <<"EOF";
  1039. rm -f apps/$full
  1040. rm -f test/$full
  1041. rm -f fuzz/$full
  1042. cp -p $full apps/
  1043. cp -p $full test/
  1044. cp -p $full fuzz/
  1045. EOF
  1046. }
  1047. return $recipe;
  1048. }
  1049. sub obj2dso {
  1050. my %args = @_;
  1051. my $dso = platform->dso($args{lib});
  1052. my @linkdirs = ();
  1053. foreach (@{args{deps}}) {
  1054. my $d = dirname($_);
  1055. push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
  1056. }
  1057. my $linkflags = join("", map { "-L$_ " } @linkdirs);
  1058. my $linklibs = join("", map { my $f = basename($_);
  1059. (my $l = $f) =~ s/^lib//;
  1060. " -l$l" } @{$args{deps}});
  1061. my @objs = map { platform->obj($_) }
  1062. grep { !platform->isdef($_) }
  1063. @{$args{objs}};
  1064. my @defs = map { platform->def($_) }
  1065. grep { platform->isdef($_) }
  1066. @{$args{objs}};
  1067. my @deps = compute_lib_depends(@{$args{deps}});
  1068. my $objs = join(" ", @objs);
  1069. my $deps = join(" ", @objs, @defs, @deps);
  1070. my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs);
  1071. return <<"EOF";
  1072. $dso: $deps
  1073. \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\
  1074. -o $dso$shared_def $objs \\
  1075. $linklibs \$(DSO_EX_LIBS)
  1076. EOF
  1077. }
  1078. sub obj2lib {
  1079. my %args = @_;
  1080. my $lib = platform->staticlib($args{lib});
  1081. my @objs = map { platform->obj($_) } @{$args{objs}};
  1082. my $objs = join(" ", @objs);
  1083. return <<"EOF";
  1084. $lib: $objs
  1085. \$(AR) \$(ARFLAGS) \$\@ \$\?
  1086. \$(RANLIB) \$\@ || echo Never mind.
  1087. EOF
  1088. }
  1089. sub obj2bin {
  1090. my %args = @_;
  1091. my $bin = platform->bin($args{bin});
  1092. my $objs = join(" ", map { platform->obj($_) } @{$args{objs}});
  1093. my $deps = join(" ", compute_lib_depends(@{$args{deps}}));
  1094. my @linkdirs = ();
  1095. foreach (@{args{deps}}) {
  1096. next if $_ =~ /\.a$/;
  1097. my $d = dirname($_);
  1098. push @linkdirs, $d unless grep { $d eq $_ } @linkdirs;
  1099. }
  1100. my $linkflags = join("", map { "-L$_ " } @linkdirs);
  1101. my $linklibs = join("", map { if ($_ =~ m/\.a$/) {
  1102. " ".platform->staticlib($_);
  1103. } else {
  1104. my $f = basename($_);
  1105. (my $l = $f) =~ s/^lib//;
  1106. " -l$l"
  1107. }
  1108. } @{$args{deps}});
  1109. my $cmd = '$(CC)';
  1110. my $cmdflags = '$(BIN_CFLAGS)';
  1111. if (grep /_cc\.o$/, @{$args{objs}}) {
  1112. $cmd = '$(CXX)';
  1113. $cmdflags = '$(BIN_CXXFLAGS)';
  1114. }
  1115. return <<"EOF";
  1116. $bin: $objs $deps
  1117. rm -f $bin
  1118. \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\
  1119. -o $bin $objs \\
  1120. $linklibs \$(BIN_EX_LIBS)
  1121. EOF
  1122. }
  1123. sub in2script {
  1124. my %args = @_;
  1125. my $script = $args{script};
  1126. my $sources = join(" ", @{$args{sources}});
  1127. my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
  1128. "util", "dofile.pl")),
  1129. rel2abs($config{builddir}));
  1130. return <<"EOF";
  1131. $script: $sources
  1132. \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
  1133. "-o$target{build_file}" $sources > "$script"
  1134. chmod a+x $script
  1135. EOF
  1136. }
  1137. sub generatedir {
  1138. my %args = @_;
  1139. my $dir = $args{dir};
  1140. my @deps = map { platform->convertext($_) } @{$args{deps}};
  1141. my @actions = ();
  1142. my %extinfo = ( dso => platform->dsoext(),
  1143. lib => platform->libext(),
  1144. bin => platform->binext() );
  1145. # We already have a 'test' target, and the top directory is just plain
  1146. # silly
  1147. return if $dir eq "test" || $dir eq ".";
  1148. foreach my $type (("dso", "lib", "bin", "script")) {
  1149. next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
  1150. # For lib object files, we could update the library. However, it
  1151. # was decided that it's enough to build the directory local object
  1152. # files, so we don't need to add any actions, and the dependencies
  1153. # are already taken care of.
  1154. if ($type ne "lib") {
  1155. foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
  1156. if (dirname($prod) eq $dir) {
  1157. push @deps, $prod.$extinfo{$type};
  1158. } else {
  1159. push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
  1160. }
  1161. }
  1162. }
  1163. }
  1164. my $deps = join(" ", @deps);
  1165. my $actions = join("\n", "", @actions);
  1166. return <<"EOF";
  1167. $dir $dir/: $deps$actions
  1168. EOF
  1169. }
  1170. "" # Important! This becomes part of the template result.
  1171. -}