2 ## Makefile for OpenSSL
4 ## {- join("\n## ", @autowarntext) -}
6 our $objext = $target{obj_extension} || ".obj";
7 our $resext = $target{res_extension} || ".res";
8 our $depext = $target{dep_extension} || ".d";
9 our $exeext = $target{exe_extension} || ".exe";
10 our $libext = $target{lib_extension} || ".lib";
11 our $shlibext = $target{shared_extension} || ".dll";
12 our $shlibextimport = $target{shared_import_extension} || ".lib";
13 our $dsoext = $target{dso_extension} || ".dll";
15 (our $sover_dirname = $config{shlib_version_number}) =~ s|\.|_|g;
18 $target{build_scheme}->[2] eq "VC-W32" ?
19 "ProgramFiles(x86)" : "ProgramW6432";
21 $target{build_scheme}->[2] eq "VC-W32"
22 ? "CommonProgramFiles(x86)" : "CommonProgramW6432";
23 our $win_installroot =
24 defined($ENV{$win_installenv})
25 ? $win_installenv : 'ProgramFiles';
27 defined($ENV{$win_commonenv})
28 ? $win_commonenv : 'CommonProgramFiles';
30 # expand variables early
31 $win_installroot = $ENV{$win_installroot};
32 $win_commonroot = $ENV{$win_commonroot};
36 return () if $disabled{shared} || $lib =~ /\.a$/;
37 return () unless defined $unified_info{sharednames}->{$lib};
38 return $unified_info{sharednames}->{$lib} . $shlibext;
42 (my $lib = shift) =~ s/\.a$//;
43 return $lib . $libext;
48 return () if $disabled{shared} || $lib =~ /\.a$/;
49 return $lib . $shlibextimport;
55 return $dso . $dsoext;
57 # This makes sure things get built in the order they need
62 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
67 PLATFORM={- $config{target} -}
68 SRCDIR={- $config{sourcedir} -}
69 BLDDIR={- $config{builddir} -}
71 VERSION={- $config{version} -}
72 MAJOR={- $config{major} -}
73 MINOR={- $config{minor} -}
75 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
77 LIBS={- join(" ", map { lib($_) } @{$unified_info{libraries}}) -}
78 SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
79 SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; shlib($_) } @{$unified_info{libraries}}) -}
80 ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
81 ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; dso($_) } @{$unified_info{engines}}) -}
82 PROGRAMS={- our @PROGRAMS = map { $_.$exeext } @{$unified_info{programs}}; join(" ", @PROGRAMS) -}
83 PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -}
84 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
85 {- output_off() if $disabled{makedepend}; "" -}
86 DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; }
87 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ }
88 keys %{$unified_info{sources}}); -}
89 {- output_on() if $disabled{makedepend}; "" -}
90 GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -}
91 GENERATED={- join(" ",
92 ( map { (my $x = $_) =~ s|\.[sS]$|\.asm|; $x }
93 grep { defined $unified_info{generate}->{$_} }
94 map { @{$unified_info{sources}->{$_}} }
95 grep { /\.o$/ } keys %{$unified_info{sources}} ),
96 ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -}
98 INSTALL_LIBS={- join(" ", map { lib($_) } @{$unified_info{install}->{libraries}}) -}
99 INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -}
100 INSTALL_SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; shlib($_) } @{$unified_info{install}->{libraries}}) -}
101 INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -}
102 INSTALL_ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; dso($_) } @{$unified_info{install}->{engines}}) -}
103 INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -}
104 INSTALL_PROGRAMPDBS={- join(" ", map { $_.".pdb" } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -}
105 {- output_off() if $disabled{apps}; "" -}
106 BIN_SCRIPTS=$(BLDDIR)\tools\c_rehash.pl
107 MISC_SCRIPTS=$(BLDDIR)\apps\CA.pl $(BLDDIR)\apps\tsget.pl
108 {- output_on() if $disabled{apps}; "" -}
110 APPS_OPENSSL={- use File::Spec::Functions;
111 catfile("apps","openssl") -}
113 # Do not edit these manually. Use Configure with --prefix or --openssldir
114 # to change this! Short explanation in the top comment in Configure
115 INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet
117 use File::Spec::Functions qw(:DEFAULT splitpath);
118 our $prefix = canonpath($config{prefix}
119 || "$win_installroot\\OpenSSL");
120 our ($prefix_dev, $prefix_dir, $prefix_file) =
121 splitpath($prefix, 1);
123 INSTALLTOP_dir={- canonpath($prefix_dir) -}
125 # The logic here is that if no --openssldir was given,
126 # OPENSSLDIR will get the value "$win_commonroot\\SSL".
127 # If --openssldir was given and the value is an absolute
128 # path, OPENSSLDIR will get its value without change.
129 # If the value from --openssldir is a relative path,
130 # OPENSSLDIR will get $prefix with the --openssldir
131 # value appended as a subdirectory.
133 use File::Spec::Functions qw(:DEFAULT splitpath);
135 $config{openssldir} ?
136 (file_name_is_absolute($config{openssldir}) ?
137 canonpath($config{openssldir})
138 : catdir($prefix, $config{openssldir}))
139 : canonpath("$win_commonroot\\SSL");
140 our ($openssldir_dev, $openssldir_dir, $openssldir_file) =
141 splitpath($openssldir, 1);
143 OPENSSLDIR_dir={- canonpath($openssldir_dir) -}
144 LIBDIR={- our $libdir = $config{libdir} || "lib";
146 ENGINESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath);
147 our $enginesdir = catdir($prefix,$libdir,"engines-$sover_dirname");
148 our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) =
149 splitpath($enginesdir, 1);
151 ENGINESDIR_dir={- canonpath($enginesdir_dir) -}
152 !IF "$(DESTDIR)" != ""
153 INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir)
154 OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir)
155 ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir)
157 INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir)
158 OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir)
159 ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir)
163 CFLAGS={- join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}})) -} {- join(" ", quotify_l("-DENGINESDIR=\"$enginesdir\"", "-DOPENSSLDIR=\"$openssldir\"")) -} {- $target{cflags} -} {- $config{cflags} -}
164 COUTFLAG={- $target{coutflag} || "/Fo" -}$(OSSL_EMPTY)
165 RC={- $target{rc} || "rc" -}
166 RCOUTFLAG={- $target{rcoutflag} || "/fo" -}$(OSSL_EMPTY)
167 LD={- $target{ld} || "link" -}
168 LDFLAGS={- $target{lflags} -}
169 LDOUTFLAG={- $target{loutflag} || "/out:" -}$(OSSL_EMPTY)
170 EX_LIBS={- $target{ex_libs} -}
171 LIB_CFLAGS={- join(" ", $target{lib_cflags}, $target{shared_cflag}) || "" -}
172 LIB_LDFLAGS={- $target{shared_ldflag} || "" -}
173 DSO_CFLAGS={- $target{dso_cflags} || "" -}
174 DSO_LDFLAGS={- $target{dso_ldflag} || "" -}
175 BIN_CFLAGS={- $target{bin_cflags} -}
176 BIN_LDFLAGS={- $target{bin_lflags} -}
178 PERL={- $config{perl} -}
181 ARFLAGS= {- $target{arflags} -}
182 AROUTFLAG={- $target{aroutflag} || "/out:" -}$(OSSL_EMPTY)
185 MTFLAGS= {- $target{mtflags} -}
186 MTINFLAG={- $target{mtinflag} || "-manifest " -}$(OSSL_EMPTY)
187 MTOUTFLAG={- $target{mtoutflag} || "-outputresource:" -}$(OSSL_EMPTY)
190 ASFLAGS={- $target{asflags} -}
191 ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY)
192 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
194 PROCESSOR= {- $config{processor} -}
196 # The main targets ###################################################
198 {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep
199 {- dependmagic('build_libs'); -}: build_libs_nodep
200 {- dependmagic('build_engines'); -}: build_engines_nodep
201 {- dependmagic('build_programs'); -}: build_programs_nodep
203 build_generated: $(GENERATED_MANDATORY)
204 build_libs_nodep: $(LIBS) {- join(" ",map { shlib_import($_) } @{$unified_info{libraries}}) -}
205 build_engines_nodep: $(ENGINES)
206 build_programs_nodep: $(PROGRAMS) $(SCRIPTS)
208 # Kept around for backward compatibility
209 build_apps build_tests: build_programs
211 # Convenience target to prebuild all generated files, not just the mandatory
213 build_all_generated: $(GENERATED_MANDATORY) $(GENERATED)
216 {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep
217 @rem {- output_off() if $disabled{tests}; "" -}
218 -mkdir $(BLDDIR)\test\test-runs
221 set RESULT_D=$(BLDDIR)\test\test-runs
223 set OPENSSL_DEBUG_MEMORY=on
224 "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)
225 @rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
226 @echo "Tests are not supported with your chosen Configure options"
227 @rem {- output_on() if !$disabled{tests}; "" -}
230 @rem {- output_off() if $disabled{tests}; "" -}
231 @set SRCTOP=$(SRCDIR)
232 @"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list
233 @rem {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
234 @echo "Tests are not supported with your chosen Configure options"
235 @rem {- output_on() if !$disabled{tests}; "" -}
237 install: install_sw install_ssldirs install_docs
239 uninstall: uninstall_docs uninstall_sw
242 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """$$1.*"""; } @ARGV" $(SHLIBS)
243 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """apps/$$1.*"""; } @ARGV" $(SHLIBS)
244 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """test/$$1.*"""; } @ARGV" $(SHLIBS)
245 "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """fuzz/$$1.*"""; } @ARGV" $(SHLIBS)
247 -del /Q ossl_static.pdb
250 {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -}
251 -del /Q /F $(ENGINES)
252 -del /Q /F $(SCRIPTS)
253 -del /Q /F $(GENERATED)
258 -del /Q /F apps\*.exp
259 -del /Q /F engines\*.exp
260 -del /Q /S /F engines\*.ilk
261 -del /Q /S /F engines\*.lib
262 -del /Q /S /F apps\*.lib
263 -del /Q /S /F engines\*.manifest
264 -del /Q /S /F apps\*.manifest
265 -del /Q /S /F test\*.manifest
268 -del /Q /F configdata.pm
273 # Install helper targets #############################################
275 install_sw: all install_dev install_engines install_runtime
277 uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
279 install_docs: install_html_docs
281 uninstall_docs: uninstall_html_docs
284 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs"
285 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private"
286 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc"
287 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
288 "$(OPENSSLDIR)\openssl.cnf.dist"
289 @IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \
290 "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \
291 "$(OPENSSLDIR)\openssl.cnf"
292 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \
294 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
295 "$(OPENSSLDIR)\ct_log_list.cnf.dist"
296 @IF NOT EXIST "$(OPENSSLDIR)\ct_log_list.cnf" \
297 "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \
298 "$(OPENSSLDIR)\ct_log_list.cnf"
301 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
302 @echo *** Installing development files
303 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl"
304 @rem {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
305 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \
306 "$(INSTALLTOP)\include\openssl"
307 @rem {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -}
308 @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\include\openssl\*.h" \
309 "$(INSTALLTOP)\include\openssl"
310 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\include\openssl\*.h \
311 "$(INSTALLTOP)\include\openssl"
312 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\$(LIBDIR)"
313 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) \
314 "$(INSTALLTOP)\$(LIBDIR)"
315 @if "$(SHLIBS)"=="" \
316 "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb \
317 "$(INSTALLTOP)\$(LIBDIR)"
322 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
323 @echo *** Installing engines
324 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)"
325 @if not "$(ENGINES)"=="" \
326 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)"
327 @if not "$(ENGINES)"=="" \
328 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)"
333 @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 )
334 @echo *** Installing runtime files
335 @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin"
336 @if not "$(SHLIBS)"=="" \
337 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin"
338 @if not "$(SHLIBS)"=="" \
339 "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \
341 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
343 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
345 @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \
351 "$(PERL)" "$(SRCDIR)\util\process_docs.pl" \
352 "--destdir=$(INSTALLTOP)\html" --type=html
356 # Building targets ###################################################
358 configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -}
359 @echo "Detected changed: $?"
360 @echo "Reconfiguring..."
361 "$(PERL)" "$(SRCDIR)\Configure" reconf
362 @echo "**************************************************"
364 @echo "*** Please run the same make command again ***"
366 @echo "**************************************************"
371 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/;
373 # Helper function to figure out dependencies on libraries
374 # It takes a list of library names and outputs a list of dependencies
375 sub compute_lib_depends {
376 if ($disabled{shared}) {
377 return map { lib($_) } @_;
380 (my $l = $_) =~ s/\.a$//;
381 die "Linking with static variants of shared libraries is not supported in this configuration\n"
382 if $l ne $_ && shlib($l);
384 return map { shlib_import($_) or lib($_) } @_;
389 (my $target = $args{src}) =~ s/\.[sS]$/.asm/;
390 my $generator = '"'.join('" "', @{$args{generator}}).'"';
391 my $generator_incs = join("", map { " -I \"$_\"" } @{$args{generator_incs}});
392 my $incs = join("", map { " /I \"$_\"" } @{$args{incs}});
393 my $deps = @{$args{deps}} ?
394 '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : '';
396 if ($target !~ /\.asm$/) {
397 if ($args{generator}->[0] =~ m|^.*\.in$|) {
398 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
399 "util", "dofile.pl")),
400 rel2abs($config{builddir}));
402 $target: "$args{generator}->[0]" $deps
403 "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
404 "-o$target{build_file}" $generator > \$@
408 $target: "$args{generator}->[0]" $deps
409 "\$(PERL)"$generator_incs $generator > \$@
413 if ($args{generator}->[0] =~ /\.pl$/) {
414 $generator = '"$(PERL)"'.$generator_incs.' '.$generator;
415 } elsif ($args{generator}->[0] =~ /\.S$/) {
418 die "Generator type for $src unknown: $generator\n";
421 if (defined($generator)) {
422 # If the target is named foo.S in build.info, we want to
423 # end up generating foo.s in two steps.
424 if ($args{src} =~ /\.S$/) {
426 $target: "$args{generator}->[0]" $deps
429 \$(CC) $incs \$(CFLAGS) /EP /C \$@.S > \$@.i && move /Y \$@.i \$@
435 $target: "$args{generator}->[0]" $deps
441 $target: "$args{generator}->[0]" $deps
442 \$(CC) $incs \$(CFLAGS) /EP /C "$args{generator}->[0]" > \$@.i && move /Y \$@.i \$@
449 my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x
450 } ( @{$args{srcs}} );
451 my $srcs = '"'.join('" "', @srcs).'"';
452 my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"';
453 my $incs = join("", map { ' /I "'.$_.'"' } @{$args{incs}});
454 unless ($disabled{zlib}) {
455 if ($withargs{zlib_include}) {
456 $incs .= ' /I "'.$withargs{zlib_include}.'"';
459 my $ecflags = { lib => '$(LIB_CFLAGS)',
460 dso => '$(DSO_CFLAGS)',
461 bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
462 my $makedepprog = $config{makedepprog};
463 if ($srcs[0] =~ /\.rc$/) {
466 \$(RC) \$(RCOUTFLAG)\$\@ $srcs
469 (my $obj = $args{obj}) =~ s|\.o$||;
470 if ($srcs[0] =~ /\.asm$/) {
473 \$(AS) \$(ASFLAGS) \$(ASOUTFLAG)\$\@ $srcs
476 return <<"EOF" if (!$disabled{makedepend});
478 \$(CC) \$(CFLAGS) $ecflags$inc /Zs /showIncludes $srcs 2>&1 | \\
479 "\$(PERL)" -n << > $obj$depext
481 s/^Note: including file: *//;
482 \$\$collect{\$\$_} = 1;
483 END { print '$obj$objext: ',join(" ", sort keys \%collect),"\\n" }
485 $obj$objext: $obj$depext
486 \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ @<<
490 return <<"EOF" if ($disabled{makedepend});
492 \$(CC) $incs \$(CFLAGS) $ecflags -c \$(COUTFLAG)\$\@ $srcs
496 # On Unix, we build shlibs from static libs, so we're ignoring the
497 # object file array. We *know* this routine is only called when we've
498 # configure 'shared'.
501 my $lib = $args{lib};
502 my $shlib = $args{shlib};
503 my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x }
504 grep { $_ =~ m|\.o$| }
506 my @defs = grep { $_ =~ /\.def$/ } @{$args{objs}};
507 my @deps = compute_lib_depends(@{$args{deps}});
508 die "More than one exported symbols list" if scalar @defs > 1;
509 my $linklibs = join("", map { "$_\n" } @deps);
510 my $objs = join("\n", @objs);
511 my $deps = join(" ", @objs, @defs, @deps);
512 my $target = shlib_import($lib);
513 my $shared_def = join("", map { " /def:$_" } @defs);
516 IF EXIST $shlib$shlibext.manifest DEL /F /Q $shlib$shlibext.manifest
517 \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\
518 /implib:\$@ \$(LDOUTFLAG)$shlib$shlibext$shared_def @<< || (DEL /Q \$(\@B).* $shlib.* && EXIT 1)
522 IF EXIST $shlib$shlibext.manifest \\
523 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$shlib$shlibext.manifest \$(MTOUTFLAG)$shlib$shlibext
524 IF EXIST apps\\$shlib$shlibext DEL /Q /F apps\\$shlib$shlibext
525 IF EXIST test\\$shlib$shlibext DEL /Q /F test\\$shlib$shlibext
526 IF EXIST fuzz\\$shlib$shlibext DEL /Q /F fuzz\\$shlib$shlibext
527 COPY $shlib$shlibext apps
528 COPY $shlib$shlibext test
529 COPY $shlib$shlibext fuzz
534 my $dso = $args{lib};
535 my $dso_n = basename($dso);
536 my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
537 my @deps = compute_lib_depends(@{$args{deps}});
538 my $objs = join("\n", @objs);
539 my $linklibs = join("", map { "$_\n" } @deps);
540 my $deps = join(" ", @objs, @deps);
543 IF EXIST $dso$dsoext.manifest DEL /F /Q $dso$dsoext.manifest
544 \$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \$(LDOUTFLAG)$dso$dsoext /def:<< @<<
551 $linklibs \$(EX_LIBS)
553 IF EXIST $dso$dsoext.manifest \\
554 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso$dsoext.manifest \$(MTOUTFLAG)$dso$dsoext
559 my $lib = $args{lib};
561 # Because static libs and import libs are both named the same in native
562 # Windows, we can't have both. We skip the static lib in that case,
563 # as the shared libs are what we use anyway.
564 return "" unless $disabled{"shared"} || $lib =~ /\.a$/;
567 my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
568 my $objs = join("\n", @objs);
569 my $deps = join(" ", @objs);
572 \$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib$libext @<<
579 my $bin = $args{bin};
580 my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}};
581 my @deps = compute_lib_depends(@{$args{deps}});
582 my $objs = join("\n", @objs);
583 my $linklibs = join("", map { "$_\n" } @deps);
584 my $deps = join(" ", @objs, @deps);
587 IF EXIST $bin$exeext.manifest DEL /F /Q $bin$exeext.manifest
588 \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin$exeext @<<
593 IF EXIST $bin$exeext.manifest \\
594 \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin$exeext.manifest \$(MTOUTFLAG)$bin$exeext
599 my $script = $args{script};
600 my $sources = '"'.join('" "', @{$args{sources}}).'"';
601 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir},
602 "util", "dofile.pl")),
603 rel2abs($config{builddir}));
606 "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
607 "-o$target{build_file}" $sources > "$script"
612 my $dir = $args{dir};
613 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}};
615 my %extinfo = ( dso => $dsoext,
619 foreach my $type (("dso", "lib", "bin", "script")) {
620 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type});
621 # For lib object files, we could update the library. However,
622 # LIB on Windows doesn't work that way, so we won't create any
623 # actions for it, and the dependencies are already taken care of.
624 if ($type ne "lib") {
625 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) {
626 if (dirname($prod) eq $dir) {
627 push @deps, $prod.$extinfo{$type};
629 push @actions, "\t@rem No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}});
635 my $deps = join(" ", @deps);
636 my $actions = join("\n", "", @actions);
638 $args{dir} $args{dir}\\ : $deps$actions
641 "" # Important! This becomes part of the template result.