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_dirname = $config{shlib_version_number}) =~ s|\.|_|g;
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={- our @PROGRAMS = map { $_.$exeext } @{$unified_info{programs}}; join(" ", @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 APPS_OPENSSL={- use File::Spec::Functions;
110 catfile("apps","openssl") -}
112 # Do not edit these manually. Use Configure with --prefix or --openssldir
113 # to change this! Short explanation in the top comment in Configure
114 INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet
116 use File::Spec::Functions qw(:DEFAULT splitpath);
117 our $prefix = $config{prefix} || "$win_installroot\\OpenSSL";
118 our ($prefix_dev, $prefix_dir, $prefix_file) =
119 splitpath($prefix, 1);
121 INSTALLTOP_dir={- $prefix_dir -}
123 # The logic here is that if no --openssldir was given,
124 # OPENSSLDIR will get the value "$win_commonroot\\SSL".
125 # If --openssldir was given and the value is an absolute
126 # path, OPENSSLDIR will get its value without change.
127 # If the value from --openssldir is a relative path,
128 # OPENSSLDIR will get $prefix with the --openssldir
129 # value appended as a subdirectory.
131 use File::Spec::Functions qw(:DEFAULT splitpath);
133 $config{openssldir} ?
134 (file_name_is_absolute($config{openssldir}) ?
136 : catdir($prefix, $config{openssldir}))
137 : "$win_commonroot\\SSL";
138 our ($openssldir_dev, $openssldir_dir, $openssldir_file) =
139 splitpath($openssldir, 1);
141 OPENSSLDIR_dir={- $openssldir_dir -}
142 LIBDIR={- our $libdir = $config{libdir} || "lib";
144 ENGINESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath);
145 our $enginesdir = catdir($prefix,$libdir,"engines-$sover_dirname");
146 our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) =
147 splitpath($enginesdir, 1);
149 ENGINESDIR_dir={- $enginesdir_dir -}
150 !IF "$(DESTDIR)" != ""
151 INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir)
152 OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir)
153 ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir)
155 INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir)
156 OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir)
157 ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
161 CFLAGS={- join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}})) -} {- join(" ", quotify_l("-DENGINESDIR=\"$enginesdir\"", "-DOPENSSLDIR=\"$openssldir\"")) -} {- $target{cflags} -} {- $config{cflags} -}
162 COUTFLAG={- $target{coutflag} || "/Fo" -}$(OSSL_EMPTY)
163 RC={- $target{rc} || "rc" -}
164 RCOUTFLAG={- $target{rcoutflag} || "/fo" -}$(OSSL_EMPTY)
165 LD={- $target{ld} || "link" -}
166 LDFLAGS={- $target{lflags} -}
167 LDOUTFLAG={- $target{loutflag} || "/out:" -}$(OSSL_EMPTY)
168 EX_LIBS={- $target{ex_libs} -}
169 LIB_CFLAGS={- join(" ", $target{lib_cflags}, $target{shared_cflag}) || "" -}
170 LIB_LDFLAGS={- $target{shared_ldflag} || "" -}
171 DSO_CFLAGS={- join(" ", $target{dso_cflags}, $target{shared_cflag}) || "" -}
172 DSO_LDFLAGS={- join(" ", $target{dso_lflags}, $target{shared_ldflag}) || "" -}
173 BIN_CFLAGS={- $target{bin_cflags} -}
174 BIN_LDFLAGS={- $target{bin_lflags} -}
176 PERL={- $config{perl} -}
179 ARFLAGS= {- $target{arflags} -}
180 AROUTFLAG={- $target{aroutflag} || "/out:" -}$(OSSL_EMPTY)
183 MTFLAGS= {- $target{mtflags} -}
184 MTINFLAG={- $target{mtinflag} || "-manifest " -}$(OSSL_EMPTY)
185 MTOUTFLAG={- $target{mtoutflag} || "-outputresource:" -}$(OSSL_EMPTY)
188 ASFLAGS={- $target{asflags} -}
189 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
190 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
192 PROCESSOR= {- $config{processor} -}
194 # The main targets ###################################################
196 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep
197 {- dependmagic('build_libs'); -}: build_libs_nodep
198 {- dependmagic('build_engines'); -}: build_engines_nodep
199 {- dependmagic('build_programs'); -}: build_programs_nodep
201 build_generated: $(GENERATED_MANDATORY)
202 build_libs_nodep: $(LIBS) {- join(" ",map { shlib_import($_) } @{$unified_info{libraries}}) -}
203 build_engines_nodep: $(ENGINES)
204 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
206 # Kept around for backward compatibility
207 build_apps build_tests: build_programs
209 # Convenience target to prebuild all generated files, not just the mandatory
211 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
214 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep
215 @rem {- output_off() if $disabled{tests}; "" -}
219 set OPENSSL_DEBUG_MEMORY=on
220 "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
221 @rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
222 @echo "Tests are not supported with your chosen Configure options"
223 @rem {- output_on() if !$disabled{tests}; "" -}
226 @rem {- output_off() if $disabled{tests}; "" -}
227 @set SRCTOP=$(SRCDIR)
228 @"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list
229 @rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
230 @echo "Tests are not supported with your chosen Configure options"
231 @rem {- output_on() if !$disabled{tests}; "" -}
233 install: install_sw install_ssldirs install_docs
235 uninstall: uninstall_docs uninstall_sw
238 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """$$1.*"""; } @ARGV" $(SHLIBS)
239 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """apps/$$1.*"""; } @ARGV" $(SHLIBS)
240 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """test/$$1.*"""; } @ARGV" $(SHLIBS)
241 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """fuzz/$$1.*"""; } @ARGV" $(SHLIBS)
243 -del /Q ossl_static.pdb
246 {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -}
247 -del /Q /F $(ENGINES)
248 -del /Q /F $(SCRIPTS)
249 -del /Q /F $(GENERATED)
254 -del /Q /F apps\*.exp
255 -del /Q /F engines\*.exp
256 -del /Q /S /F engines\*.ilk
257 -del /Q /S /F engines\*.lib
258 -del /Q /S /F apps\*.lib
259 -del /Q /S /F engines\*.manifest
260 -del /Q /S /F apps\*.manifest
261 -del /Q /S /F test\*.manifest
264 -del /Q /F configdata.pm
269 # Install helper targets #############################################
271 install_sw: all install_dev install_engines install_runtime
273 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
275 install_docs: install_html_docs
277 uninstall_docs: uninstall_html_docs
280 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs"
281 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private"
282 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc"
283 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
284 "$(OPENSSLDIR)\openssl.cnf.dist"
285 @IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \
286 "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
287 "$(OPENSSLDIR)\openssl.cnf"
288 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \
290 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
291 "$(OPENSSLDIR)\ct_log_list.cnf.dist"
292 @IF NOT EXIST "$(OPENSSLDIR)\ct_log_list.cnf" \
293 "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
294 "$(OPENSSLDIR)\ct_log_list.cnf"
297 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
298 @echo *** Installing development files
299 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl"
300 @rem {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
301 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \
302 "$(INSTALLTOP)\include\openssl"
303 @rem {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
304 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\include\openssl\*.h" \
305 "$(INSTALLTOP)\include\openssl"
306 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\include\openssl\*.h \
307 "$(INSTALLTOP)\include\openssl"
308 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\$(LIBDIR)"
309 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) \
310 "$(INSTALLTOP)\$(LIBDIR)"
311 @if "$(SHLIBS)"=="" \
312 "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb \
313 "$(INSTALLTOP)\$(LIBDIR)"
318 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
319 @echo *** Installing engines
320 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)"
321 @if not "$(ENGINES)"=="" \
322 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)"
323 @if not "$(ENGINES)"=="" \
324 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)"
329 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
330 @echo *** Installing runtime files
331 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
332 @if not "$(SHLIBS)"=="" \
333 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin"
334 @if not "$(SHLIBS)"=="" \
335 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \
337 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
339 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
341 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \
347 "$(PERL)" "$(SRCDIR)\util\process_docs.pl" \
348 "--destdir=$(INSTALLTOP)\html" --type=html
352 # Building targets ###################################################
354 configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
355 @echo "Detected changed: $?"
356 @echo "Reconfiguring..."
357 "$(PERL)" "$(SRCDIR)\Configure" reconf
358 @echo "**************************************************"
360 @echo "*** Please run the same make command again ***"
362 @echo "**************************************************"
367 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
369 # Helper function to figure out dependencies on libraries
370 # It takes a list of library names and outputs a list of dependencies
371 sub compute_lib_depends {
372 if ($disabled{shared}) {
373 return map { lib($_) } @_;
376 (my $l = $_) =~ s/\.a$//;
377 die "Linking with static variants of shared libraries is not supported in this configuration\n"
378 if $l ne $_ && shlib($l);
380 return map { shlib_import($_) or lib($_) } @_;
385 (my $target = $args{src}) =~ s/\.[sS]$/.asm/;
386 my $generator = '"'.join('" "', @{$args{generator}}).'"';
387 my $generator_incs = join("", map { " -I \"$_\"" } @{$args{generator_incs}});
388 my $incs = join("", map { " /I \"$_\"" } @{$args{incs}});
389 my $deps = @{$args{deps}} ?
390 '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
392 if ($target !~ /\.asm$/) {
393 if ($args{generator}->[0] =~ m|^.*\.in$|) {
394 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
395 "util", "dofile.pl")),
396 rel2abs($config{builddir}));
398 $target: "$args{generator}->[0]" $deps
399 "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
400 "-o$target{build_file}" $generator > \$@
404 $target: "$args{generator}->[0]" $deps
405 "\$(PERL)"$generator_incs $generator > \$@
409 if ($args{generator}->[0] =~ /\.pl$/) {
410 $generator = '"$(PERL)"'.$generator_incs.' '.$generator;
411 } elsif ($args{generator}->[0] =~ /\.S$/) {
414 die "Generator type for $src unknown: $generator\n";
417 if (defined($generator)) {
418 # If the target is named foo.S in build.info, we want to
419 # end up generating foo.s in two steps.
420 if ($args{src} =~ /\.S$/) {
422 $target: "$args{generator}->[0]" $deps
425 \$(CC) $incs \$(CFLAGS) /EP /C \$@.S > \$@.i && move /Y \$@.i \$@
431 $target: "$args{generator}->[0]" $deps
437 $target: "$args{generator}->[0]" $deps
438 \$(CC) $incs \$(CFLAGS) /EP /C "$args{generator}->[0]" > \$@.i && move /Y \$@.i \$@
445 my $obj = $args{obj};
446 my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x
447 } ( @{$args{srcs}} );
448 my $srcs = '"'.join('" "', @srcs).'"';
449 my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"';
450 my $incs = join("", map { ' /I "'.$_.'"' } @{$args{incs}});
451 unless ($disabled{zlib}) {
452 if ($withargs{zlib_include}) {
453 $incs .= ' /I "'.$withargs{zlib_include}.'"';
456 my $ecflags = { lib => '$(LIB_CFLAGS)',
457 dso => '$(DSO_CFLAGS)',
458 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
459 my $makedepprog = $config{makedepprog};
460 if ($srcs[0] =~ /\.asm$/) {
463 \$(AS) \$(ASFLAGS) \$(ASOUTFLAG)\$\@ $srcs
466 return <<"EOF" if (!$disabled{makedepend});
468 \$(CC) \$(CFLAGS) $ecflags$inc /Zs /showIncludes $srcs 2>&1 | \\
469 "\$(PERL)" -n << > $obj$depext
471 s/^Note: including file: *//;
472 \$\$collect{\$\$_} = 1;
473 END { print '$obj$objext: ',join(" ", sort keys \%collect),"\\n" }
475 $obj$objext: $obj$depext
476 \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ @<<
480 return <<"EOF" if ($disabled{makedepend});
482 \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ $srcs
486 # On Unix, we build shlibs from static libs, so we're ignoring the
487 # object file array. We *know* this routine is only called when we've
488 # configure 'shared'.
491 my $lib = $args{lib};
492 my $shlib = $args{shlib};
493 (my $mkdef_key = $lib) =~ s/^lib//i;
494 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
495 my $linklibs = join("",
496 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
498 (map { $_.$objext } @{$args{objs}}),
499 compute_lib_depends(@{$args{deps}}));
500 my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
501 my $mkdef_pl = abs2rel(rel2abs(catfile($config{sourcedir},
502 "util", "mkdef.pl")),
503 rel2abs($config{builddir}));
504 my $mkrc_pl = abs2rel(rel2abs(catfile($config{sourcedir},
506 rel2abs($config{builddir}));
507 my $target = shlib_import($lib);
509 $target: $deps "$ordinalsfile" "$mkdef_pl"
510 "\$(PERL)" "$mkdef_pl" "$mkdef_key" 32 > $shlib.def
511 "\$(PERL)" -i.tmp -pe "s|^LIBRARY\\s+${mkdef_key}32|LIBRARY $shlib|;" $shlib.def
513 "\$(PERL)" "$mkrc_pl" $shlib$shlibext > $shlib.rc
514 \$(RC) \$(RCOUTFLAG)$shlib.res $shlib.rc
515 IF EXIST $shlib$shlibext.manifest DEL /F /Q $shlib$shlibext.manifest
516 \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
517 /implib:\$@ \$(LDOUTFLAG)$shlib$shlibext /def:$shlib.def @<< || (DEL /Q \$(\@B).* $shlib.* && EXIT 1)
518 $objs $shlib.res$linklibs \$(EX_LIBS)
520 IF EXIST $shlib$shlibext.manifest \\
521 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$shlib$shlibext.manifest \$(MTOUTFLAG)$shlib$shlibext
522 IF EXIST apps\\$shlib$shlibext DEL /Q /F apps\\$shlib$shlibext
523 IF EXIST test\\$shlib$shlibext DEL /Q /F test\\$shlib$shlibext
524 IF EXIST fuzz\\$shlib$shlibext DEL /Q /F fuzz\\$shlib$shlibext
525 COPY $shlib$shlibext apps
526 COPY $shlib$shlibext test
527 COPY $shlib$shlibext fuzz
532 my $dso = $args{lib};
533 my $dso_n = basename($dso);
534 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
535 my $linklibs = join("",
536 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
538 (map { $_.$objext } @{$args{objs}}),
539 compute_lib_depends(@{$args{deps}}));
542 IF EXIST $dso$dsoext.manifest DEL /F /Q $dso$dsoext.manifest
543 \$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \$(LDOUTFLAG)$dso$dsoext /def:<< @<<
549 $objs$linklibs \$(EX_LIBS)
551 IF EXIST $dso$dsoext.manifest \\
552 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso$dsoext.manifest \$(MTOUTFLAG)$dso$dsoext
557 my $lib = $args{lib};
559 # Because static libs and import libs are both named the same in native
560 # Windows, we can't have both. We skip the static lib in that case,
561 # as the shared libs are what we use anyway.
562 return "" unless $disabled{"shared"} || $lib =~ /\.a$/;
565 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
566 my $deps = join(" ", map { $_.$objext } @{$args{objs}});
569 \$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib$libext @<<
576 my $bin = $args{bin};
577 my $objs = join("\n", map { $_.$objext } @{$args{objs}});
578 my $linklibs = join("",
579 map { "\n$_" } compute_lib_depends(@{$args{deps}}));
581 (map { $_.$objext } @{$args{objs}}),
582 compute_lib_depends(@{$args{deps}}));
585 IF EXIST $bin$exeext.manifest DEL /F /Q $bin$exeext.manifest
586 \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin$exeext @<<
587 $objs setargv.obj$linklibs \$(EX_LIBS)
589 IF EXIST $bin$exeext.manifest \\
590 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin$exeext.manifest \$(MTOUTFLAG)$bin$exeext
595 my $script = $args{script};
596 my $sources = '"'.join('" "', @{$args{sources}}).'"';
597 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
598 "util", "dofile.pl")),
599 rel2abs($config{builddir}));
602 "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
603 "-o$target{build_file}" $sources > "$script"
608 my $dir = $args{dir};
609 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
611 my %extinfo = ( dso => $dsoext,
615 foreach my $type (("dso", "lib", "bin", "script")) {
616 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
617 # For lib object files, we could update the library. However,
618 # LIB on Windows doesn't work that way, so we won't create any
619 # actions for it, and the dependencies are already taken care of.
620 if ($type ne "lib") {
621 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
622 if (dirname($prod) eq $dir) {
623 push @deps, $prod.$extinfo{$type};
625 push @actions, "\t@rem No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
631 my $deps = join(" ", @deps);
632 my $actions = join("\n", "", @actions);
634 $args{dir} $args{dir}\\ : $deps$actions
637 "" # Important! This becomes part of the template result.