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};
35 return () if $disabled{shared} || $lib =~ /\.a$/;
36 return () unless defined $unified_info{sharednames}->{$lib};
37 return $unified_info{sharednames}->{$lib} . $shlibext;
41 (my $lib = shift) =~ s/\.a$//;
42 return $lib . $libext;
47 return () if $disabled{shared} || $lib =~ /\.a$/;
48 return $lib . $shlibextimport;
54 return $dso . $dsoext;
56 # This makes sure things get built in the order they need
61 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
66 PLATFORM={- $config{target} -}
67 SRCDIR={- $config{sourcedir} -}
68 BLDDIR={- $config{builddir} -}
70 VERSION={- $config{version} -}
71 MAJOR={- $config{major} -}
72 MINOR={- $config{minor} -}
74 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
76 LIBS={- join(" ", map { lib($_) } @{$unified_info{libraries}}) -}
77 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
78 SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; shlib($_) } @{$unified_info{libraries}}) -}
79 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
80 ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; dso($_) } @{$unified_info{engines}}) -}
81 PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -}
82 PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -}
83 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
84 {- output_off() if $disabled{makedepend}; "" -}
85 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
86 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
87 keys %{$unified_info{sources}}); -}
88 {- output_on() if $disabled{makedepend}; "" -}
89 GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
90 GENERATED={- join(" ",
91 ( map { (my $x = $_) =~ s|\.[sS]$|\.asm|; $x }
92 grep { defined $unified_info{generate}->{$_} }
93 map { @{$unified_info{sources}->{$_}} }
94 grep { /\.o$/ } keys %{$unified_info{sources}} ),
95 ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
97 INSTALL_LIBS={- join(" ", map { lib($_) } @{$unified_info{install}->{libraries}}) -}
98 INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -}
99 INSTALL_SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; shlib($_) } @{$unified_info{install}->{libraries}}) -}
100 INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -}
101 INSTALL_ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; dso($_) } @{$unified_info{install}->{engines}}) -}
102 INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -}
103 INSTALL_PROGRAMPDBS={- join(" ", map { $_.".pdb" } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -}
104 {- output_off() if $disabled{apps}; "" -}
105 BIN_SCRIPTS=$(BLDDIR)\tools\c_rehash.pl
106 MISC_SCRIPTS=$(BLDDIR)\apps\CA.pl $(BLDDIR)\apps\tsget.pl
107 {- output_on() if $disabled{apps}; "" -}
109 # Do not edit these manually. Use Configure with --prefix or --openssldir
110 # to change this! Short explanation in the top comment in Configure
111 INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet
113 use File::Spec::Functions qw(:DEFAULT splitpath);
114 our $prefix = $config{prefix} || "$win_installroot\\OpenSSL";
115 our ($prefix_dev, $prefix_dir, $prefix_file) =
116 splitpath($prefix, 1);
118 INSTALLTOP_dir={- $prefix_dir -}
120 # The logic here is that if no --openssldir was given,
121 # OPENSSLDIR will get the value from $prefix plus "/ssl".
122 # If --openssldir was given and the value is an absolute
123 # path, OPENSSLDIR will get its value without change.
124 # If the value from --openssldir is a relative path,
125 # OPENSSLDIR will get $prefix with the --openssldir
126 # value appended as a subdirectory.
128 use File::Spec::Functions qw(:DEFAULT splitpath);
130 $config{openssldir} ?
131 (file_name_is_absolute($config{openssldir}) ?
133 : catdir($prefix, $config{openssldir}))
134 : "$win_commonroot\\SSL";
135 our ($openssldir_dev, $openssldir_dir, $openssldir_file) =
136 splitpath($openssldir, 1);
138 OPENSSLDIR_dir={- $openssldir_dir -}
139 LIBDIR={- our $libdir = $config{libdir} || "lib";
141 ENGINESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath);
142 our $enginesdir = catdir($prefix,$libdir,"engines-$sover");
143 our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) =
144 splitpath($enginesdir, 1);
146 ENGINESDIR_dir={- $enginesdir_dir -}
147 !IF "$(DESTDIR)" != ""
148 INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir)
149 OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir)
150 ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir)
152 INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir)
153 OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir)
154 ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
158 CFLAGS={- join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}})) -} {- join(" ", quotify_l("-DENGINESDIR=\"$enginesdir\"", "-DOPENSSLDIR=\"$openssldir\"")) -} {- $target{cflags} -} {- $config{cflags} -}
159 COUTFLAG={- $target{coutflag} || "/Fo" -}$(OSSL_EMPTY)
160 RC={- $target{rc} || "rc" -}
161 RCOUTFLAG={- $target{rcoutflag} || "/fo" -}$(OSSL_EMPTY)
162 LD={- $target{ld} || "link" -}
163 LDFLAGS={- $target{lflags} -}
164 LDOUTFLAG={- $target{loutflag} || "/out:" -}$(OSSL_EMPTY)
165 EX_LIBS={- $target{ex_libs} -}
166 LIB_CFLAGS={- join(" ", $target{lib_cflags}, $target{shared_cflag}) || "" -}
167 LIB_LDFLAGS={- $target{shared_ldflag} || "" -}
168 DSO_CFLAGS={- join(" ", $target{dso_cflags}, $target{shared_cflag}) || "" -}
169 DSO_LDFLAGS={- join(" ", $target{dso_lflags}, $target{shared_ldflag}) || "" -}
170 BIN_CFLAGS={- $target{bin_cflags} -}
171 BIN_LDFLAGS={- $target{bin_lflags} -}
173 PERL={- $config{perl} -}
176 ARFLAGS= {- $target{arflags} -}
177 AROUTFLAG={- $target{aroutflag} || "/out:" -}$(OSSL_EMPTY)
180 MTFLAGS= {- $target{mtflags} -}
181 MTINFLAG={- $target{mtinflag} || "-manifest " -}$(OSSL_EMPTY)
182 MTOUTFLAG={- $target{mtoutflag} || "-outputresource:" -}$(OSSL_EMPTY)
185 ASFLAGS={- $target{asflags} -}
186 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
187 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
189 PROCESSOR= {- $config{processor} -}
191 # The main targets ###################################################
193 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep
194 {- dependmagic('build_libs'); -}: build_libs_nodep
195 {- dependmagic('build_engines'); -}: build_engines_nodep
196 {- dependmagic('build_programs'); -}: build_programs_nodep
198 build_generated: $(GENERATED_MANDATORY)
199 build_libs_nodep: $(LIBS) {- join(" ",map { shlib_import($_) } @{$unified_info{libraries}}) -}
200 build_engines_nodep: $(ENGINES)
201 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
203 # Kept around for backward compatibility
204 build_apps build_tests: build_programs
207 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep
208 @rem {- output_off() if $disabled{tests}; "" -}
212 set OPENSSL_DEBUG_MEMORY=on
213 "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
214 @rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
215 @echo "Tests are not supported with your chosen Configure options"
216 @rem {- output_on() if !$disabled{tests}; "" -}
219 @rem {- output_off() if $disabled{tests}; "" -}
220 @set SRCTOP=$(SRCDIR)
221 @"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list
222 @rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
223 @echo "Tests are not supported with your chosen Configure options"
224 @rem {- output_on() if !$disabled{tests}; "" -}
226 install: install_sw install_ssldirs install_docs
228 uninstall: uninstall_docs uninstall_sw
231 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """$$1.*"""; } @ARGV" $(SHLIBS)
232 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """apps/$$1.*"""; } @ARGV" $(SHLIBS)
233 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """test/$$1.*"""; } @ARGV" $(SHLIBS)
235 -del /Q ossl_static.pdb
238 -del /Q /F $(PROGRAMS) $(ENGINES) $(SCRIPTS)
239 -del /Q /F $(GENERATED)
244 -del /Q /S /F engines\*.ilk
245 -del /Q /S /F engines\*.lib
246 -del /Q /S /F apps\*.lib
247 -del /Q /S /F engines\*.manifest
248 -del /Q /S /F apps\*.manifest
249 -del /Q /S /F test\*.manifest
252 -del /Q /F configdata.pm
257 # Install helper targets #############################################
259 install_sw: all install_dev install_engines install_runtime
261 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
263 install_docs: install_html_docs
265 uninstall_docs: uninstall_html_docs
268 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs"
269 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private"
270 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc"
271 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
272 "$(OPENSSLDIR)\openssl.cnf.dist"
273 @IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \
274 "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
275 "$(OPENSSLDIR)\openssl.cnf"
276 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \
278 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
279 "$(OPENSSLDIR)\ct_log_list.cnf.dist"
280 @IF NOT EXIST "$(OPENSSLDIR)\ct_log_list.cnf" \
281 "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
282 "$(OPENSSLDIR)\ct_log_list.cnf"
285 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
286 @echo *** Installing development files
287 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl"
288 @rem {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
289 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \
290 "$(INSTALLTOP)\include\openssl"
291 @rem {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
292 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\include\openssl\*.h" \
293 "$(INSTALLTOP)\include\openssl"
294 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\include\openssl\*.h \
295 "$(INSTALLTOP)\include\openssl"
296 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\$(LIBDIR)"
297 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) \
298 "$(INSTALLTOP)\$(LIBDIR)"
299 @if "$(SHLIBS)"=="" \
300 "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb \
301 "$(INSTALLTOP)\$(LIBDIR)"
306 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
307 @echo *** Installing engines
308 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)"
309 @if not "$(ENGINES)"=="" \
310 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)"
311 @if not "$(ENGINES)"=="" \
312 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)"
317 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
318 @echo *** Installing runtime files
319 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
320 @if not "$(SHLIBS)"=="" \
321 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin"
322 @if not "$(SHLIBS)"=="" \
323 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \
325 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
327 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
329 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \
335 "$(PERL)" "$(SRCDIR)\util\process_docs.pl" \
336 "--destdir=$(INSTALLTOP)\html" --type=html
340 # Building targets ###################################################
342 configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
343 @echo "Detected changed: $?"
344 @echo "Reconfiguring..."
345 "$(PERL)" "$(SRCDIR)\Configure" reconf
346 @echo "**************************************************"
348 @echo "*** Please run the same make command again ***"
350 @echo "**************************************************"
355 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
357 # Helper function to figure out dependencies on libraries
358 # It takes a list of library names and outputs a list of dependencies
359 sub compute_lib_depends {
360 if ($disabled{shared}) {
361 return map { lib($_) } @_;
364 (my $l = $_) =~ s/\.a$//;
365 die "Linking with static variants of shared libraries is not supported in this configuration\n"
366 if $l ne $_ && shlib($l);
368 return map { shlib_import($_) or lib($_) } @_;
373 (my $target = $args{src}) =~ s/\.[sS]$/.asm/;
374 my $generator = '"'.join('" "', @{$args{generator}}).'"';
375 my $generator_incs = join("", map { " -I \"$_\"" } @{$args{generator_incs}});
376 my $incs = join("", map { " /I \"$_\"" } @{$args{incs}});
377 my $deps = @{$args{deps}} ?
378 '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
380 if ($target !~ /\.asm$/) {
381 if ($args{generator}->[0] =~ m|^.*\.in$|) {
382 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
383 "util", "dofile.pl")),
384 rel2abs($config{builddir}));
386 $target: "$args{generator}->[0]" $deps
387 "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
388 "-o$target{build_file}" $generator > \$@
392 $target: "$args{generator}->[0]" $deps
393 "\$(PERL)"$generator_incs $generator > \$@
397 if ($args{generator}->[0] =~ /\.pl$/) {
398 $generator = '"$(PERL)"'.$generator_incs.' '.$generator;
399 } elsif ($args{generator}->[0] =~ /\.S$/) {
402 die "Generator type for $src unknown: $generator\n";
405 if (defined($generator)) {
406 # If the target is named foo.S in build.info, we want to
407 # end up generating foo.s in two steps.
408 if ($args{src} =~ /\.S$/) {
410 $target: "$args{generator}->[0]" $deps
413 \$(CC) $incs \$(CFLAGS) /EP /C \$@.S > \$@.i && move /Y \$@.i \$@
419 $target: "$args{generator}->[0]" $deps
425 $target: "$args{generator}->[0]" $deps
426 \$(CC) $incs \$(CFLAGS) /EP /C "$args{generator}->[0]" > \$@.i && move /Y \$@.i \$@
433 my $obj = $args{obj};
434 my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x
435 } ( @{$args{srcs}} );
436 my $srcs = '"'.join('" "', @srcs).'"';
437 my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"';
438 my $incs = join("", map { ' /I "'.$_.'"' } @{$args{incs}});
439 unless ($disabled{zlib}) {
440 if ($withargs{zlib_include}) {
441 $incs .= ' /I "'.$withargs{zlib_include}.'"';
444 my $ecflags = { lib => '$(LIB_CFLAGS)',
445 dso => '$(DSO_CFLAGS)',
446 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
447 my $makedepprog = $config{makedepprog};
448 if ($srcs[0] =~ /\.asm$/) {
451 \$(AS) \$(ASFLAGS) \$(ASOUTFLAG)\$\@ $srcs
454 return <<"EOF" if (!$disabled{makedepend});
456 \$(CC) \$(CFLAGS) $ecflags$inc /Zs /showIncludes $srcs 2>&1 | \\
457 "\$(PERL)" -n << > $obj$depext
459 s/^Note: including file: *//;
460 \$\$collect{\$\$_} = 1;
461 END { print '$obj$objext: ',join(" ", sort keys \%collect),"\\n" }
463 $obj$objext: $obj$depext
464 \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ @<<
468 return <<"EOF" if ($disabled{makedepend});
470 \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ $srcs
474 # On Unix, we build shlibs from static libs, so we're ignoring the
475 # object file array. We *know* this routine is only called when we've
476 # configure 'shared'.
479 my $lib = $args{lib};
480 my $shlib = $args{shlib};
481 (my $mkdef_key = $lib) =~ s/^lib//i;
482 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
483 my $linklibs = join("",
484 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
486 (map { $_.$objext } @{$args{objs}}),
487 compute_lib_depends(@{$args{deps}}));
488 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
489 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
490 "util", "mkdef.pl")),
491 rel2abs($config{builddir}));
492 my $mkrc_pl = abs2rel(rel2abs(catfile($config{sourcedir},
494 rel2abs($config{builddir}));
495 my $target = shlib_import($lib);
497 $target: $deps "$ordinalsfile" "$mkdef_pl"
498 "\$(PERL)" "$mkdef_pl" "$mkdef_key" 32 > $shlib.def
499 "\$(PERL)" -i.tmp -pe "s|^LIBRARY\\s+${mkdef_key}32|LIBRARY $shlib|;" $shlib.def
501 "\$(PERL)" "$mkrc_pl" $shlib$shlibext > $shlib.rc
502 \$(RC) \$(RCOUTFLAG)$shlib.res $shlib.rc
503 IF EXIST $shlib$shlibext.manifest DEL /F /Q $shlib$shlibext.manifest
504 \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
505 /implib:\$@ \$(LDOUTFLAG)$shlib$shlibext /def:$shlib.def @<< || (DEL /Q \$(\@B).* $shlib.* && EXIT 1)
506 $objs $shlib.res$linklibs \$(EX_LIBS)
508 IF EXIST $shlib$shlibext.manifest \\
509 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$shlib$shlibext.manifest \$(MTOUTFLAG)$shlib$shlibext
510 IF EXIST apps\\$shlib$shlibext DEL /Q /F apps\\$shlib$shlibext
511 IF EXIST test\\$shlib$shlibext DEL /Q /F test\\$shlib$shlibext
512 COPY $shlib$shlibext apps
513 COPY $shlib$shlibext test
518 my $dso = $args{lib};
519 my $dso_n = basename($dso);
520 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
521 my $linklibs = join("",
522 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
524 (map { $_.$objext } @{$args{objs}}),
525 compute_lib_depends(@{$args{deps}}));
528 IF EXIST $dso$dsoext.manifest DEL /F /Q $dso$dsoext.manifest
529 \$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \$(LDOUTFLAG)$dso$dsoext /def:<< @<<
535 $objs$linklibs \$(EX_LIBS)
537 IF EXIST $dso$dsoext.manifest \\
538 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso$dsoext.manifest \$(MTOUTFLAG)$dso$dsoext
543 my $lib = $args{lib};
545 # Because static libs and import libs are both named the same in native
546 # Windows, we can't have both. We skip the static lib in that case,
547 # as the shared libs are what we use anyway.
548 return "" unless $disabled{"shared"} || $lib =~ /\.a$/;
551 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
552 my $deps = join(" ", map { $_.$objext } @{$args{objs}});
555 \$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib$libext @<<
562 my $bin = $args{bin};
563 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
564 my $linklibs = join("",
565 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
567 (map { $_.$objext } @{$args{objs}}),
568 compute_lib_depends(@{$args{deps}}));
571 IF EXIST $bin$exeext.manifest DEL /F /Q $bin$exeext.manifest
572 \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin$exeext @<<
573 $objs setargv.obj$linklibs \$(EX_LIBS)
575 IF EXIST $bin$exeext.manifest \\
576 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin$exeext.manifest \$(MTOUTFLAG)$bin$exeext
581 my $script = $args{script};
582 my $sources = '"'.join('" "', @{$args{sources}}).'"';
583 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
584 "util", "dofile.pl")),
585 rel2abs($config{builddir}));
588 "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
589 "-o$target{build_file}" $sources > "$script"
594 my $dir = $args{dir};
595 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
597 my %extinfo = ( dso => $dsoext,
601 foreach my $type (("dso", "lib", "bin", "script")) {
602 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
603 # For lib object files, we could update the library. However,
604 # LIB on Windows doesn't work that way, so we won't create any
605 # actions for it, and the dependencies are already taken care of.
606 if ($type ne "lib") {
607 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
608 if (dirname($prod) eq $dir) {
609 push @deps, $prod.$extinfo{$type};
611 push @actions, "\t@rem No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
617 my $deps = join(" ", @deps);
618 my $actions = join("\n", "", @actions);
620 $args{dir} $args{dir}\\ : $deps$actions
623 "" # Important! This becomes part of the template result.