unix-Makefile.tmpl 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126
  1. ##
  2. ## Makefile for OpenSSL
  3. ##
  4. ## {- join("\n## ", @autowarntext) -}
  5. {-
  6. our $objext = $target{obj_extension} || ".o";
  7. our $depext = $target{dep_extension} || ".d";
  8. our $exeext = $target{exe_extension} || "";
  9. our $libext = $target{lib_extension} || ".a";
  10. our $shlibext = $target{shared_extension} || ".so";
  11. our $shlibvariant = $target{shlib_variant} || "";
  12. our $shlibextsimple = $target{shared_extension_simple} || ".so";
  13. our $shlibextimport = $target{shared_import_extension} || "";
  14. our $dsoext = $target{dso_extension} || ".so";
  15. # $mingw_installroot and $mingw_commonroot is relevant for mingw only.
  16. my $mingw_installenv =
  17. $target{build_scheme}->[2] eq "mingw"
  18. ? "ProgramFiles(x86)" : "ProgramW6432";
  19. my $mingw_commonenv =
  20. $target{build_scheme}->[2] eq "mingw"
  21. ? "CommonProgramFiles(x86)" : "CommonProgramW6432";
  22. our $mingw_installroot =
  23. defined($ENV{$mingw_installenv})
  24. ? $mingw_installenv : 'ProgramFiles';
  25. our $mingw_commonroot =
  26. defined($ENV{$mingw_commonenv})
  27. ? $mingw_commonenv : 'CommonProgramFiles';
  28. my $mingw_installdflt =
  29. defined($ENV{$mingw_installenv})
  30. ? "C:/Program Files (x86)" : "C:/Program Files";
  31. my $mingw_commondflt = "$mingw_installdflt/Common Files";
  32. # expand variables early
  33. $mingw_installroot = $ENV{$mingw_installroot} // $mingw_installdflt;
  34. $mingw_commonroot = $ENV{$mingw_commonroot} // $mingw_commondflt;
  35. sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
  36. our $sover = $config{target} =~ /^mingw/
  37. ? $config{shlib_major}."_".$config{shlib_minor}
  38. : $config{shlib_major}.".".$config{shlib_minor};
  39. # shlib and shlib_simple both take a static library name and figure
  40. # out what the shlib name should be.
  41. #
  42. # When OpenSSL is configured "no-shared", these functions will just
  43. # return empty lists, making them suitable to join().
  44. #
  45. # With Windows DLL producers, shlib($libname) will return the shared
  46. # library name (which usually is different from the static library
  47. # name) with the default shared extension appended to it, while
  48. # shlib_simple($libname) will return the static library name with
  49. # the shared extension followed by ".a" appended to it. The former
  50. # result is used as the runtime shared library while the latter is
  51. # used as the DLL import library.
  52. #
  53. # On all Unix systems, shlib($libname) will return the library name
  54. # with the default shared extension, while shlib_simple($libname)
  55. # will return the name from shlib($libname) with any SO version number
  56. # removed. On some systems, they may therefore return the exact same
  57. # string.
  58. sub shlib {
  59. return () if $disabled{shared};
  60. my $lib = shift;
  61. return $unified_info{sharednames}->{$lib}. $shlibvariant. $shlibext;
  62. }
  63. sub shlib_simple {
  64. return () if $disabled{shared};
  65. my $lib = shift;
  66. if (windowsdll()) {
  67. return $lib . $shlibextimport;
  68. }
  69. return $lib . $shlibextsimple;
  70. }
  71. # dso is a complement to shlib / shlib_simple that returns the
  72. # given libname with the simple shared extension (possible SO version
  73. # removed). This differs from shlib_simple() by being unconditional.
  74. sub dso {
  75. my $engine = shift;
  76. return $engine . $dsoext;
  77. }
  78. # This makes sure things get built in the order they need
  79. # to. You're welcome.
  80. sub dependmagic {
  81. my $target = shift;
  82. return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
  83. }
  84. '';
  85. -}
  86. PLATFORM={- $config{target} -}
  87. OPTIONS={- $config{options} -}
  88. CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
  89. SRCDIR={- $config{sourcedir} -}
  90. BLDDIR={- $config{builddir} -}
  91. VERSION={- $config{version} -}
  92. MAJOR={- $config{major} -}
  93. MINOR={- $config{minor} -}
  94. SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
  95. SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
  96. SHLIB_MAJOR={- $config{shlib_major} -}
  97. SHLIB_MINOR={- $config{shlib_minor} -}
  98. SHLIB_TARGET={- $target{shared_target} -}
  99. LIBS={- join(" ", map { $_.$libext } @{$unified_info{libraries}}) -}
  100. SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
  101. SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
  102. ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
  103. PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -}
  104. SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
  105. {- output_off() if $disabled{makedepend}; "" -}
  106. DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
  107. grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
  108. keys %{$unified_info{sources}}); -}
  109. {- output_on() if $disabled{makedepend}; "" -}
  110. GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
  111. GENERATED={- join(" ",
  112. ( grep { defined $unified_info{generate}->{$_} }
  113. map { @{$unified_info{sources}->{$_}} }
  114. grep { /\.o$/ } keys %{$unified_info{sources}} ),
  115. ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
  116. INSTALL_LIBS={- join(" ", map { $_.$libext } @{$unified_info{install}->{libraries}}) -}
  117. INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -}
  118. INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -}
  119. INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -}
  120. INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -}
  121. {- output_off() if $disabled{apps}; "" -}
  122. BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash
  123. MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget
  124. {- output_on() if $disabled{apps}; "" -}
  125. APPS_OPENSSL={- use File::Spec::Functions;
  126. catfile("apps","openssl") -}
  127. # DESTDIR is for package builders so that they can configure for, say,
  128. # /usr/ and yet have everything installed to /tmp/somedir/usr/.
  129. # Normally it is left empty.
  130. DESTDIR=
  131. {- output_off() if $config{target} =~ /^mingw/; "" -}
  132. # Do not edit these manually. Use Configure with --prefix or --openssldir
  133. # to change this! Short explanation in the top comment in Configure
  134. INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
  135. #
  136. our $prefix = $config{prefix} || "/usr/local";
  137. $prefix -}
  138. OPENSSLDIR={- #
  139. # The logic here is that if no --openssldir was given,
  140. # OPENSSLDIR will get the value from $prefix plus "/ssl".
  141. # If --openssldir was given and the value is an absolute
  142. # path, OPENSSLDIR will get its value without change.
  143. # If the value from --openssldir is a relative path,
  144. # OPENSSLDIR will get $prefix with the --openssldir
  145. # value appended as a subdirectory.
  146. #
  147. use File::Spec::Functions;
  148. our $openssldir =
  149. $config{openssldir} ?
  150. (file_name_is_absolute($config{openssldir}) ?
  151. $config{openssldir}
  152. : catdir($prefix, $config{openssldir}))
  153. : catdir($prefix, "ssl");
  154. $openssldir -}
  155. LIBDIR={- #
  156. # if $prefix/lib$target{multilib} is not an existing
  157. # directory, then assume that it's not searched by linker
  158. # automatically, in which case adding $target{multilib} suffix
  159. # causes more grief than we're ready to tolerate, so don't...
  160. our $multilib =
  161. -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
  162. our $libdir = $config{libdir} || "lib$multilib";
  163. $libdir -}
  164. ENGINESDIR={- use File::Spec::Functions;
  165. catdir($prefix,$libdir,"engines-$sover") -}
  166. # Convenience variable for those who want to set the rpath in shared
  167. # libraries and applications
  168. LIBRPATH=$(INSTALLTOP)/$(LIBDIR)
  169. {- output_on() if $config{target} =~ /^mingw/;
  170. output_off() if $config{target} !~ /^mingw/;
  171. "" -}
  172. # Do not edit these manually. Use Configure with --prefix or --openssldir
  173. # to change this! Short explanation in the top comment in Configure
  174. INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet
  175. #
  176. use File::Spec::Win32;
  177. my $prefix_default = "$mingw_installroot/OpenSSL";
  178. our $prefix =
  179. File::Spec::Win32->canonpath($config{prefix}
  180. || $prefix_default);
  181. our ($prefix_dev, $prefix_dir, $prefix_file) =
  182. File::Spec::Win32->splitpath($prefix, 1);
  183. $prefix =~ s|\\|/|g;
  184. $prefix_dir =~ s|\\|/|g;
  185. $prefix_dev -}
  186. INSTALLTOP_dir={- my $x = File::Spec::Win32->canonpath($prefix_dir);
  187. $x =~ s|\\|/|g;
  188. $x -}
  189. OPENSSLDIR_dev={- #
  190. # The logic here is that if no --openssldir was given,
  191. # OPENSSLDIR will get the value "$mingw_commonroot/SSL".
  192. # If --openssldir was given and the value is an absolute
  193. # path, OPENSSLDIR will get its value without change.
  194. # If the value from --openssldir is a relative path,
  195. # OPENSSLDIR will get $prefix with the --openssldir
  196. # value appended as a subdirectory.
  197. #
  198. use File::Spec::Win32;
  199. our $openssldir =
  200. $config{openssldir} ?
  201. (File::Spec::Win32->file_name_is_absolute($config{openssldir}) ?
  202. File::Spec::Win32->canonpath($config{openssldir})
  203. : File::Spec::Win32->catdir($prefix, $config{openssldir}))
  204. : File::Spec::Win32->canonpath("$mingw_commonroot/SSL");
  205. our ($openssldir_dev, $openssldir_dir, $openssldir_file) =
  206. File::Spec::Win32->splitpath($openssldir, 1);
  207. $openssldir =~ s|\\|/|g;
  208. $openssldir_dir =~ s|\\|/|g;
  209. $openssldir_dev -}
  210. OPENSSLDIR_dir={- my $x = File::Spec::Win32->canonpath($openssldir_dir);
  211. $x =~ s|\\|/|g;
  212. $x -}
  213. LIBDIR={- our $libdir = $config{libdir} || "lib";
  214. $libdir -}
  215. ENGINESDIR_dev={- use File::Spec::Win32;
  216. our $enginesdir =
  217. File::Spec::Win32->catdir($prefix,$libdir,
  218. "engines-$sover_dirname");
  219. our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) =
  220. File::Spec::Win32->splitpath($enginesdir, 1);
  221. $enginesdir =~ s|\\|/|g;
  222. $enginesdir_dir =~ s|\\|/|g;
  223. $enginesdir_dev -}
  224. ENGINESDIR_dir={- my $x = File::Spec::Win32->canonpath($enginesdir_dir);
  225. $x =~ s|\\|/|g;
  226. $x -}
  227. # In a Windows environment, $(DESTDIR) is harder to contatenate with other
  228. # directory variables, because both may contain devices. What we do here is
  229. # to adapt INSTALLTOP, OPENSSLDIR and ENGINESDIR depending on if $(DESTDIR)
  230. # has a value or not, to ensure that concatenation will always work further
  231. # down.
  232. ifneq "$(DESTDIR)" ""
  233. INSTALLTOP=$(INSTALLTOP_dir)
  234. OPENSSLDIR=$(OPENSSLDIR_dir)
  235. ENGINESDIR=$(ENGINESDIR_dir)
  236. else
  237. INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir)
  238. OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir)
  239. ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
  240. endif
  241. {- output_on() if $config{target} !~ /^mingw/; "" -}
  242. MANDIR=$(INSTALLTOP)/share/man
  243. DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
  244. HTMLDIR=$(DOCDIR)/html
  245. # MANSUFFIX is for the benefit of anyone who may want to have a suffix
  246. # appended after the manpage file section number. "ssl" is popular,
  247. # resulting in files such as config.5ssl rather than config.5.
  248. MANSUFFIX=
  249. HTMLSUFFIX=html
  250. CROSS_COMPILE= {- $config{cross_compile_prefix} -}
  251. CC= $(CROSS_COMPILE){- $target{cc} -}
  252. CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
  253. CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
  254. LDFLAGS= {- $target{lflags} -}
  255. PLIB_LDFLAGS= {- $target{plib_lflags} -}
  256. EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
  257. LIB_CFLAGS={- $target{shared_cflag} || "" -}
  258. LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -}
  259. DSO_CFLAGS={- $target{shared_cflag} || "" -}
  260. DSO_LDFLAGS=$(LIB_LDFLAGS)
  261. BIN_CFLAGS={- $target{bin_cflags} -}
  262. PERL={- $config{perl} -}
  263. ARFLAGS= {- $target{arflags} -}
  264. AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
  265. RANLIB= {- $target{ranlib} -}
  266. NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
  267. RCFLAGS={- $target{shared_rcflag} -}
  268. RC= $(CROSS_COMPILE){- $target{rc} || "windres" -}
  269. RM= rm -f
  270. RMDIR= rmdir
  271. TAR= {- $target{tar} || "tar" -}
  272. TARFLAGS= {- $target{tarflags} -}
  273. MAKEDEPEND={- $config{makedepprog} -}
  274. BASENAME= openssl
  275. NAME= $(BASENAME)-$(VERSION)
  276. # Relative to $(SRCDIR)
  277. TARFILE= ../$(NAME).tar
  278. # We let the C compiler driver to take care of .s files. This is done in
  279. # order to be excused from maintaining a separate set of architecture
  280. # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
  281. # gcc, then the driver will automatically translate it to -xarch=v8plus
  282. # and pass it down to assembler. In any case, we do not define AS or
  283. # ASFLAGS for this reason.
  284. PERLASM_SCHEME= {- $target{perlasm_scheme} -}
  285. # For x86 assembler: Set PROCESSOR to 386 if you want to support
  286. # the 80386.
  287. PROCESSOR= {- $config{processor} -}
  288. # We want error [and other] messages in English. Trouble is that make(1)
  289. # doesn't pass macros down as environment variables unless there already
  290. # was corresponding variable originally set. In other words we can only
  291. # reassign environment variables, but not set new ones, not in portable
  292. # manner that is. That's why we reassign several, just to be sure...
  293. LC_ALL=C
  294. LC_MESSAGES=C
  295. LANG=C
  296. # The main targets ###################################################
  297. {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils
  298. {- dependmagic('build_libs'); -}: build_libs_nodep
  299. {- dependmagic('build_engines'); -}: build_engines_nodep
  300. {- dependmagic('build_programs'); -}: build_programs_nodep
  301. build_generated: $(GENERATED_MANDATORY)
  302. build_libs_nodep: libcrypto.pc libssl.pc openssl.pc
  303. build_engines_nodep: $(ENGINES)
  304. build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
  305. # Kept around for backward compatibility
  306. build_apps build_tests: build_programs
  307. # Convenience target to prebuild all generated files, not just the mandatory
  308. # ones
  309. build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
  310. test: tests
  311. {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils
  312. @ : {- output_off() if $disabled{tests}; "" -}
  313. ( cd test; \
  314. mkdir -p test-runs; \
  315. SRCTOP=../$(SRCDIR) \
  316. BLDTOP=../$(BLDDIR) \
  317. RESULT_D=test-runs \
  318. PERL="$(PERL)" \
  319. EXE_EXT={- $exeext -} \
  320. OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines; pwd` \
  321. OPENSSL_DEBUG_MEMORY=on \
  322. $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) )
  323. @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
  324. @echo "Tests are not supported with your chosen Configure options"
  325. @ : {- output_on() if !$disabled{tests}; "" -}
  326. list-tests:
  327. @ : {- output_off() if $disabled{tests}; "" -}
  328. @SRCTOP="$(SRCDIR)" \
  329. $(PERL) $(SRCDIR)/test/run_tests.pl list
  330. @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
  331. @echo "Tests are not supported with your chosen Configure options"
  332. @ : {- output_on() if !$disabled{tests}; "" -}
  333. install: install_sw install_ssldirs install_docs
  334. uninstall: uninstall_docs uninstall_sw
  335. libclean:
  336. @set -e; for s in $(SHLIB_INFO); do \
  337. s1=`echo "$$s" | cut -f1 -d";"`; \
  338. s2=`echo "$$s" | cut -f2 -d";"`; \
  339. echo $(RM) $$s1; \
  340. $(RM) $$s1; \
  341. if [ "$$s1" != "$$s2" ]; then \
  342. echo $(RM) $$s2; \
  343. $(RM) $$s2; \
  344. fi; \
  345. done
  346. $(RM) $(LIBS)
  347. $(RM) *.map
  348. clean: libclean
  349. $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS)
  350. $(RM) $(GENERATED)
  351. -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"`
  352. -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"`
  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 . -type l -a \! -path "./.git/*"`
  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. @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \
  367. ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \
  368. echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \
  369. echo; \
  370. for f in $(DEPS); do \
  371. if [ -f $$f ]; then cat $$f; fi; \
  372. done ) > Makefile.new; \
  373. if cmp Makefile.new Makefile >/dev/null 2>&1; then \
  374. rm -f Makefile.new; \
  375. else \
  376. mv -f Makefile.new Makefile; \
  377. fi; \
  378. fi
  379. @: {- output_on() if $disabled{makedepend}; "" -}
  380. # Install helper targets #############################################
  381. install_sw: install_dev install_engines install_runtime
  382. uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
  383. install_docs: install_man_docs install_html_docs
  384. uninstall_docs: uninstall_man_docs uninstall_html_docs
  385. $(RM) -r -v $(DESTDIR)$(DOCDIR)
  386. install_ssldirs:
  387. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs
  388. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private
  389. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc
  390. @set -e; for x in dummy $(MISC_SCRIPTS); do \
  391. if [ "$$x" = "dummy" ]; then continue; fi; \
  392. fn=`basename $$x`; \
  393. echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \
  394. cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
  395. chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \
  396. mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \
  397. $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \
  398. done
  399. @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist"
  400. @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
  401. @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new
  402. @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist
  403. @if ! [ -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \
  404. echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \
  405. cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
  406. chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \
  407. fi
  408. install_dev: install_runtime_libs
  409. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  410. @echo "*** Installing development files"
  411. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl
  412. @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
  413. @echo "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
  414. @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
  415. @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
  416. @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
  417. @set -e; for i in $(SRCDIR)/include/openssl/*.h \
  418. $(BLDDIR)/include/openssl/*.h; do \
  419. fn=`basename $$i`; \
  420. echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
  421. cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
  422. chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
  423. done
  424. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
  425. @set -e; for l in $(INSTALL_LIBS); do \
  426. fn=`basename $$l`; \
  427. echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
  428. cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
  429. $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
  430. chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
  431. mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
  432. $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
  433. done
  434. @ : {- output_off() if $disabled{shared}; "" -}
  435. @set -e; for s in $(INSTALL_SHLIB_INFO); do \
  436. s1=`echo "$$s" | cut -f1 -d";"`; \
  437. s2=`echo "$$s" | cut -f2 -d";"`; \
  438. fn1=`basename $$s1`; \
  439. fn2=`basename $$s2`; \
  440. : {- output_off() if windowsdll(); "" -}; \
  441. echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
  442. cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
  443. chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
  444. mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
  445. $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
  446. if [ "$$fn1" != "$$fn2" ]; then \
  447. echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
  448. ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
  449. fi; \
  450. : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
  451. echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
  452. cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
  453. chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
  454. mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
  455. $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
  456. : {- output_on() unless windowsdll(); "" -}; \
  457. done
  458. @ : {- output_on() if $disabled{shared}; "" -}
  459. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
  460. @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
  461. @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
  462. @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
  463. @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
  464. @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
  465. @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
  466. @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
  467. @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
  468. @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
  469. uninstall_dev:
  470. @echo "*** Uninstalling development files"
  471. @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
  472. @echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c"
  473. @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c
  474. @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
  475. @set -e; for i in $(SRCDIR)/include/openssl/*.h \
  476. $(BLDDIR)/include/openssl/*.h; do \
  477. fn=`basename $$i`; \
  478. echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
  479. $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
  480. done
  481. -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
  482. -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
  483. @set -e; for l in $(INSTALL_LIBS); do \
  484. fn=`basename $$l`; \
  485. echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
  486. $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
  487. done
  488. @ : {- output_off() if $disabled{shared}; "" -}
  489. @set -e; for s in $(INSTALL_SHLIB_INFO); do \
  490. s1=`echo "$$s" | cut -f1 -d";"`; \
  491. s2=`echo "$$s" | cut -f2 -d";"`; \
  492. fn1=`basename $$s1`; \
  493. fn2=`basename $$s2`; \
  494. : {- output_off() if windowsdll(); "" -}; \
  495. echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
  496. $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
  497. if [ "$$fn1" != "$$fn2" ]; then \
  498. echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
  499. $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
  500. fi; \
  501. : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
  502. echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
  503. $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
  504. : {- output_on() unless windowsdll(); "" -}; \
  505. done
  506. @ : {- output_on() if $disabled{shared}; "" -}
  507. $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
  508. $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
  509. $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
  510. -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
  511. -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
  512. install_engines: install_runtime_libs build_engines
  513. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  514. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
  515. @echo "*** Installing engines"
  516. @set -e; for e in dummy $(INSTALL_ENGINES); do \
  517. if [ "$$e" = "dummy" ]; then continue; fi; \
  518. fn=`basename $$e`; \
  519. echo "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \
  520. cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
  521. chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \
  522. mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \
  523. $(DESTDIR)$(ENGINESDIR)/$$fn; \
  524. done
  525. uninstall_engines:
  526. @echo "*** Uninstalling engines"
  527. @set -e; for e in dummy $(INSTALL_ENGINES); do \
  528. if [ "$$e" = "dummy" ]; then continue; fi; \
  529. fn=`basename $$e`; \
  530. if [ "$$fn" = '{- dso("ossltest") -}' ]; then \
  531. continue; \
  532. fi; \
  533. echo "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \
  534. $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \
  535. done
  536. -$(RMDIR) $(DESTDIR)$(ENGINESDIR)
  537. install_runtime: install_programs
  538. install_runtime_libs: build_libs
  539. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  540. @ : {- output_off() if windowsdll(); "" -}
  541. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
  542. @ : {- output_on() if windowsdll(); "" -}
  543. @echo "*** Installing runtime files"
  544. @set -e; for s in dummy $(INSTALL_SHLIBS); do \
  545. if [ "$$s" = "dummy" ]; then continue; fi; \
  546. fn=`basename $$s`; \
  547. : {- output_off() unless windowsdll(); "" -}; \
  548. echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  549. cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  550. chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  551. mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
  552. $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  553. : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \
  554. echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
  555. cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
  556. chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
  557. mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
  558. $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
  559. : {- output_on() if windowsdll(); "" -}; \
  560. done
  561. install_programs: install_runtime_libs build_programs
  562. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  563. @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin
  564. @echo "*** Installing runtime programs"
  565. @set -e; for x in dummy $(INSTALL_PROGRAMS); do \
  566. if [ "$$x" = "dummy" ]; then continue; fi; \
  567. fn=`basename $$x`; \
  568. echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  569. cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  570. chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  571. mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
  572. $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  573. done
  574. @set -e; for x in dummy $(BIN_SCRIPTS); do \
  575. if [ "$$x" = "dummy" ]; then continue; fi; \
  576. fn=`basename $$x`; \
  577. echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  578. cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  579. chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
  580. mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \
  581. $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  582. done
  583. uninstall_runtime: uninstall_programs uninstall_runtime_libs
  584. uninstall_programs:
  585. @echo "*** Uninstalling runtime programs"
  586. @set -e; for x in dummy $(INSTALL_PROGRAMS); \
  587. do \
  588. if [ "$$x" = "dummy" ]; then continue; fi; \
  589. fn=`basename $$x`; \
  590. echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  591. $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  592. done;
  593. @set -e; for x in dummy $(BIN_SCRIPTS); \
  594. do \
  595. if [ "$$x" = "dummy" ]; then continue; fi; \
  596. fn=`basename $$x`; \
  597. echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  598. $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  599. done
  600. -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
  601. uninstall_runtime_libs:
  602. @echo "*** Uninstalling runtime libraries"
  603. @ : {- output_off() unless windowsdll(); "" -}
  604. @set -e; for s in dummy $(INSTALL_SHLIBS); do \
  605. if [ "$$s" = "dummy" ]; then continue; fi; \
  606. fn=`basename $$s`; \
  607. echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
  608. $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
  609. done
  610. @ : {- output_on() unless windowsdll(); "" -}
  611. install_man_docs:
  612. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  613. @echo "*** Installing manpages"
  614. $(PERL) $(SRCDIR)/util/process_docs.pl \
  615. --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX)
  616. uninstall_man_docs:
  617. @echo "*** Uninstalling manpages"
  618. $(PERL) $(SRCDIR)/util/process_docs.pl \
  619. --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \
  620. --remove
  621. install_html_docs:
  622. @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
  623. @echo "*** Installing HTML manpages"
  624. $(PERL) $(SRCDIR)/util/process_docs.pl \
  625. --destdir=$(DESTDIR)$(HTMLDIR) --type=html
  626. uninstall_html_docs:
  627. @echo "*** Uninstalling manpages"
  628. $(PERL) $(SRCDIR)/util/process_docs.pl \
  629. --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove
  630. # Developer targets (note: these are only available on Unix) #########
  631. update: generate errors ordinals
  632. generate: generate_apps generate_crypto_bn generate_crypto_objects \
  633. generate_crypto_conf generate_crypto_asn1
  634. doc-nits:
  635. (cd $(SRCDIR); $(PERL) util/find-doc-nits -n ) >doc-nits
  636. if [ -s doc-nits ] ; then cat doc-nits; rm doc-nits ; exit 1; fi
  637. # Test coverage is a good idea for the future
  638. #coverage: $(PROGRAMS) $(TESTPROGRAMS)
  639. # ...
  640. lint:
  641. lint -DLINT $(INCLUDES) $(SRCS)
  642. generate_apps:
  643. ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \
  644. < apps/openssl.cnf > apps/openssl-vms.cnf )
  645. generate_crypto_bn:
  646. ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h )
  647. generate_crypto_objects:
  648. ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \
  649. crypto/objects/objects.txt \
  650. crypto/objects/obj_mac.num \
  651. include/openssl/obj_mac.h )
  652. ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \
  653. include/openssl/obj_mac.h \
  654. crypto/objects/obj_dat.h )
  655. ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \
  656. crypto/objects/obj_mac.num \
  657. crypto/objects/obj_xref.txt \
  658. > crypto/objects/obj_xref.h )
  659. generate_crypto_conf:
  660. ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \
  661. > crypto/conf/conf_def.h )
  662. generate_crypto_asn1:
  663. ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \
  664. > crypto/asn1/charmap.h )
  665. errors:
  666. ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c )
  667. ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write )
  668. ( cd $(SRCDIR)/engines; \
  669. for e in *.ec; do \
  670. $(PERL) ../util/mkerr.pl -conf $$e \
  671. -nostatic -staticloader -write *.c; \
  672. done )
  673. ordinals:
  674. ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update )
  675. ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update )
  676. test_ordinals:
  677. ( cd test; \
  678. SRCTOP=../$(SRCDIR) \
  679. BLDTOP=../$(BLDDIR) \
  680. $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals )
  681. tags TAGS: FORCE
  682. rm -f TAGS tags
  683. -ctags -R .
  684. -etags `find . -name '*.[ch]' -o -name '*.pm'`
  685. # Release targets (note: only available on Unix) #####################
  686. tar:
  687. (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)')
  688. # Helper targets #####################################################
  689. link-utils: $(BLDDIR)/util/opensslwrap.sh
  690. $(BLDDIR)/util/opensslwrap.sh: configdata.pm
  691. @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \
  692. mkdir -p "$(BLDDIR)/util"; \
  693. ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \
  694. fi
  695. FORCE:
  696. # Building targets ###################################################
  697. libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -}
  698. libcrypto.pc:
  699. @ ( echo 'prefix=$(INSTALLTOP)'; \
  700. echo 'exec_prefix=$${prefix}'; \
  701. echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
  702. echo 'includedir=$${prefix}/include'; \
  703. echo 'enginesdir=$${libdir}/engines-{- $sover -}'; \
  704. echo ''; \
  705. echo 'Name: OpenSSL-libcrypto'; \
  706. echo 'Description: OpenSSL cryptography library'; \
  707. echo 'Version: '$(VERSION); \
  708. echo 'Libs: -L$${libdir} -lcrypto'; \
  709. echo 'Libs.private: $(EX_LIBS)'; \
  710. echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
  711. libssl.pc:
  712. @ ( echo 'prefix=$(INSTALLTOP)'; \
  713. echo 'exec_prefix=$${prefix}'; \
  714. echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
  715. echo 'includedir=$${prefix}/include'; \
  716. echo ''; \
  717. echo 'Name: OpenSSL-libssl'; \
  718. echo 'Description: Secure Sockets Layer and cryptography libraries'; \
  719. echo 'Version: '$(VERSION); \
  720. echo 'Requires.private: libcrypto'; \
  721. echo 'Libs: -L$${libdir} -lssl'; \
  722. echo 'Cflags: -I$${includedir}' ) > libssl.pc
  723. openssl.pc:
  724. @ ( echo 'prefix=$(INSTALLTOP)'; \
  725. echo 'exec_prefix=$${prefix}'; \
  726. echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
  727. echo 'includedir=$${prefix}/include'; \
  728. echo ''; \
  729. echo 'Name: OpenSSL'; \
  730. echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
  731. echo 'Version: '$(VERSION); \
  732. echo 'Requires: libssl libcrypto' ) > openssl.pc
  733. configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
  734. @echo "Detected changed: $?"
  735. @echo "Reconfiguring..."
  736. $(PERL) $(SRCDIR)/Configure reconf
  737. @echo "**************************************************"
  738. @echo "*** ***"
  739. @echo "*** Please run the same make command again ***"
  740. @echo "*** ***"
  741. @echo "**************************************************"
  742. @false
  743. {-
  744. use File::Basename;
  745. use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
  746. # Helper function to figure out dependencies on libraries
  747. # It takes a list of library names and outputs a list of dependencies
  748. sub compute_lib_depends {
  749. if ($disabled{shared}) {
  750. return map { $_.$libext } @_;
  751. }
  752. # Depending on shared libraries:
  753. # On Windows POSIX layers, we depend on {libname}.dll.a
  754. # On Unix platforms, we depend on {shlibname}.so
  755. return map { shlib_simple($_) } @_;
  756. }
  757. sub generatesrc {
  758. my %args = @_;
  759. my $generator = join(" ", @{$args{generator}});
  760. my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}});
  761. my $incs = join("", map { " -I".$_ } @{$args{incs}});
  762. my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}});
  763. if ($args{src} !~ /\.[sS]$/) {
  764. if ($args{generator}->[0] =~ m|^.*\.in$|) {
  765. my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
  766. "util", "dofile.pl")),
  767. rel2abs($config{builddir}));
  768. return <<"EOF";
  769. $args{src}: $args{generator}->[0] $deps
  770. \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
  771. "-o$target{build_file}" $generator > \$@
  772. EOF
  773. } else {
  774. return <<"EOF";
  775. $args{src}: $args{generator}->[0] $deps
  776. \$(PERL)$generator_incs $generator > \$@
  777. EOF
  778. }
  779. } else {
  780. if ($args{generator}->[0] =~ /\.pl$/) {
  781. $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator;
  782. } elsif ($args{generator}->[0] =~ /\.m4$/) {
  783. $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >'
  784. } elsif ($args{generator}->[0] =~ /\.S$/) {
  785. $generator = undef;
  786. } else {
  787. die "Generator type for $args{src} unknown: $generator\n";
  788. }
  789. if (defined($generator)) {
  790. return <<"EOF";
  791. $args{src}: $args{generator}->[0] $deps
  792. $generator \$@
  793. EOF
  794. }
  795. return <<"EOF";
  796. $args{src}: $args{generator}->[0] $deps
  797. \$(CC) $incs \$(CFLAGS) -E $args{generator}->[0] | \\
  798. \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@
  799. EOF
  800. }
  801. }
  802. # Should one wonder about the end of the Perl snippet, it's because this
  803. # second regexp eats up line endings as well, if the removed path is the
  804. # last in the line. We may therefore need to put back a line ending.
  805. sub src2obj {
  806. my %args = @_;
  807. my $obj = $args{obj};
  808. my @srcs = @{$args{srcs}};
  809. my $srcs = join(" ", @srcs);
  810. my $deps = join(" ", @srcs, @{$args{deps}});
  811. my $incs = join("", map { " -I".$_ } @{$args{incs}});
  812. unless ($disabled{zlib}) {
  813. if ($withargs{zlib_include}) {
  814. $incs .= " -I".$withargs{zlib_include};
  815. }
  816. }
  817. my $ecflags = { lib => '$(LIB_CFLAGS)',
  818. dso => '$(DSO_CFLAGS)',
  819. bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
  820. my $makedepprog = $config{makedepprog};
  821. my $recipe;
  822. # extension-specific rules
  823. if (grep /\.s$/, @srcs) {
  824. $recipe .= <<"EOF";
  825. $obj$objext: $deps
  826. \$(CC) \$(CFLAGS) $ecflags -c -o \$\@ $srcs
  827. EOF
  828. } elsif (grep /\.S$/, @srcs) {
  829. # In case one wonders why not just $(CC) -c file.S. While it
  830. # does work with contemporary compilers, there are some legacy
  831. # ones that get it wrong. Hence the elaborate scheme... We
  832. # don't care to maintain dependecy lists, because dependency
  833. # is rather weak, at most one header file that lists constants
  834. # which are assigned in ascending order.
  835. $recipe .= <<"EOF";
  836. $obj$objext: $deps
  837. ( trap "rm -f \$@.*" INT 0; \\
  838. \$(CC) $incs \$(CFLAGS) $ecflags -E $srcs | \\
  839. \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.s && \\
  840. \$(CC) \$(CFLAGS) $ecflags -c -o \$\@ \$@.s )
  841. EOF
  842. } elsif (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) {
  843. $recipe .= <<"EOF";
  844. $obj$objext: $deps
  845. \$(CC) $incs \$(CFLAGS) $ecflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs
  846. \@touch $obj$depext.tmp
  847. \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
  848. rm -f $obj$depext.tmp; \\
  849. else \\
  850. mv $obj$depext.tmp $obj$depext; \\
  851. fi
  852. EOF
  853. } else {
  854. $recipe .= <<"EOF";
  855. $obj$objext: $deps
  856. \$(CC) $incs \$(CFLAGS) $ecflags -c -o \$\@ $srcs
  857. EOF
  858. if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) {
  859. $recipe .= <<"EOF";
  860. -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs \$(CFLAGS) $ecflags -- $srcs \\
  861. >$obj$depext.tmp 2>/dev/null
  862. -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp
  863. \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\
  864. rm -f $obj$depext.tmp; \\
  865. else \\
  866. mv $obj$depext.tmp $obj$depext; \\
  867. fi
  868. EOF
  869. }
  870. }
  871. return $recipe;
  872. }
  873. # On Unix, we build shlibs from static libs, so we're ignoring the
  874. # object file array. We *know* this routine is only called when we've
  875. # configure 'shared'.
  876. sub libobj2shlib {
  877. my %args = @_;
  878. my $lib = $args{lib};
  879. my $shlib = $args{shlib};
  880. my $libd = dirname($lib);
  881. my $libn = basename($lib);
  882. (my $libname = $libn) =~ s/^lib//;
  883. my $linklibs = join("", map { my $d = dirname($_);
  884. my $f = basename($_);
  885. (my $l = $f) =~ s/^lib//;
  886. " -L$d -l$l" } @{$args{deps}});
  887. my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
  888. my $shlib_target = $target{shared_target};
  889. my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
  890. my $target = shlib_simple($lib);
  891. my $target_full = shlib($lib);
  892. return <<"EOF"
  893. # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
  894. # that two files get produced, {shlibname}.dll and {libname}.dll.a.
  895. # With all other Unix platforms, we often build a shared library with the
  896. # SO version built into the file name and a symlink without the SO version
  897. # It's not necessary to have both as targets. The choice falls on the
  898. # simplest, {libname}$shlibextimport for Windows POSIX layers and
  899. # {libname}$shlibextsimple for the Unix platforms.
  900. $target: $lib$libext $deps $ordinalsfile
  901. \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
  902. PLATFORM=\$(PLATFORM) \\
  903. PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\
  904. INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\
  905. LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
  906. LIBNAME=$libname SHLIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\
  907. STLIBNAME=$lib$libext \\
  908. SHLIBNAME=$target SHLIBNAME_FULL=$target_full \\
  909. CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\
  910. LDFLAGS='\$(LDFLAGS)' SHARED_LDFLAGS='\$(LIB_LDFLAGS)' \\
  911. RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\
  912. link_shlib.$shlib_target
  913. EOF
  914. . (windowsdll() ? <<"EOF" : "");
  915. rm -f apps/$shlib$shlibext
  916. rm -f test/$shlib$shlibext
  917. rm -f fuzz/$shlib$shlibext
  918. cp -p $shlib$shlibext apps/
  919. cp -p $shlib$shlibext test/
  920. cp -p $shlib$shlibext fuzz/
  921. EOF
  922. }
  923. sub obj2dso {
  924. my %args = @_;
  925. my $dso = $args{lib};
  926. my $dsod = dirname($dso);
  927. my $dson = basename($dso);
  928. my $shlibdeps = join("", map { my $d = dirname($_);
  929. my $f = basename($_);
  930. (my $l = $f) =~ s/^lib//;
  931. " -L$d -l$l" } @{$args{deps}});
  932. my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
  933. my $shlib_target = $target{shared_target};
  934. my $objs = join(" ", map { $_.$objext } @{$args{objs}});
  935. my $target = dso($dso);
  936. return <<"EOF";
  937. $target: $objs $deps
  938. \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
  939. PLATFORM=\$(PLATFORM) \\
  940. PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$dsod" \\
  941. LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\
  942. SHLIBNAME_FULL=$target LDFLAGS='\$(LDFLAGS)' \\
  943. CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\
  944. SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\
  945. LIBEXTRAS="$objs" \\
  946. link_dso.$shlib_target
  947. EOF
  948. }
  949. sub obj2lib {
  950. my %args = @_;
  951. my $lib = $args{lib};
  952. my $objs = join(" ", map { $_.$objext } @{$args{objs}});
  953. return <<"EOF";
  954. $lib$libext: $objs
  955. \$(AR) \$\@ \$\?
  956. \$(RANLIB) \$\@ || echo Never mind.
  957. EOF
  958. }
  959. sub obj2bin {
  960. my %args = @_;
  961. my $bin = $args{bin};
  962. my $bind = dirname($bin);
  963. my $binn = basename($bin);
  964. my $objs = join(" ", map { $_.$objext } @{$args{objs}});
  965. my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
  966. my $linklibs = join("", map { my $d = dirname($_);
  967. my $f = basename($_);
  968. $d = "." if $d eq $f;
  969. (my $l = $f) =~ s/^lib//;
  970. " -L$d -l$l" } @{$args{deps}});
  971. my $shlib_target = $disabled{shared} ? "" : $target{shared_target};
  972. return <<"EOF";
  973. $bin$exeext: $objs $deps
  974. \$(RM) $bin$exeext
  975. \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
  976. PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\
  977. APPNAME=$bin$exeext OBJECTS="$objs" \\
  978. LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\
  979. CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\
  980. LDFLAGS='\$(LDFLAGS)' \\
  981. link_app.$shlib_target
  982. EOF
  983. }
  984. sub in2script {
  985. my %args = @_;
  986. my $script = $args{script};
  987. my $sources = join(" ", @{$args{sources}});
  988. my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
  989. "util", "dofile.pl")),
  990. rel2abs($config{builddir}));
  991. return <<"EOF";
  992. $script: $sources
  993. \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
  994. "-o$target{build_file}" $sources > "$script"
  995. chmod a+x $script
  996. EOF
  997. }
  998. sub generatedir {
  999. my %args = @_;
  1000. my $dir = $args{dir};
  1001. my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
  1002. my @actions = ();
  1003. my %extinfo = ( dso => $dsoext,
  1004. lib => $libext,
  1005. bin => $exeext );
  1006. foreach my $type (("dso", "lib", "bin", "script")) {
  1007. next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
  1008. # For lib object files, we could update the library. However, it
  1009. # was decided that it's enough to build the directory local object
  1010. # files, so we don't need to add any actions, and the dependencies
  1011. # are already taken care of.
  1012. if ($type ne "lib") {
  1013. foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
  1014. if (dirname($prod) eq $dir) {
  1015. push @deps, $prod.$extinfo{$type};
  1016. } else {
  1017. push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
  1018. }
  1019. }
  1020. }
  1021. }
  1022. my $deps = join(" ", @deps);
  1023. my $actions = join("\n", "", @actions);
  1024. return <<"EOF";
  1025. $args{dir} $args{dir}/: $deps$actions
  1026. EOF
  1027. }
  1028. "" # Important! This becomes part of the template result.
  1029. -}