2 ## Makefile for OpenSSL
4 ## {- join("\n## ", @autowarntext) -}
6 our $objext = $target{obj_extension} || ".obj";
7 our $depext = $target{dep_extension} || ".d";
8 our $exeext = $target{exe_extension} || ".exe";
9 our $libext = $target{lib_extension} || ".lib";
10 our $shlibext = $target{shared_extension} || ".dll";
11 our $shlibextimport = $target{shared_import_extension} || ".lib";
12 our $dsoext = $target{dso_extension} || ".dll";
14 our $sover = $config{shlib_major}."_".$config{shlib_minor};
17 $target{build_scheme}->[2] eq "VC-W32" ?
18 "ProgramFiles(x86)" : "ProgramW6432";
20 $target{build_scheme}->[2] eq "VC-W32"
21 ? "CommonProgramFiles(x86)" : "CommonProgramW6432";
22 our $win_installroot =
23 defined($ENV{$win_installenv})
24 ? $win_installenv : 'ProgramFiles';
26 defined($ENV{$win_commonenv})
27 ? $win_commonenv : 'CommonProgramFiles';
29 # expand variables early
30 $win_installroot = $ENV{$win_installroot};
31 $win_commonroot = $ENV{$win_commonroot};
34 return () if $disabled{shared};
36 return $unified_info{sharednames}->{$lib} . $shlibext;
40 return () if $disabled{shared};
42 return $lib . $shlibextimport;
48 return $dso . $dsoext;
50 # This makes sure things get built in the order they need
55 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
60 PLATFORM={- $config{target} -}
61 SRCDIR={- $config{sourcedir} -}
62 BLDDIR={- $config{builddir} -}
64 VERSION={- $config{version} -}
65 MAJOR={- $config{major} -}
66 MINOR={- $config{minor} -}
68 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
70 LIBS={- join(" ", map { $_.$libext } @{$unified_info{libraries}}) -}
71 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
72 SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; shlib($_) } @{$unified_info{libraries}}) -}
73 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
74 ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; dso($_) } @{$unified_info{engines}}) -}
75 PROGRAMS={- our @PROGRAMS = map { $_.$exeext } @{$unified_info{programs}}; join(" ", @PROGRAMS) -}
76 PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -}
77 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
78 {- output_off() if $disabled{makedepend}; "" -}
79 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
80 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
81 keys %{$unified_info{sources}}); -}
82 {- output_on() if $disabled{makedepend}; "" -}
83 GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
84 GENERATED={- join(" ",
85 ( map { (my $x = $_) =~ s|\.[sS]$|\.asm|; $x }
86 grep { defined $unified_info{generate}->{$_} }
87 map { @{$unified_info{sources}->{$_}} }
88 grep { /\.o$/ } keys %{$unified_info{sources}} ),
89 ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
91 INSTALL_LIBS={- join(" ", map { $_.$libext } @{$unified_info{install}->{libraries}}) -}
92 INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -}
93 INSTALL_SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; shlib($_) } @{$unified_info{install}->{libraries}}) -}
94 INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -}
95 INSTALL_ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; dso($_) } @{$unified_info{install}->{engines}}) -}
96 INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -}
97 INSTALL_PROGRAMPDBS={- join(" ", map { $_.".pdb" } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -}
98 {- output_off() if $disabled{apps}; "" -}
99 BIN_SCRIPTS=$(BLDDIR)\tools\c_rehash.pl
100 MISC_SCRIPTS=$(BLDDIR)\apps\CA.pl $(BLDDIR)\apps\tsget.pl
101 {- output_on() if $disabled{apps}; "" -}
103 APPS_OPENSSL={- use File::Spec::Functions;
104 catfile("apps","openssl") -}
106 # Do not edit these manually. Use Configure with --prefix or --openssldir
107 # to change this! Short explanation in the top comment in Configure
108 INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet
110 use File::Spec::Functions qw(:DEFAULT splitpath);
111 our $prefix = canonpath($config{prefix}
112 || "$win_installroot\\OpenSSL");
113 our ($prefix_dev, $prefix_dir, $prefix_file) =
114 splitpath($prefix, 1);
116 INSTALLTOP_dir={- canonpath($prefix_dir) -}
118 # The logic here is that if no --openssldir was given,
119 # OPENSSLDIR will get the value from $prefix plus "/ssl".
120 # If --openssldir was given and the value is an absolute
121 # path, OPENSSLDIR will get its value without change.
122 # If the value from --openssldir is a relative path,
123 # OPENSSLDIR will get $prefix with the --openssldir
124 # value appended as a subdirectory.
126 use File::Spec::Functions qw(:DEFAULT splitpath);
128 $config{openssldir} ?
129 (file_name_is_absolute($config{openssldir}) ?
130 canonpath($config{openssldir})
131 : catdir($prefix, $config{openssldir}))
132 : canonpath("$win_commonroot\\SSL");
133 our ($openssldir_dev, $openssldir_dir, $openssldir_file) =
134 splitpath($openssldir, 1);
136 OPENSSLDIR_dir={- canonpath($openssldir_dir) -}
137 LIBDIR={- our $libdir = $config{libdir} || "lib";
139 ENGINESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath);
140 our $enginesdir = catdir($prefix,$libdir,"engines-$sover");
141 our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) =
142 splitpath($enginesdir, 1);
144 ENGINESDIR_dir={- canonpath($enginesdir_dir) -}
145 !IF "$(DESTDIR)" != ""
146 INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir)
147 OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir)
148 ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir)
150 INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir)
151 OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir)
152 ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
156 CFLAGS={- join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}})) -} {- join(" ", quotify_l("-DENGINESDIR=\"$enginesdir\"", "-DOPENSSLDIR=\"$openssldir\"")) -} {- $target{cflags} -} {- $config{cflags} -}
157 COUTFLAG={- $target{coutflag} || "/Fo" -}$(OSSL_EMPTY)
158 RC={- $target{rc} || "rc" -}
159 RCOUTFLAG={- $target{rcoutflag} || "/fo" -}$(OSSL_EMPTY)
160 LD={- $target{ld} || "link" -}
161 LDFLAGS={- $target{lflags} -}
162 LDOUTFLAG={- $target{loutflag} || "/out:" -}$(OSSL_EMPTY)
163 EX_LIBS={- $target{ex_libs} -}
164 LIB_CFLAGS={- join(" ", $target{lib_cflags}, $target{shared_cflag}) || "" -}
165 LIB_LDFLAGS={- $target{shared_ldflag} || "" -}
166 DSO_CFLAGS={- join(" ", $target{dso_cflags}, $target{shared_cflag}) || "" -}
167 DSO_LDFLAGS={- join(" ", $target{dso_lflags}, $target{shared_ldflag}) || "" -}
168 BIN_CFLAGS={- $target{bin_cflags} -}
169 BIN_LDFLAGS={- $target{bin_lflags} -}
171 PERL={- $config{perl} -}
174 ARFLAGS= {- $target{arflags} -}
175 AROUTFLAG={- $target{aroutflag} || "/out:" -}$(OSSL_EMPTY)
178 MTFLAGS= {- $target{mtflags} -}
179 MTINFLAG={- $target{mtinflag} || "-manifest " -}$(OSSL_EMPTY)
180 MTOUTFLAG={- $target{mtoutflag} || "-outputresource:" -}$(OSSL_EMPTY)
183 ASFLAGS={- $target{asflags} -}
184 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
185 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
187 PROCESSOR= {- $config{processor} -}
189 # The main targets ###################################################
191 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep
192 {- dependmagic('build_libs'); -}: build_libs_nodep
193 {- dependmagic('build_engines'); -}: build_engines_nodep
194 {- dependmagic('build_programs'); -}: build_programs_nodep
196 build_generated: $(GENERATED_MANDATORY)
197 build_libs_nodep: $(LIBS) {- join(" ",map { shlib_import($_) } @{$unified_info{libraries}}) -}
198 build_engines_nodep: $(ENGINES)
199 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
201 # Kept around for backward compatibility
202 build_apps build_tests: build_programs
204 # Convenience target to prebuild all generated files, not just the mandatory
206 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
209 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep
210 @rem {- output_off() if $disabled{tests}; "" -}
211 -mkdir $(BLDDIR)\test\test-runs
214 set RESULT_D=$(BLDDIR)\test\test-runs
216 set OPENSSL_ENGINES=$(MAKEDIR)\engines
217 set OPENSSL_DEBUG_MEMORY=on
218 "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
219 @rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
220 @echo "Tests are not supported with your chosen Configure options"
221 @rem {- output_on() if !$disabled{tests}; "" -}
224 @rem {- output_off() if $disabled{tests}; "" -}
225 @set SRCTOP=$(SRCDIR)
226 @"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list
227 @rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
228 @echo "Tests are not supported with your chosen Configure options"
229 @rem {- output_on() if !$disabled{tests}; "" -}
231 install: install_sw install_ssldirs install_docs
233 uninstall: uninstall_docs uninstall_sw
236 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """$$1.*"""; } @ARGV" $(SHLIBS)
237 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """apps/$$1.*"""; } @ARGV" $(SHLIBS)
238 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """test/$$1.*"""; } @ARGV" $(SHLIBS)
239 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """fuzz/$$1.*"""; } @ARGV" $(SHLIBS)
241 -del /Q ossl_static.pdb
244 {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -}
245 -del /Q /F $(ENGINES)
246 -del /Q /F $(SCRIPTS)
247 -del /Q /F $(GENERATED)
252 -del /Q /S /F engines\*.ilk
253 -del /Q /S /F engines\*.lib
254 -del /Q /S /F apps\*.lib
255 -del /Q /S /F engines\*.manifest
256 -del /Q /S /F apps\*.manifest
257 -del /Q /S /F test\*.manifest
260 -del /Q /F configdata.pm
265 # Install helper targets #############################################
267 install_sw: all install_dev install_engines install_runtime
269 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
271 install_docs: install_html_docs
273 uninstall_docs: uninstall_html_docs
276 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs"
277 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private"
278 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc"
279 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
280 "$(OPENSSLDIR)\openssl.cnf.dist"
281 @IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \
282 "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
283 "$(OPENSSLDIR)\openssl.cnf"
284 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \
288 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
289 @echo *** Installing development files
290 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl"
291 @rem {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
292 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \
293 "$(INSTALLTOP)\include\openssl"
294 @rem {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
295 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\include\openssl\*.h" \
296 "$(INSTALLTOP)\include\openssl"
297 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\include\openssl\*.h \
298 "$(INSTALLTOP)\include\openssl"
299 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\$(LIBDIR)"
300 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) \
301 "$(INSTALLTOP)\$(LIBDIR)"
302 @if "$(SHLIBS)"=="" \
303 "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb \
304 "$(INSTALLTOP)\$(LIBDIR)"
309 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
310 @echo *** Installing engines
311 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)"
312 @if not "$(ENGINES)"=="" \
313 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)"
314 @if not "$(ENGINES)"=="" \
315 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)"
320 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
321 @echo *** Installing runtime files
322 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
323 @if not "$(SHLIBS)"=="" \
324 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin"
325 @if not "$(SHLIBS)"=="" \
326 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \
328 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
330 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
332 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \
338 "$(PERL)" "$(SRCDIR)\util\process_docs.pl" \
339 "--destdir=$(INSTALLTOP)\html" --type=html
343 # Building targets ###################################################
345 configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
346 @echo "Detected changed: $?"
347 @echo "Reconfiguring..."
348 "$(PERL)" "$(SRCDIR)\Configure" reconf
349 @echo "**************************************************"
351 @echo "*** Please run the same make command again ***"
353 @echo "**************************************************"
358 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
360 # Helper function to figure out dependencies on libraries
361 # It takes a list of library names and outputs a list of dependencies
362 sub compute_lib_depends {
363 if ($disabled{shared}) {
364 return map { $_.$libext } @_;
366 return map { shlib_import($_) } @_;
371 (my $target = $args{src}) =~ s/\.[sS]$/.asm/;
372 my ($gen0, @gens) = @{$args{generator}};
373 my $generator = '"'.$gen0.'"'.join('', map { " $_" } @gens);
374 my $generator_incs = join("", map { " -I \"$_\"" } @{$args{generator_incs}});
375 my $incs = join("", map { " /I \"$_\"" } @{$args{incs}});
376 my $deps = @{$args{deps}} ?
377 '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
379 if ($target !~ /\.asm$/) {
380 if ($args{generator}->[0] =~ m|^.*\.in$|) {
381 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
382 "util", "dofile.pl")),
383 rel2abs($config{builddir}));
385 $target: "$args{generator}->[0]" $deps
386 "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
387 "-o$target{build_file}" $generator > \$@
391 $target: "$args{generator}->[0]" $deps
392 "\$(PERL)"$generator_incs $generator > \$@
396 if ($args{generator}->[0] =~ /\.pl$/) {
397 $generator = '"$(PERL)"'.$generator_incs.' '.$generator;
398 } elsif ($args{generator}->[0] =~ /\.S$/) {
401 die "Generator type for $src unknown: $generator\n";
404 if (defined($generator)) {
405 # If the target is named foo.S in build.info, we want to
406 # end up generating foo.s in two steps.
407 if ($args{src} =~ /\.S$/) {
409 $target: "$args{generator}->[0]" $deps
412 \$(CC) $incs \$(CFLAGS) /EP /C \$@.S > \$@.i && move /Y \$@.i \$@
418 $target: "$args{generator}->[0]" $deps
424 $target: "$args{generator}->[0]" $deps
425 \$(CC) $incs \$(CFLAGS) /EP /C "$args{generator}->[0]" > \$@.i && move /Y \$@.i \$@
432 my $obj = $args{obj};
433 my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x
434 } ( @{$args{srcs}} );
435 my $srcs = '"'.join('" "', @srcs).'"';
436 my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"';
437 my $incs = join("", map { ' /I "'.$_.'"' } @{$args{incs}});
438 unless ($disabled{zlib}) {
439 if ($withargs{zlib_include}) {
440 $incs .= ' /I "'.$withargs{zlib_include}.'"';
443 my $ecflags = { lib => '$(LIB_CFLAGS)',
444 dso => '$(DSO_CFLAGS)',
445 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
446 my $makedepprog = $config{makedepprog};
447 if ($srcs[0] =~ /\.asm$/) {
450 \$(AS) \$(ASFLAGS) \$(ASOUTFLAG)\$\@ $srcs
453 return <<"EOF" if (!$disabled{makedepend});
455 \$(CC) \$(CFLAGS) $ecflags$inc /Zs /showIncludes $srcs 2>&1 | \\
456 "\$(PERL)" -n << > $obj$depext
458 s/^Note: including file: *//;
459 \$\$collect{\$\$_} = 1;
460 END { print '$obj$objext: ',join(" ", sort keys \%collect),"\\n" }
462 $obj$objext: $obj$depext
463 \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ $srcs
465 return <<"EOF" if ($disabled{makedepend});
467 \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ $srcs
471 # On Unix, we build shlibs from static libs, so we're ignoring the
472 # object file array. We *know* this routine is only called when we've
473 # configure 'shared'.
476 my $lib = $args{lib};
477 my $shlib = $args{shlib};
478 (my $mkdef_key = $lib) =~ s/^lib//i;
479 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
480 my $linklibs = join("",
481 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
483 (map { $_.$objext } @{$args{objs}}),
484 compute_lib_depends(@{$args{deps}}));
485 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
486 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
487 "util", "mkdef.pl")),
488 rel2abs($config{builddir}));
489 my $mkrc_pl = abs2rel(rel2abs(catfile($config{sourcedir},
491 rel2abs($config{builddir}));
492 my $target = shlib_import($lib);
494 $target: $deps "$ordinalsfile" "$mkdef_pl"
495 "\$(PERL)" "$mkdef_pl" "$mkdef_key" 32 > $shlib.def
496 "\$(PERL)" -i.tmp -pe "s|^LIBRARY\\s+${mkdef_key}32|LIBRARY $shlib|;" $shlib.def
498 "\$(PERL)" "$mkrc_pl" $shlib$shlibext > $shlib.rc
499 \$(RC) \$(RCOUTFLAG)$shlib.res $shlib.rc
500 IF EXIST $shlib$shlibext.manifest DEL /F /Q $shlib$shlibext.manifest
501 \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
502 /implib:\$@ \$(LDOUTFLAG)$shlib$shlibext /def:$shlib.def @<< || (DEL /Q \$(\@B).* $shlib.* && EXIT 1)
503 $objs $shlib.res$linklibs \$(EX_LIBS)
505 IF EXIST $shlib$shlibext.manifest \\
506 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$shlib$shlibext.manifest \$(MTOUTFLAG)$shlib$shlibext
507 IF EXIST apps\\$shlib$shlibext DEL /Q /F apps\\$shlib$shlibext
508 IF EXIST test\\$shlib$shlibext DEL /Q /F test\\$shlib$shlibext
509 IF EXIST fuzz\\$shlib$shlibext DEL /Q /F fuzz\\$shlib$shlibext
510 COPY $shlib$shlibext apps
511 COPY $shlib$shlibext test
512 COPY $shlib$shlibext fuzz
517 my $dso = $args{lib};
518 my $dso_n = basename($dso);
519 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
520 my $linklibs = join("",
521 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
523 (map { $_.$objext } @{$args{objs}}),
524 compute_lib_depends(@{$args{deps}}));
527 IF EXIST $dso$dsoext.manifest DEL /F /Q $dso$dsoext.manifest
528 \$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \$(LDOUTFLAG)$dso$dsoext /def:<< @<<
534 $objs$linklibs \$(EX_LIBS)
536 IF EXIST $dso$dsoext.manifest \\
537 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso$dsoext.manifest \$(MTOUTFLAG)$dso$dsoext
541 # Because static libs and import libs are both named the same in native
542 # Windows, we can't have both. We skip the static lib in that case,
543 # as the shared libs are what we use anyway.
544 return "" unless $disabled{"shared"};
547 my $lib = $args{lib};
548 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
549 my $deps = join(" ", map { $_.$objext } @{$args{objs}});
552 \$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib$libext @<<
559 my $bin = $args{bin};
560 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
561 my $linklibs = join("",
562 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
564 (map { $_.$objext } @{$args{objs}}),
565 compute_lib_depends(@{$args{deps}}));
568 IF EXIST $bin$exeext.manifest DEL /F /Q $bin$exeext.manifest
569 \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin$exeext @<<
570 $objs setargv.obj$linklibs \$(EX_LIBS)
572 IF EXIST $bin$exeext.manifest \\
573 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin$exeext.manifest \$(MTOUTFLAG)$bin$exeext
578 my $script = $args{script};
579 my $sources = '"'.join('" "', @{$args{sources}}).'"';
580 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
581 "util", "dofile.pl")),
582 rel2abs($config{builddir}));
585 "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
586 "-o$target{build_file}" $sources > "$script"
591 my $dir = $args{dir};
592 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
594 my %extinfo = ( dso => $dsoext,
598 foreach my $type (("dso", "lib", "bin", "script")) {
599 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
600 # For lib object files, we could update the library. However,
601 # LIB on Windows doesn't work that way, so we won't create any
602 # actions for it, and the dependencies are already taken care of.
603 if ($type ne "lib") {
604 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
605 if (dirname($prod) eq $dir) {
606 push @deps, $prod.$extinfo{$type};
608 push @actions, "\t@rem No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
614 my $deps = join(" ", @deps);
615 my $actions = join("\n", "", @actions);
617 $args{dir} $args{dir}\\ : $deps$actions
620 "" # Important! This becomes part of the template result.