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