unix-Makefile.tmpl 51 KB

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