windows-makefile.tmpl 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881
  1. ##
  2. ## Makefile for OpenSSL
  3. ##
  4. ## {- join("\n## ", @autowarntext) -}
  5. {-
  6. use File::Basename;
  7. our $sover_dirname = platform->shlib_version_as_filename();
  8. my $build_scheme = $target{build_scheme};
  9. my $install_flavour = $build_scheme->[$#$build_scheme]; # last element
  10. my $win_installenv =
  11. $install_flavour eq "VC-WOW" ? "ProgramFiles(x86)"
  12. : "ProgramW6432";
  13. my $win_commonenv =
  14. $install_flavour eq "VC-WOW" ? "CommonProgramFiles(x86)"
  15. : "CommonProgramW6432";
  16. our $win_installroot =
  17. defined($ENV{$win_installenv}) ? $win_installenv : 'ProgramFiles';
  18. our $win_commonroot =
  19. defined($ENV{$win_commonenv}) ? $win_commonenv : 'CommonProgramFiles';
  20. # expand variables early
  21. $win_installroot = $ENV{$win_installroot};
  22. $win_commonroot = $ENV{$win_commonroot};
  23. # This makes sure things get built in the order they need
  24. # to. You're welcome.
  25. sub dependmagic {
  26. my $target = shift;
  27. return "$target: build_generated\n\t\$(MAKE) /\$(MAKEFLAGS) depend && \$(MAKE) /\$(MAKEFLAGS) _$target\n_$target";
  28. }
  29. '';
  30. -}
  31. PLATFORM={- $config{target} -}
  32. SRCDIR={- $config{sourcedir} -}
  33. BLDDIR={- $config{builddir} -}
  34. VERSION={- "$config{full_version}" -}
  35. MAJOR={- $config{major} -}
  36. MINOR={- $config{minor} -}
  37. SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
  38. LIBS={- join(" ", map { ( platform->sharedlib_import($_), platform->staticlib($_) ) } @{$unified_info{libraries}}) -}
  39. SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -}
  40. SHLIBPDBS={- join(" ", map { platform->sharedlibpdb($_) // () } @{$unified_info{libraries}}) -}
  41. MODULES={- join(" ", map { platform->dso($_) } @{$unified_info{modules}}) -}
  42. MODULEPDBS={- join(" ", map { platform->dsopdb($_) } @{$unified_info{modules}}) -}
  43. PROGRAMS={- our @PROGRAMS = map { platform->bin($_) } @{$unified_info{programs}}; join(" ", @PROGRAMS) -}
  44. PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -}
  45. SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
  46. {- output_off() if $disabled{makedepend}; "" -}
  47. DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () }
  48. grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
  49. keys %{$unified_info{sources}}); -}
  50. {- output_on() if $disabled{makedepend}; "" -}
  51. GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
  52. GENERATED={- # common0.tmpl provides @generated
  53. join(" ", map { platform->convertext($_) } @generated) -}
  54. INSTALL_LIBS={-
  55. join(" ", map { quotify1(platform->sharedlib_import($_)
  56. // platform->staticlib($_)) }
  57. grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
  58. @{$unified_info{libraries}})
  59. -}
  60. INSTALL_SHLIBS={-
  61. join(" ", map { my $x = platform->sharedlib($_);
  62. $x ? quotify_l($x) : () }
  63. grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
  64. @{$unified_info{libraries}})
  65. -}
  66. INSTALL_SHLIBPDBS={-
  67. join(" ", map { my $x = platform->sharedlibpdb($_);
  68. $x ? quotify_l($x) : () }
  69. grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} }
  70. @{$unified_info{libraries}})
  71. -}
  72. INSTALL_ENGINES={-
  73. join(" ", map { quotify1(platform->dso($_)) }
  74. grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
  75. && $unified_info{attributes}->{modules}->{$_}->{engine} }
  76. @{$unified_info{modules}})
  77. -}
  78. INSTALL_ENGINEPDBS={-
  79. join(" ", map { quotify1(platform->dsopdb($_)) }
  80. grep { !$unified_info{attributes}->{modules}->{$_}->{noinst}
  81. && $unified_info{attributes}->{modules}->{$_}->{engine} }
  82. @{$unified_info{modules}})
  83. -}
  84. INSTALL_PROGRAMS={-
  85. join(" ", map { quotify1(platform->bin($_)) }
  86. grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
  87. @{$unified_info{programs}})
  88. -}
  89. INSTALL_PROGRAMPDBS={-
  90. join(" ", map { quotify1(platform->binpdb($_)) }
  91. grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
  92. @{$unified_info{programs}})
  93. -}
  94. BIN_SCRIPTS={-
  95. join(" ", map { quotify1($_) }
  96. grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
  97. && !$unified_info{attributes}->{scripts}->{$_}->{misc} }
  98. @{$unified_info{scripts}})
  99. -}
  100. MISC_SCRIPTS={-
  101. join(" ", map { quotify1($_) }
  102. grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst}
  103. && $unified_info{attributes}->{scripts}->{$_}->{misc} }
  104. @{$unified_info{scripts}})
  105. -}
  106. HTMLDOCS1={- our @HTMLDOCS1 = @{$unified_info{htmldocs}->{man1}};
  107. join(" ", @HTMLDOCS1) -}
  108. HTMLDOCS3={- our @HTMLDOCS3 = @{$unified_info{htmldocs}->{man3}};
  109. join(" ", @HTMLDOCS3) -}
  110. HTMLDOCS5={- our @HTMLDOCS5 = @{$unified_info{htmldocs}->{man5}};
  111. join(" ", @HTMLDOCS5) -}
  112. HTMLDOCS7={- our @HTMLDOCS7 = @{$unified_info{htmldocs}->{man7}};
  113. join(" ", @HTMLDOCS7) -}
  114. HTMLDOCS1_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS1;
  115. join(' ', sort keys %dirs) -}
  116. HTMLDOCS3_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS3;
  117. join(' ', sort keys %dirs) -}
  118. HTMLDOCS5_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS5;
  119. join(' ', sort keys %dirs) -}
  120. HTMLDOCS7_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS7;
  121. join(' ', sort keys %dirs) -}
  122. APPS_OPENSSL={- use File::Spec::Functions;
  123. "\"".catfile("apps","openssl")."\"" -}
  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_dev={- # $prefix is used in the OPENSSLDIR perl snippet
  127. #
  128. use File::Spec::Functions qw(:DEFAULT splitpath);
  129. our $prefix = canonpath($config{prefix}
  130. || "$win_installroot\\OpenSSL");
  131. our ($prefix_dev, $prefix_dir, $prefix_file) =
  132. splitpath($prefix, 1);
  133. $prefix_dev -}
  134. INSTALLTOP_dir={- canonpath($prefix_dir) -}
  135. OPENSSLDIR_dev={- #
  136. # The logic here is that if no --openssldir was given,
  137. # OPENSSLDIR will get the value "$win_commonroot\\SSL".
  138. # If --openssldir was given and the value is an absolute
  139. # path, OPENSSLDIR will get its value without change.
  140. # If the value from --openssldir is a relative path,
  141. # OPENSSLDIR will get $prefix with the --openssldir
  142. # value appended as a subdirectory.
  143. #
  144. use File::Spec::Functions qw(:DEFAULT splitpath);
  145. our $openssldir =
  146. $config{openssldir} ?
  147. (file_name_is_absolute($config{openssldir}) ?
  148. canonpath($config{openssldir})
  149. : catdir($prefix, $config{openssldir}))
  150. : canonpath("$win_commonroot\\SSL");
  151. our ($openssldir_dev, $openssldir_dir, $openssldir_file) =
  152. splitpath($openssldir, 1);
  153. $openssldir_dev -}
  154. OPENSSLDIR_dir={- canonpath($openssldir_dir) -}
  155. LIBDIR={- our $libdir = $config{libdir} || "lib";
  156. file_name_is_absolute($libdir) ? "" : $libdir -}
  157. MODULESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath catpath);
  158. our $modulesprefix = catdir($prefix,$libdir);
  159. our ($modulesprefix_dev, $modulesprefix_dir,
  160. $modulesprefix_file) =
  161. splitpath($modulesprefix, 1);
  162. our $modulesdir_dev = $modulesprefix_dev;
  163. our $modulesdir_dir =
  164. catdir($modulesprefix_dir, "ossl-modules");
  165. our $modulesdir = catpath($modulesdir_dev, $modulesdir_dir);
  166. our $enginesdir_dev = $modulesprefix_dev;
  167. our $enginesdir_dir =
  168. catdir($modulesprefix_dir, "engines-$sover_dirname");
  169. our $enginesdir = catpath($enginesdir_dev, $enginesdir_dir);
  170. $modulesdir_dev -}
  171. MODULESDIR_dir={- canonpath($modulesdir_dir) -}
  172. ENGINESDIR_dev={- $enginesdir_dev -}
  173. ENGINESDIR_dir={- canonpath($enginesdir_dir) -}
  174. !IF "$(DESTDIR)" != ""
  175. INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir)
  176. OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir)
  177. ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir)
  178. MODULESDIR=$(DESTDIR)$(MODULESDIR_dir)
  179. !ELSE
  180. INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir)
  181. OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir)
  182. ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
  183. MODULESDIR=$(MODULESDIR_dev)$(MODULESDIR_dir)
  184. !ENDIF
  185. # $(libdir) is chosen to be compatible with the GNU coding standards
  186. libdir={- file_name_is_absolute($libdir)
  187. ? $libdir : '$(INSTALLTOP)\$(LIBDIR)' -}
  188. ##### User defined commands and flags ################################
  189. CC="{- $config{CC} -}"
  190. CPP="{- $config{CPP} -}"
  191. CPPFLAGS={- our $cppflags1 = join(" ",
  192. (map { "-D".$_} @{$config{CPPDEFINES}}),
  193. (map { " -I ".$_} @{$config{CPPINCLUDES}}),
  194. @{$config{CPPFLAGS}}) -}
  195. CFLAGS={- join(' ', @{$config{CFLAGS}}) -}
  196. LD="{- $config{LD} -}"
  197. LDFLAGS={- join(' ', @{$config{LDFLAGS}}) -}
  198. EX_LIBS={- join(' ', @{$config{LDLIBS}}) -}
  199. PERL={- $config{PERL} -}
  200. AR="{- $config{AR} -}"
  201. ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -}
  202. MT="{- $config{MT} -}"
  203. MTFLAGS= {- join(' ', @{$config{MTFLAGS}}) -}
  204. AS="{- $config{AS} -}"
  205. ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -}
  206. RC="{- $config{RC} -}"
  207. RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -}
  208. ECHO="$(PERL)" "$(SRCDIR)\util\echo.pl"
  209. ##### Special command flags ##########################################
  210. COUTFLAG={- $target{coutflag} -}$(OSSL_EMPTY)
  211. LDOUTFLAG={- $target{ldoutflag} -}$(OSSL_EMPTY)
  212. AROUTFLAG={- $target{aroutflag} -}$(OSSL_EMPTY)
  213. MTINFLAG={- $target{mtinflag} -}$(OSSL_EMPTY)
  214. MTOUTFLAG={- $target{mtoutflag} -}$(OSSL_EMPTY)
  215. ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
  216. RCOUTFLAG={- $target{rcoutflag} -}$(OSSL_EMPTY)
  217. ##### Project flags ##################################################
  218. # Variables starting with CNF_ are common variables for all product types
  219. CNF_ASFLAGS={- join(' ', $target{asflags} || (),
  220. @{$config{asflags}}) -}
  221. CNF_CPPFLAGS={- our $cppfags2 =
  222. join(' ', $target{cppflags} || (),
  223. (map { '-D'.quotify1($_) } @{$target{defines}},
  224. @{$config{defines}}),
  225. (map { '-I'.quotify1($_) } @{$target{includes}},
  226. @{$config{includes}}),
  227. @{$config{cppflags}}) -}
  228. CNF_CFLAGS={- join(' ', $target{cflags} || (),
  229. @{$config{cflags}}) -}
  230. CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
  231. @{$config{cxxflags}}) -}
  232. CNF_LDFLAGS={- join(' ', $target{lflags} || (),
  233. @{$config{lflags}}) -}
  234. CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
  235. @{$config{ex_libs}}) -}
  236. # Variables starting with LIB_ are used to build library object files
  237. # and shared libraries.
  238. # Variables starting with DSO_ are used to build DSOs and their object files.
  239. # Variables starting with BIN_ are used to build programs and their object
  240. # files.
  241. LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (),
  242. @{$config{lib_asflags}},
  243. '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
  244. LIB_CPPFLAGS={- our $lib_cppflags =
  245. join(' ', $target{lib_cppflags} || (),
  246. $target{shared_cppflag} || (),
  247. (map { '-D'.quotify1($_) }
  248. @{$target{lib_defines}},
  249. @{$target{shared_defines}},
  250. @{$config{lib_defines}},
  251. @{$config{shared_defines}}),
  252. (map { '-I'.quotify1($_) }
  253. @{$target{lib_includes}},
  254. @{$target{shared_includes}},
  255. @{$config{lib_includes}},
  256. @{$config{shared_includes}}),
  257. @{$config{lib_cppflags}},
  258. @{$config{shared_cppflag}});
  259. join(' ', $lib_cppflags,
  260. (map { '-D'.quotify1($_) }
  261. "OPENSSLDIR=\"$openssldir\"",
  262. "ENGINESDIR=\"$enginesdir\"",
  263. "MODULESDIR=\"$modulesdir\""),
  264. '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
  265. LIB_CFLAGS={- join(' ', $target{lib_cflags} || (),
  266. $target{shared_cflag} || (),
  267. @{$config{lib_cflags}},
  268. @{$config{shared_cflag}},
  269. '$(CNF_CFLAGS)', '$(CFLAGS)') -}
  270. LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
  271. $config{shared_ldflag} || (),
  272. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  273. LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  274. DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (),
  275. $target{module_asflags} || (),
  276. @{$config{dso_asflags}},
  277. @{$config{module_asflags}},
  278. '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
  279. DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
  280. $target{module_cppflag} || (),
  281. (map { '-D'.quotify1($_) }
  282. @{$target{dso_defines}},
  283. @{$target{module_defines}},
  284. @{$config{dso_defines}},
  285. @{$config{module_defines}}),
  286. (map { '-I'.quotify1($_) }
  287. @{$target{dso_includes}},
  288. @{$target{module_includes}},
  289. @{$config{dso_includes}},
  290. @{$config{module_includes}}),
  291. @{$config{dso_cppflags}},
  292. @{$config{module_cppflags}},
  293. '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
  294. DSO_CFLAGS={- join(' ', $target{dso_cflags} || (),
  295. $target{module_cflags} || (),
  296. @{$config{dso_cflags}},
  297. @{$config{module_cflags}},
  298. '$(CNF_CFLAGS)', '$(CFLAGS)') -}
  299. DSO_LDFLAGS={- join(' ', $target{dso_lflags} || (),
  300. $target{module_ldflags} || (),
  301. @{$config{dso_lflags}},
  302. @{$config{module_ldflags}},
  303. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  304. DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  305. BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (),
  306. @{$config{bin_asflags}},
  307. '$(CNF_ASFLAGS)', '$(ASFLAGS)') -}
  308. BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (),
  309. (map { '-D'.$_ } @{$config{bin_defines} || ()}),
  310. @{$config{bin_cppflags}},
  311. '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -}
  312. BIN_CFLAGS={- join(' ', $target{bin_cflags} || (),
  313. @{$config{bin_cflags}},
  314. '$(CNF_CFLAGS)', '$(CFLAGS)') -}
  315. BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (),
  316. @{$config{bin_lflags}},
  317. '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
  318. BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
  319. # CPPFLAGS_Q is used for one thing only: to build up buildinf.h
  320. CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g;
  321. $cppflags2 =~ s|([\\"])|\\$1|g;
  322. join(' ', $lib_cppflags || (), $cppflags2 || (),
  323. $cppflags1 || ()) -}
  324. PERLASM_SCHEME= {- $target{perlasm_scheme} -}
  325. PROCESSOR= {- $config{processor} -}
  326. # The main targets ###################################################
  327. {- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep
  328. {- dependmagic('build_libs'); -}: build_libs_nodep
  329. {- dependmagic('build_modules'); -}: build_modules_nodep
  330. {- dependmagic('build_programs'); -}: build_programs_nodep
  331. build_docs: build_html_docs
  332. build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7)
  333. build_generated: $(GENERATED_MANDATORY)
  334. build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -}
  335. build_modules_nodep: $(MODULES)
  336. build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
  337. # Kept around for backward compatibility
  338. build_apps build_tests: build_programs
  339. # Convenience target to prebuild all generated files, not just the mandatory
  340. # ones
  341. build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs
  342. @{- output_off() if $disabled{makedepend}; "" -}
  343. @$(ECHO) "Warning: consider configuring with no-makedepend, because if"
  344. @$(ECHO) " target system doesn't have $(PERL),"
  345. @$(ECHO) " then make will fail..."
  346. @{- output_on() if $disabled{makedepend}; "" -}
  347. all: build_sw build_docs
  348. test: tests
  349. {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep
  350. @{- output_off() if $disabled{tests}; "" -}
  351. -mkdir $(BLDDIR)\test\test-runs
  352. set SRCTOP=$(SRCDIR)
  353. set BLDTOP=$(BLDDIR)
  354. set RESULT_D=$(BLDDIR)\test\test-runs
  355. set PERL=$(PERL)
  356. set OPENSSL_ENGINES=$(MAKEDIR)\engines
  357. set OPENSSL_MODULES=$(MAKEDIR)\providers
  358. "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
  359. @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
  360. @$(ECHO) "Tests are not supported with your chosen Configure options"
  361. @{- output_on() if !$disabled{tests}; "" -}
  362. list-tests:
  363. @{- output_off() if $disabled{tests}; "" -}
  364. @set SRCTOP=$(SRCDIR)
  365. @"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list
  366. @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
  367. @$(ECHO) "Tests are not supported with your chosen Configure options"
  368. @{- output_on() if !$disabled{tests}; "" -}
  369. install: install_sw install_ssldirs install_docs
  370. uninstall: uninstall_docs uninstall_sw
  371. libclean:
  372. "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """{.,apps,test,fuzz}/$$1.*"""; } @ARGV" $(SHLIBS)
  373. -del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb
  374. clean: libclean
  375. -rmdir /Q /S $(HTMLDOCS1_BLDDIRS)
  376. -rmdir /Q /S $(HTMLDOCS3_BLDDIRS)
  377. -rmdir /Q /S $(HTMLDOCS5_BLDDIRS)
  378. -rmdir /Q /S $(HTMLDOCS7_BLDDIRS)
  379. {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -}
  380. -del /Q /F $(MODULES)
  381. -del /Q /F $(SCRIPTS)
  382. -del /Q /F $(GENERATED_MANDATORY)
  383. -del /Q /F $(GENERATED)
  384. -del /Q /S /F *.d *.obj *.pdb *.ilk *.manifest
  385. -del /Q /S /F engines\*.lib engines\*.exp
  386. -del /Q /S /F apps\*.lib apps\*.rc apps\*.res apps\*.exp
  387. -del /Q /S /F test\*.exp
  388. -rmdir /Q /S test\test-runs
  389. distclean: clean
  390. -del /Q /F configdata.pm
  391. -del /Q /F makefile
  392. depend:
  393. @ {- output_off() if $disabled{makedepend}; "" -}
  394. @ "$(PERL)" "$(SRCDIR)\util\add-depends.pl" "VC"
  395. @ {- output_on() if $disabled{makedepend}; "" -}
  396. # Install helper targets #############################################
  397. install_sw: install_dev install_engines install_runtime
  398. uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
  399. install_docs: install_html_docs
  400. uninstall_docs: uninstall_html_docs
  401. install_ssldirs:
  402. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs"
  403. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private"
  404. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc"
  405. @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
  406. "$(OPENSSLDIR)\openssl.cnf.dist"
  407. @IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \
  408. "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
  409. "$(OPENSSLDIR)\openssl.cnf"
  410. @if not "$(MISC_SCRIPTS)"=="" \
  411. "$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \
  412. "$(OPENSSLDIR)\misc"
  413. @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
  414. "$(OPENSSLDIR)\ct_log_list.cnf.dist"
  415. @IF NOT EXIST "$(OPENSSLDIR)\ct_log_list.cnf" \
  416. "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
  417. "$(OPENSSLDIR)\ct_log_list.cnf"
  418. install_dev: install_runtime_libs
  419. @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
  420. @$(ECHO) "*** Installing development files"
  421. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl"
  422. @{- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
  423. @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \
  424. "$(INSTALLTOP)\include\openssl"
  425. @{- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -}
  426. @"$(PERL)" "$(SRCDIR)\util\copy.pl" "-exclude_re=/__DECC_" \
  427. "$(SRCDIR)\include\openssl\*.h" \
  428. "$(INSTALLTOP)\include\openssl"
  429. @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(BLDDIR)\include\openssl\*.h" \
  430. "$(INSTALLTOP)\include\openssl"
  431. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)"
  432. @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)"
  433. @if "$(SHLIBS)"=="" \
  434. "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)"
  435. uninstall_dev:
  436. install_engines: install_runtime_libs build_modules
  437. @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
  438. @$(ECHO) "*** Installing ENGINE modules"
  439. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)"
  440. @if not "$(INSTALL_ENGINES)"=="" \
  441. "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)"
  442. @if not "$(INSTALL_ENGINES)"=="" \
  443. "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)"
  444. uninstall_engines:
  445. install_runtime: install_programs
  446. install_runtime_libs: build_libs
  447. @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
  448. @$(ECHO) "*** Installing runtime libraries"
  449. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
  450. @if not "$(SHLIBS)"=="" \
  451. "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin"
  452. @if not "$(SHLIBS)"=="" \
  453. "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \
  454. "$(INSTALLTOP)\bin"
  455. install_programs: install_runtime_libs build_programs
  456. @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 )
  457. @$(ECHO) "*** Installing runtime programs"
  458. @if not "$(INSTALL_PROGRAMS)"=="" \
  459. "$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
  460. @if not "$(INSTALL_PROGRAMS)"=="" \
  461. "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
  462. "$(INSTALLTOP)\bin"
  463. @if not "$(INSTALL_PROGRAMS)"=="" \
  464. "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
  465. "$(INSTALLTOP)\bin"
  466. @if not "$(INSTALL_PROGRAMS)"=="" \
  467. "$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \
  468. "$(INSTALLTOP)\bin"
  469. uninstall_runtime:
  470. install_html_docs: build_html_docs
  471. @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
  472. @echo *** Installing HTML docs
  473. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man1"
  474. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man3"
  475. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man5"
  476. @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7"
  477. @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man1\*.html \
  478. "$(INSTALLTOP)\html\man1"
  479. @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man3\*.html \
  480. "$(INSTALLTOP)\html\man3"
  481. @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man5\*.html \
  482. "$(INSTALLTOP)\html\man5"
  483. @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man7\*.html \
  484. "$(INSTALLTOP)\html\man7"
  485. uninstall_html_docs:
  486. # Building targets ###################################################
  487. configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
  488. @$(ECHO) "Detected changed: $?"
  489. "$(PERL)" configdata.pm -r
  490. @$(ECHO) "**************************************************"
  491. @$(ECHO) "*** ***"
  492. @$(ECHO) "*** Please run the same make command again ***"
  493. @$(ECHO) "*** ***"
  494. @$(ECHO) "**************************************************"
  495. @exit 1
  496. reconfigure reconf:
  497. "$(PERL)" configdata.pm -r
  498. {-
  499. use File::Basename;
  500. use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
  501. # Helper function to figure out dependencies on libraries
  502. # It takes a list of library names and outputs a list of dependencies
  503. sub compute_lib_depends {
  504. if ($disabled{shared}) {
  505. return map { platform->staticlib($_) } @_;
  506. }
  507. return map { platform->sharedlib_import($_) // platform->staticlib($_) } @_;
  508. }
  509. sub generatesrc {
  510. my %args = @_;
  511. my ($gen0, @gens) = @{$args{generator}};
  512. my $generator = '"'.$gen0.'"'.join('', map { " $_" } @gens);
  513. my $generator_incs = join("", map { " -I \"$_\"" } @{$args{generator_incs}});
  514. my $incs = join("", map { " -I \"$_\"" } @{$args{incs}});
  515. my $defs = join("", map { " -D".$_ } @{$args{defs}});
  516. my $deps = @{$args{deps}} ?
  517. '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
  518. if ($args{src} =~ /\.html$/) {
  519. my $title = basename($args{src}, ".html");
  520. return <<"EOF";
  521. $args{src}: $args{generator}->[0]
  522. pod2html "--podroot=\$(SRCDIR)/doc" --htmldir=.. \\
  523. --podpath=man1:man3:man5:man7 "--infile=\$?" "--title=$title" \\
  524. | \$(PERL) -pe ^"s^|href=\\^"http://man\\.he\\.net/^(man\\d/[^^\\^"]+^)^(?:\.html^)?^"^|href=\\^"../\$\$1.html^|g;^" \\
  525. > \$\@
  526. EOF
  527. } elsif (platform->isdef($args{src})) {
  528. my $target = platform->def($args{src});
  529. my $mkdef = abs2rel(rel2abs(catfile($config{sourcedir},
  530. "util", "mkdef.pl")),
  531. rel2abs($config{builddir}));
  532. my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
  533. my $ord_name =
  534. $args{generator}->[1] || platform->dsoname($args{product});
  535. return <<"EOF";
  536. $target: $args{generator}->[0] $deps $mkdef
  537. "\$(PERL)" $mkdef$ord_ver --ordinals $args{generator}->[0] --name $ord_name --OS windows > $target
  538. EOF
  539. } elsif (!platform->isasm($args{src})) {
  540. my $target = $args{src};
  541. if ($args{generator}->[0] =~ m|^.*\.in$|) {
  542. my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
  543. "util", "dofile.pl")),
  544. rel2abs($config{builddir}));
  545. my @modules = ( 'configdata.pm',
  546. grep { $_ =~ m|\.pm$| } @{$args{deps}} );
  547. my %moduleincs = map { '"-I'.dirname($_).'"' => 1 } @modules;
  548. @modules = map { "-M".basename($_, '.pm') } @modules;
  549. my $modules = join(' ', '', sort keys %moduleincs, @modules);
  550. return <<"EOF";
  551. $target: "$args{generator}->[0]" $deps
  552. "\$(PERL)"$modules "$dofile" "-o$target{build_file}" $generator > \$@
  553. EOF
  554. } else {
  555. return <<"EOF";
  556. $target: "$args{generator}->[0]" $deps
  557. "\$(PERL)"$generator_incs $generator > \$@
  558. EOF
  559. }
  560. } else {
  561. my $cppflags = {
  562. shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  563. lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)',
  564. dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)',
  565. bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)'
  566. } -> {$args{intent}};
  567. my $target = platform->asm($args{src});
  568. if ($args{generator}->[0] =~ /\.pl$/) {
  569. $generator = '"$(PERL)"'.$generator_incs.' '.$generator
  570. .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSSOR)';
  571. } elsif ($args{generator}->[0] =~ /\.S$/) {
  572. $generator = undef;
  573. } else {
  574. die "Generator type for $src unknown: $generator\n";
  575. }
  576. if (defined($generator)) {
  577. # If the target is named foo.S in build.info, we want to
  578. # end up generating foo.s in two steps.
  579. if ($args{src} =~ /\.S$/) {
  580. return <<"EOF";
  581. $target: "$args{generator}->[0]" $deps
  582. set ASM=\$(AS)
  583. $generator \$@.S
  584. \$(CPP) $incs $cppflags $defs \$@.S > \$@.i && move /Y \$@.i \$@
  585. del /Q \$@.S
  586. EOF
  587. }
  588. # Otherwise....
  589. return <<"EOF";
  590. $target: "$args{generator}->[0]" $deps
  591. set ASM=\$(AS)
  592. $generator \$@
  593. EOF
  594. }
  595. return <<"EOF";
  596. $target: "$args{generator}->[0]" $deps
  597. \$(CPP) $incs $cppflags $defs "$args{generator}->[0]" > \$@.i && move /Y \$@.i \$@
  598. EOF
  599. }
  600. }
  601. sub src2obj {
  602. my $asmext = platform->asmext();
  603. my %args = @_;
  604. my @srcs =
  605. map { my $x = $_;
  606. (platform->isasm($x) && grep { $x eq $_ } @generated)
  607. ? platform->asm($x) : $x }
  608. ( @{$args{srcs}} );
  609. my $srcs = '"'.join('" "', @srcs).'"';
  610. my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"';
  611. my $incs = join("", map { ' -I "'.$_.'"' } @{$args{incs}});
  612. my $defs = join("", map { " -D".$_ } @{$args{defs}});
  613. my $cflags = { shlib => ' $(LIB_CFLAGS)',
  614. lib => ' $(LIB_CFLAGS)',
  615. dso => ' $(DSO_CFLAGS)',
  616. bin => ' $(BIN_CFLAGS)' } -> {$args{intent}};
  617. $cflags .= $incs;
  618. $cflags .= { shlib => ' $(LIB_CPPFLAGS)',
  619. lib => ' $(LIB_CPPFLAGS)',
  620. dso => ' $(DSO_CPPFLAGS)',
  621. bin => ' $(BIN_CPPFLAGS)' } -> {$args{intent}};
  622. my $asflags = { shlib => ' $(LIB_ASFLAGS)',
  623. lib => ' $(LIB_ASFLAGS)',
  624. dso => ' $(DSO_ASFLAGS)',
  625. bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}};
  626. my $makedepprog = $config{makedepprog};
  627. if ($srcs[0] =~ /\.rc$/) {
  628. my $res = platform->res($args{obj});
  629. return <<"EOF";
  630. $res: $deps
  631. \$(RC) \$(RCFLAGS) \$(RCOUTFLAG)\$\@ $srcs
  632. EOF
  633. }
  634. my $obj = platform->obj($args{obj});
  635. my $dep = platform->dep($args{obj});
  636. if ($srcs[0] =~ /\Q${asmext}\E$/) {
  637. return <<"EOF";
  638. $obj: $deps
  639. \$(AS) $asflags \$(ASOUTFLAG)\$\@ $srcs
  640. EOF
  641. } elsif ($srcs[0] =~ /.S$/) {
  642. return <<"EOF";
  643. $obj: $deps
  644. \$(CC) /EP -D__ASSEMBLER__ $cflags $defs $srcs > \$@.asm && \$(AS) $asflags \$(ASOUTFLAG)\$\@ \$@.asm
  645. EOF
  646. }
  647. my $recipe = <<"EOF";
  648. $obj: $deps
  649. \$(CC) $cflags $defs -c \$(COUTFLAG)\$\@ $srcs
  650. EOF
  651. $recipe .= <<"EOF" unless $disabled{makedepend};
  652. \$(CC) $cflags $defs /Zs /showIncludes $srcs 2>&1 > $dep
  653. EOF
  654. return $recipe;
  655. }
  656. # We *know* this routine is only called when we've configure 'shared'.
  657. # Also, note that even though the import library built here looks like
  658. # a static library, it really isn't.
  659. sub obj2shlib {
  660. my %args = @_;
  661. my $lib = $args{lib};
  662. my @objs = map { platform->convertext($_) }
  663. grep { platform->isobj($_) || platform->isres($_) }
  664. @{$args{objs}};
  665. my @defs = map { platform->def($_) }
  666. grep { platform->isdef($_) }
  667. @{$args{objs}};
  668. my @deps = compute_lib_depends(@{$args{deps}});
  669. die "More than one exported symbols list" if scalar @defs > 1;
  670. my $linklibs = join("", map { "$_\n" } @deps);
  671. my $objs = join("\n", @objs);
  672. my $deps = join(" ", @objs, @defs, @deps);
  673. my $import = platform->sharedlib_import($lib);
  674. my $dll = platform->sharedlib($lib);
  675. my $shared_def = join("", map { " /def:$_" } @defs);
  676. return <<"EOF"
  677. # The import library may look like a static library, but it is not.
  678. # We MUST make the import library depend on the DLL, in case someone
  679. # mistakenly removes the latter.
  680. $import: $dll
  681. $dll: $deps
  682. IF EXIST $full.manifest DEL /F /Q $full.manifest
  683. IF EXIST \$@ DEL /F /Q \$@
  684. \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
  685. /implib:$import \$(LDOUTFLAG)$dll$shared_def @<< || (DEL /Q \$(\@B).* $import && EXIT 1)
  686. $objs
  687. $linklibs\$(LIB_EX_LIBS)
  688. <<
  689. IF EXIST $dll.manifest \\
  690. \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dll.manifest \$(MTOUTFLAG)$dll
  691. IF EXIST apps\\$dll DEL /Q /F apps\\$dll
  692. IF EXIST test\\$dll DEL /Q /F test\\$dll
  693. IF EXIST fuzz\\$dll DEL /Q /F fuzz\\$dll
  694. COPY $dll apps
  695. COPY $dll test
  696. COPY $dll fuzz
  697. EOF
  698. }
  699. sub obj2dso {
  700. my %args = @_;
  701. my $dso = platform->dso($args{module});
  702. my $dso_n = platform->dsoname($args{module});
  703. my @objs = map { platform->convertext($_) }
  704. grep { platform->isobj($_) || platform->isres($_) }
  705. @{$args{objs}};
  706. my @defs = map { platform->def($_) }
  707. grep { platform->isdef($_) }
  708. @{$args{objs}};
  709. my @deps = compute_lib_depends(@{$args{deps}});
  710. my $objs = join("\n", @objs);
  711. my $linklibs = join("", map { "$_\n" } @deps);
  712. my $deps = join(" ", @objs, @defs, @deps);
  713. my $shared_def = join("", map { " /def:$_" } @defs);
  714. return <<"EOF";
  715. $dso: $deps
  716. IF EXIST $dso.manifest DEL /F /Q $dso.manifest
  717. \$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \\
  718. \$(LDOUTFLAG)$dso$shared_def @<< || (DEL /Q \$(\@B).* $dso_n.* && EXIT 1)
  719. $objs
  720. $linklibs \$(DSO_EX_LIBS)
  721. <<
  722. IF EXIST $dso.manifest \\
  723. \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso.manifest \$(MTOUTFLAG)$dso
  724. EOF
  725. }
  726. sub obj2lib {
  727. my %args = @_;
  728. my $lib = platform->staticlib($args{lib});
  729. my @objs = map { platform->obj($_) } @{$args{objs}};
  730. my $objs = join("\n", @objs);
  731. my $deps = join(" ", @objs);
  732. return <<"EOF";
  733. $lib: $deps
  734. \$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib @<<
  735. $objs
  736. <<
  737. EOF
  738. }
  739. sub obj2bin {
  740. my %args = @_;
  741. my $bin = platform->bin($args{bin});
  742. my @objs = map { platform->convertext($_) }
  743. grep { platform->isobj($_) || platform->isres($_) }
  744. @{$args{objs}};
  745. my @deps = compute_lib_depends(@{$args{deps}});
  746. my $objs = join("\n", @objs);
  747. my $linklibs = join("", map { "$_\n" } @deps);
  748. my $deps = join(" ", @objs, @deps);
  749. return <<"EOF";
  750. $bin: $deps
  751. IF EXIST $bin.manifest DEL /F /Q $bin.manifest
  752. \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin @<<
  753. $objs
  754. setargv.obj
  755. $linklibs\$(BIN_EX_LIBS)
  756. <<
  757. IF EXIST $bin.manifest \\
  758. \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin.manifest \$(MTOUTFLAG)$bin
  759. EOF
  760. }
  761. sub in2script {
  762. my %args = @_;
  763. my $script = $args{script};
  764. my $sources = '"'.join('" "', @{$args{sources}}).'"';
  765. my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
  766. "util", "dofile.pl")),
  767. rel2abs($config{builddir}));
  768. return <<"EOF";
  769. $script: $sources
  770. "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
  771. "-o$target{build_file}" $sources > "$script"
  772. EOF
  773. }
  774. sub generatedir {
  775. my %args = @_;
  776. my $dir = $args{dir};
  777. my @deps = map { platform->convertext($_) } @{$args{deps}};
  778. my @actions = ();
  779. my %extinfo = ( dso => platform->dsoext(),
  780. lib => platform->libext(),
  781. bin => platform->binext() );
  782. # We already have a 'test' target, and the top directory is just plain
  783. # silly
  784. return if $dir eq "test" || $dir eq ".";
  785. foreach my $type (("dso", "lib", "bin", "script")) {
  786. next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
  787. # For lib object files, we could update the library. However,
  788. # LIB on Windows doesn't work that way, so we won't create any
  789. # actions for it, and the dependencies are already taken care of.
  790. if ($type ne "lib") {
  791. foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
  792. if (dirname($prod) eq $dir) {
  793. push @deps, $prod.$extinfo{$type};
  794. }
  795. }
  796. }
  797. }
  798. my $deps = join(" ", @deps);
  799. my $actions = join("\n", "", @actions);
  800. return <<"EOF";
  801. $dir $dir\\ : $deps$actions
  802. EOF
  803. }
  804. "" # Important! This becomes part of the template result.
  805. -}