unix-Makefile.tmpl 51 KB

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