]>
Commit | Line | Data |
---|---|---|
7c0e1aa6 RL |
1 | ## |
2 | ## Makefile for OpenSSL | |
3 | ## | |
4 | ## {- join("\n## ", @autowarntext) -} | |
5 | {- | |
6 | our $objext = $target{obj_extension} || ".obj"; | |
81183680 | 7 | our $resext = $target{res_extension} || ".res"; |
7c0e1aa6 RL |
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"; | |
14 | ||
d4453024 | 15 | (our $sover_dirname = $config{shlib_version_number}) =~ s|\.|_|g; |
ee0a61cf | 16 | |
6a145a32 AP |
17 | my $build_scheme = $target{build_scheme}; |
18 | my $install_flavour = $build_scheme->[$#$build_scheme]; # last element | |
8c16829e | 19 | my $win_installenv = |
6a145a32 AP |
20 | $install_flavour eq "VC-WOW" ? "ProgramFiles(x86)" |
21 | : "ProgramW6432"; | |
8c16829e | 22 | my $win_commonenv = |
6a145a32 AP |
23 | $install_flavour eq "VC-WOW" ? "CommonProgramFiles(x86)" |
24 | : "CommonProgramW6432"; | |
8c16829e | 25 | our $win_installroot = |
6a145a32 | 26 | defined($ENV{$win_installenv}) ? $win_installenv : 'ProgramFiles'; |
8c16829e | 27 | our $win_commonroot = |
6a145a32 | 28 | defined($ENV{$win_commonenv}) ? $win_commonenv : 'CommonProgramFiles'; |
9921b7b6 AP |
29 | |
30 | # expand variables early | |
31 | $win_installroot = $ENV{$win_installroot}; | |
32 | $win_commonroot = $ENV{$win_commonroot}; | |
8c16829e | 33 | |
7c0e1aa6 | 34 | sub shlib { |
7c0e1aa6 | 35 | my $lib = shift; |
33105818 RL |
36 | return () if $disabled{shared} || $lib =~ /\.a$/; |
37 | return () unless defined $unified_info{sharednames}->{$lib}; | |
7c0e1aa6 RL |
38 | return $unified_info{sharednames}->{$lib} . $shlibext; |
39 | } | |
40 | ||
33105818 RL |
41 | sub lib { |
42 | (my $lib = shift) =~ s/\.a$//; | |
85299451 RL |
43 | $lib .= '_static' |
44 | if (defined $unified_info{sharednames}->{$lib}); | |
33105818 RL |
45 | return $lib . $libext; |
46 | } | |
47 | ||
7c0e1aa6 | 48 | sub shlib_import { |
7c0e1aa6 | 49 | my $lib = shift; |
33105818 | 50 | return () if $disabled{shared} || $lib =~ /\.a$/; |
7c0e1aa6 RL |
51 | return $lib . $shlibextimport; |
52 | } | |
53 | ||
54 | sub dso { | |
55 | my $dso = shift; | |
56 | ||
57 | return $dso . $dsoext; | |
58 | } | |
f919c12f RL |
59 | # This makes sure things get built in the order they need |
60 | # to. You're welcome. | |
61 | sub dependmagic { | |
62 | my $target = shift; | |
63 | ||
22626b97 | 64 | return "$target: build_generated\n\t\$(MAKE) /\$(MAKEFLAGS) depend && \$(MAKE) /\$(MAKEFLAGS) _$target\n_$target"; |
f919c12f | 65 | } |
7c0e1aa6 RL |
66 | ''; |
67 | -} | |
68 | ||
69 | PLATFORM={- $config{target} -} | |
70 | SRCDIR={- $config{sourcedir} -} | |
71 | BLDDIR={- $config{builddir} -} | |
72 | ||
73 | VERSION={- $config{version} -} | |
74 | MAJOR={- $config{major} -} | |
75 | MINOR={- $config{minor} -} | |
76 | ||
77 | SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} | |
78 | ||
85299451 | 79 | LIBS={- join(" ", map { ( shlib_import($_), lib($_) ) } @{$unified_info{libraries}}) -} |
7c0e1aa6 | 80 | SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -} |
3ec8a1cf | 81 | SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; shlib($_) } @{$unified_info{libraries}}) -} |
7c0e1aa6 | 82 | ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -} |
3ec8a1cf | 83 | ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; dso($_) } @{$unified_info{engines}}) -} |
edef840f | 84 | PROGRAMS={- our @PROGRAMS = map { $_.$exeext } @{$unified_info{programs}}; join(" ", @PROGRAMS) -} |
1e3d16b0 | 85 | PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -} |
7c0e1aa6 | 86 | SCRIPTS={- join(" ", @{$unified_info{scripts}}) -} |
bb6b950e | 87 | {- output_off() if $disabled{makedepend}; "" -} |
7c0e1aa6 RL |
88 | DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; } |
89 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } | |
90 | keys %{$unified_info{sources}}); -} | |
bb6b950e | 91 | {- output_on() if $disabled{makedepend}; "" -} |
7cae3864 | 92 | GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -} |
8258975c RL |
93 | GENERATED={- # common0.tmpl provides @generated |
94 | join(" ", map { (my $x = $_) =~ s|\.[sS]$|.asm|; $x } | |
95 | @generated) -} | |
7c0e1aa6 | 96 | |
85299451 | 97 | INSTALL_LIBS={- join(" ", map { quotify1(shlib_import($_) or lib($_)) } @{$unified_info{install}->{libraries}}) -} |
d8a4f8ff BE |
98 | INSTALL_SHLIBS={- join(" ", map { quotify_l(shlib($_)) } @{$unified_info{install}->{libraries}}) -} |
99 | INSTALL_SHLIBPDBS={- join(" ", map { local $shlibext = ".pdb"; quotify_l(shlib($_)) } @{$unified_info{install}->{libraries}}) -} | |
fb853fa2 BE |
100 | INSTALL_ENGINES={- join(" ", map { quotify1(dso($_)) } @{$unified_info{install}->{engines}}) -} |
101 | INSTALL_ENGINEPDBS={- join(" ", map { local $dsoext = ".pdb"; quotify1(dso($_)) } @{$unified_info{install}->{engines}}) -} | |
102 | INSTALL_PROGRAMS={- join(" ", map { quotify1($_.$exeext) } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -} | |
103 | INSTALL_PROGRAMPDBS={- join(" ", map { quotify1($_.".pdb") } grep { !m|^test\\| } @{$unified_info{install}->{programs}}) -} | |
0f01b7bc | 104 | {- output_off() if $disabled{apps}; "" -} |
fb853fa2 BE |
105 | BIN_SCRIPTS="$(BLDDIR)\tools\c_rehash.pl" |
106 | MISC_SCRIPTS="$(BLDDIR)\apps\CA.pl" "$(BLDDIR)\apps\tsget.pl" | |
0f01b7bc RL |
107 | {- output_on() if $disabled{apps}; "" -} |
108 | ||
6a74806e | 109 | APPS_OPENSSL={- use File::Spec::Functions; |
fb853fa2 | 110 | "\"".catfile("apps","openssl")."\"" -} |
6a74806e | 111 | |
7c0e1aa6 RL |
112 | # Do not edit these manually. Use Configure with --prefix or --openssldir |
113 | # to change this! Short explanation in the top comment in Configure | |
b8bbd8b1 RL |
114 | INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet |
115 | # | |
116 | use File::Spec::Functions qw(:DEFAULT splitpath); | |
dc6a62d5 RL |
117 | our $prefix = canonpath($config{prefix} |
118 | || "$win_installroot\\OpenSSL"); | |
b8bbd8b1 | 119 | our ($prefix_dev, $prefix_dir, $prefix_file) = |
0685b15a | 120 | splitpath($prefix, 1); |
b8bbd8b1 | 121 | $prefix_dev -} |
dc6a62d5 | 122 | INSTALLTOP_dir={- canonpath($prefix_dir) -} |
b8bbd8b1 RL |
123 | OPENSSLDIR_dev={- # |
124 | # The logic here is that if no --openssldir was given, | |
f8baec39 | 125 | # OPENSSLDIR will get the value "$win_commonroot\\SSL". |
b8bbd8b1 RL |
126 | # If --openssldir was given and the value is an absolute |
127 | # path, OPENSSLDIR will get its value without change. | |
128 | # If the value from --openssldir is a relative path, | |
129 | # OPENSSLDIR will get $prefix with the --openssldir | |
130 | # value appended as a subdirectory. | |
131 | # | |
132 | use File::Spec::Functions qw(:DEFAULT splitpath); | |
3ffb060e | 133 | our $openssldir = |
b8bbd8b1 RL |
134 | $config{openssldir} ? |
135 | (file_name_is_absolute($config{openssldir}) ? | |
dc6a62d5 | 136 | canonpath($config{openssldir}) |
b8bbd8b1 | 137 | : catdir($prefix, $config{openssldir})) |
dc6a62d5 | 138 | : canonpath("$win_commonroot\\SSL"); |
b8bbd8b1 RL |
139 | our ($openssldir_dev, $openssldir_dir, $openssldir_file) = |
140 | splitpath($openssldir, 1); | |
141 | $openssldir_dev -} | |
dc6a62d5 | 142 | OPENSSLDIR_dir={- canonpath($openssldir_dir) -} |
8c16829e | 143 | LIBDIR={- our $libdir = $config{libdir} || "lib"; |
e454f3ad | 144 | file_name_is_absolute($libdir) ? "" : $libdir -} |
b8bbd8b1 | 145 | ENGINESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath); |
d4453024 | 146 | our $enginesdir = catdir($prefix,$libdir,"engines-$sover_dirname"); |
b8bbd8b1 RL |
147 | our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) = |
148 | splitpath($enginesdir, 1); | |
149 | $enginesdir_dev -} | |
dc6a62d5 | 150 | ENGINESDIR_dir={- canonpath($enginesdir_dir) -} |
b8bbd8b1 RL |
151 | !IF "$(DESTDIR)" != "" |
152 | INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir) | |
153 | OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir) | |
154 | ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir) | |
155 | !ELSE | |
156 | INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir) | |
157 | OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir) | |
158 | ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir) | |
159 | !ENDIF | |
7c0e1aa6 | 160 | |
e454f3ad RL |
161 | # $(libdir) is chosen to be compatible with the GNU coding standards |
162 | libdir={- file_name_is_absolute($libdir) | |
163 | ? $libdir : '$(INSTALLTOP)\$(LIBDIR)' -} | |
164 | ||
abe256e7 RL |
165 | ##### User defined commands and flags ################################ |
166 | ||
167 | CC={- $config{CC} -} | |
168 | CPP={- $config{CPP} -} | |
169 | CPPFLAGS={- our $cppflags1 = join(" ", | |
170 | (map { "-D".$_} @{$config{CPPDEFINES}}), | |
171 | (map { " /I ".$_} @{$config{CPPINCLUDES}}), | |
172 | @{$config{CPPFLAGS}}) -} | |
173 | CFLAGS={- join(' ', @{$config{CFLAGS}}) -} | |
174 | LD={- $config{LD} -} | |
175 | LDFLAGS={- join(' ', @{$config{LDFLAGS}}) -} | |
176 | EX_LIBS={- join(' ', @{$config{LDLIBS}}) -} | |
7c0e1aa6 | 177 | |
9e265322 | 178 | PERL={- $config{PERL} -} |
7c0e1aa6 | 179 | |
abe256e7 RL |
180 | AR={- $config{AR} -} |
181 | ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -} | |
182 | ||
183 | MT={- $config{MT} -} | |
184 | MTFLAGS= {- join(' ', @{$config{MTFLAGS}}) -} | |
185 | ||
186 | AS={- $config{AS} -} | |
187 | ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -} | |
7c0e1aa6 | 188 | |
abe256e7 | 189 | RC={- $config{RC} -} |
755542cb | 190 | |
9abce88b RL |
191 | ECHO="$(PERL)" "$(SRCDIR)\util\echo.pl" |
192 | ||
abe256e7 RL |
193 | ##### Special command flags ########################################## |
194 | ||
195 | COUTFLAG={- $target{coutflag} -}$(OSSL_EMPTY) | |
196 | LDOUTFLAG={- $target{ldoutflag} -}$(OSSL_EMPTY) | |
197 | AROUTFLAG={- $target{aroutflag} -}$(OSSL_EMPTY) | |
198 | MTINFLAG={- $target{mtinflag} -}$(OSSL_EMPTY) | |
199 | MTOUTFLAG={- $target{mtoutflag} -}$(OSSL_EMPTY) | |
1fc431ba | 200 | ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY) |
abe256e7 RL |
201 | RCOUTFLAG={- $target{rcoutflag} -}$(OSSL_EMPTY) |
202 | ||
203 | ##### Project flags ################################################## | |
204 | ||
205 | # Variables starting with CNF_ are common variables for all product types | |
206 | ||
207 | CNF_ASFLAGS={- join(' ', $target{asflags} || (), | |
208 | @{$config{asflags}}) -} | |
209 | CNF_CPPFLAGS={- our $cppfags2 = | |
210 | join(' ', $target{cppflags} || (), | |
2cc8fe11 RL |
211 | (map { '-D'.quotify1($_) } @{$target{defines}}, |
212 | @{$config{defines}}), | |
213 | (map { '-I'.quotify1($_) } @{$target{includes}}, | |
214 | @{$config{includes}}), | |
abe256e7 RL |
215 | @{$config{cppflags}}) -} |
216 | CNF_CFLAGS={- join(' ', $target{cflags} || (), | |
217 | @{$config{cflags}}) -} | |
218 | CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (), | |
219 | @{$config{cxxflags}}) -} | |
220 | CNF_LDFLAGS={- join(' ', $target{lflags} || (), | |
221 | @{$config{lflags}}) -} | |
222 | CNF_EX_LIBS={- join(' ', $target{ex_libs} || (), | |
223 | @{$config{ex_libs}}) -} | |
224 | ||
225 | # Variables starting with LIB_ are used to build library object files | |
226 | # and shared libraries. | |
227 | # Variables starting with DSO_ are used to build DSOs and their object files. | |
228 | # Variables starting with BIN_ are used to build programs and their object | |
229 | # files. | |
230 | ||
231 | LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (), | |
232 | @{$config{lib_asflags}}, | |
233 | '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} | |
58d6be5b RL |
234 | LIB_CPPFLAGS={- our $lib_cppflags = |
235 | join(' ', $target{lib_cppflags} || (), | |
abe256e7 | 236 | $target{shared_cppflag} || (), |
2cc8fe11 | 237 | (map { '-D'.quotify1($_) } |
abe256e7 RL |
238 | @{$target{lib_defines}}, |
239 | @{$target{shared_defines}}, | |
240 | @{$config{lib_defines}}, | |
58d6be5b | 241 | @{$config{shared_defines}}), |
2cc8fe11 | 242 | (map { '-I'.quotify1($_) } |
abe256e7 RL |
243 | @{$target{lib_includes}}, |
244 | @{$target{shared_includes}}, | |
245 | @{$config{lib_includes}}, | |
246 | @{$config{shared_includes}}), | |
247 | @{$config{lib_cppflags}}, | |
58d6be5b RL |
248 | @{$config{shared_cppflag}}); |
249 | join(' ', $lib_cppflags, | |
2cc8fe11 | 250 | (map { '-D'.quotify1($_) } |
58d6be5b RL |
251 | "OPENSSLDIR=\"$openssldir\"", |
252 | "ENGINESDIR=\"$enginesdir\""), | |
abe256e7 RL |
253 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} |
254 | LIB_CFLAGS={- join(' ', $target{lib_cflags} || (), | |
255 | $target{shared_cflag} || (), | |
256 | @{$config{lib_cflags}}, | |
257 | @{$config{shared_cflag}}, | |
258 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
259 | LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (), | |
260 | $config{shared_ldflag} || (), | |
261 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
262 | LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
263 | DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (), | |
264 | $target{module_asflags} || (), | |
265 | @{$config{dso_asflags}}, | |
266 | @{$config{module_asflags}}, | |
267 | '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} | |
268 | DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (), | |
269 | $target{module_cppflags} || (), | |
270 | @{$config{dso_cppflags}}, | |
271 | @{$config{module_cppflags}}, | |
272 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
273 | DSO_CFLAGS={- join(' ', $target{dso_cflags} || (), | |
274 | $target{module_cflags} || (), | |
275 | @{$config{dso_cflags}}, | |
276 | @{$config{module_cflags}}, | |
277 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
278 | DSO_LDFLAGS={- join(' ', $target{dso_lflags} || (), | |
279 | $target{module_ldflags} || (), | |
280 | @{$config{dso_lflags}}, | |
281 | @{$config{module_ldflags}}, | |
282 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
283 | DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
284 | BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (), | |
285 | @{$config{bin_asflags}}, | |
286 | '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} | |
287 | BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (), | |
288 | @{$config{bin_cppflags}}, | |
289 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
290 | BIN_CFLAGS={- join(' ', $target{bin_cflags} || (), | |
291 | @{$config{bin_cflags}}, | |
292 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
293 | BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), | |
294 | @{$config{bin_lflags}}, | |
295 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
296 | BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
297 | ||
298 | # CPPFLAGS_Q is used for one thing only: to build up buildinf.h | |
299 | CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; | |
300 | $cppflags2 =~ s|([\\"])|\\$1|g; | |
58d6be5b RL |
301 | join(' ', $lib_cppflags || (), $cppflags2 || (), |
302 | $cppflags1 || ()) -} | |
abe256e7 | 303 | |
7c0e1aa6 RL |
304 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} |
305 | ||
306 | PROCESSOR= {- $config{processor} -} | |
307 | ||
308 | # The main targets ################################################### | |
309 | ||
f919c12f RL |
310 | {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep |
311 | {- dependmagic('build_libs'); -}: build_libs_nodep | |
312 | {- dependmagic('build_engines'); -}: build_engines_nodep | |
313 | {- dependmagic('build_programs'); -}: build_programs_nodep | |
7c0e1aa6 | 314 | |
f919c12f | 315 | build_generated: $(GENERATED_MANDATORY) |
8478a703 | 316 | build_libs_nodep: $(LIBS) {- join(" ",map { shlib_import($_) } @{$unified_info{libraries}}) -} |
7c0e1aa6 | 317 | build_engines_nodep: $(ENGINES) |
1e3d16b0 | 318 | build_programs_nodep: $(PROGRAMS) $(SCRIPTS) |
7c0e1aa6 | 319 | |
1e3d16b0 RL |
320 | # Kept around for backward compatibility |
321 | build_apps build_tests: build_programs | |
322 | ||
9b03b91b RL |
323 | # Convenience target to prebuild all generated files, not just the mandatory |
324 | # ones | |
325 | build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) | |
1b6a0a26 | 326 | @{- output_off() if $disabled{makedepend}; "" -} |
9abce88b RL |
327 | @$(ECHO) "Warning: consider configuring with no-makedepend, because if" |
328 | @$(ECHO) " target system doesn't have $(PERL)," | |
329 | @$(ECHO) " then make will fail..." | |
1b6a0a26 | 330 | @{- output_on() if $disabled{makedepend}; "" -} |
9b03b91b | 331 | |
1b741653 | 332 | test: tests |
f919c12f | 333 | {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep |
1b6a0a26 | 334 | @{- output_off() if $disabled{tests}; "" -} |
41f571e1 | 335 | -mkdir $(BLDDIR)\test\test-runs |
7c0e1aa6 RL |
336 | set SRCTOP=$(SRCDIR) |
337 | set BLDTOP=$(BLDDIR) | |
41f571e1 | 338 | set RESULT_D=$(BLDDIR)\test\test-runs |
7c0e1aa6 | 339 | set PERL=$(PERL) |
7a6ce903 | 340 | set OPENSSL_ENGINES=$(MAKEDIR)\engines |
6d4bc8a3 | 341 | set OPENSSL_DEBUG_MEMORY=on |
cb663908 | 342 | "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS) |
1b6a0a26 | 343 | @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
9abce88b | 344 | @$(ECHO) "Tests are not supported with your chosen Configure options" |
1b6a0a26 | 345 | @{- output_on() if !$disabled{tests}; "" -} |
7c0e1aa6 RL |
346 | |
347 | list-tests: | |
1b6a0a26 | 348 | @{- output_off() if $disabled{tests}; "" -} |
4813ad2d | 349 | @set SRCTOP=$(SRCDIR) |
cb663908 | 350 | @"$(PERL)" "$(SRCDIR)\test\run_tests.pl" list |
1b6a0a26 | 351 | @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
9abce88b | 352 | @$(ECHO) "Tests are not supported with your chosen Configure options" |
1b6a0a26 | 353 | @{- output_on() if !$disabled{tests}; "" -} |
7c0e1aa6 | 354 | |
8c16829e RL |
355 | install: install_sw install_ssldirs install_docs |
356 | ||
357 | uninstall: uninstall_docs uninstall_sw | |
358 | ||
3415c711 | 359 | libclean: |
dead788f AP |
360 | "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """{.,apps,test,fuzz}/$$1.*"""; } @ARGV" $(SHLIBS) |
361 | -del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb | |
3415c711 RL |
362 | |
363 | clean: libclean | |
edef840f RL |
364 | {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) -} |
365 | -del /Q /F $(ENGINES) | |
366 | -del /Q /F $(SCRIPTS) | |
cf54d00a | 367 | -del /Q /F $(GENERATED_MANDATORY) |
4813ad2d | 368 | -del /Q /F $(GENERATED) |
4ffc1842 F |
369 | -del /Q /S /F *.d *.obj *.pdb *.ilk *.manifest |
370 | -del /Q /S /F engines\*.lib engines\*.exp | |
371 | -del /Q /S /F apps\*.lib apps\*.rc apps\*.res apps\*.exp | |
372 | -del /Q /S /F test\*.exp | |
cf54d00a | 373 | -rmdir /Q /S test\test-runs |
3415c711 | 374 | |
7cae3864 RL |
375 | distclean: clean |
376 | -del /Q /F configdata.pm | |
377 | -del /Q /F makefile | |
378 | ||
7c0e1aa6 | 379 | depend: |
1b6a0a26 | 380 | @ {- output_off() if $disabled{makedepend}; "" -} |
c39785d4 | 381 | @ "$(PERL)" "$(SRCDIR)\util\add-depends.pl" "VC" |
1b6a0a26 | 382 | @ {- output_on() if $disabled{makedepend}; "" -} |
7c0e1aa6 | 383 | |
8c16829e RL |
384 | # Install helper targets ############################################# |
385 | ||
201a33f4 | 386 | install_sw: install_dev install_engines install_runtime |
8c16829e RL |
387 | |
388 | uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev | |
389 | ||
4813ad2d | 390 | install_docs: install_html_docs |
8c16829e | 391 | |
4813ad2d | 392 | uninstall_docs: uninstall_html_docs |
8c16829e RL |
393 | |
394 | install_ssldirs: | |
b8bbd8b1 RL |
395 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs" |
396 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private" | |
397 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc" | |
cb663908 | 398 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \ |
cb926df2 RL |
399 | "$(OPENSSLDIR)\openssl.cnf.dist" |
400 | @IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \ | |
401 | "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \ | |
402 | "$(OPENSSLDIR)\openssl.cnf" | |
cb663908 | 403 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \ |
b8bbd8b1 | 404 | "$(OPENSSLDIR)\misc" |
c7af65c7 RS |
405 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \ |
406 | "$(OPENSSLDIR)\ct_log_list.cnf.dist" | |
407 | @IF NOT EXIST "$(OPENSSLDIR)\ct_log_list.cnf" \ | |
408 | "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \ | |
409 | "$(OPENSSLDIR)\ct_log_list.cnf" | |
8c16829e | 410 | |
d582f154 | 411 | install_dev: install_runtime_libs |
9abce88b RL |
412 | @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) |
413 | @$(ECHO) "*** Installing development files" | |
b8bbd8b1 | 414 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl" |
695bc60f | 415 | @{- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
24c4f736 RL |
416 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \ |
417 | "$(INSTALLTOP)\include\openssl" | |
695bc60f | 418 | @{- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} |
246bd8fd RL |
419 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "-exclude_re=/__DECC_" \ |
420 | "$(SRCDIR)\include\openssl\*.h" \ | |
b8bbd8b1 | 421 | "$(INSTALLTOP)\include\openssl" |
fb853fa2 | 422 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(BLDDIR)\include\openssl\*.h" \ |
b8bbd8b1 | 423 | "$(INSTALLTOP)\include\openssl" |
e454f3ad RL |
424 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)" |
425 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)" | |
3ec8a1cf | 426 | @if "$(SHLIBS)"=="" \ |
e454f3ad | 427 | "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)" |
8c16829e RL |
428 | |
429 | uninstall_dev: | |
430 | ||
201a33f4 | 431 | install_engines: install_runtime_libs build_engines |
9abce88b RL |
432 | @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) |
433 | @$(ECHO) "*** Installing engines" | |
b8bbd8b1 | 434 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)" |
8c16829e | 435 | @if not "$(ENGINES)"=="" \ |
0f01b7bc | 436 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)" |
3ec8a1cf | 437 | @if not "$(ENGINES)"=="" \ |
0f01b7bc | 438 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)" |
8c16829e RL |
439 | |
440 | uninstall_engines: | |
441 | ||
d582f154 RL |
442 | install_runtime: install_programs |
443 | ||
201a33f4 | 444 | install_runtime_libs: build_libs |
9abce88b | 445 | @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) |
d582f154 | 446 | @$(ECHO) "*** Installing runtime libraries" |
b8bbd8b1 | 447 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin" |
8c16829e | 448 | @if not "$(SHLIBS)"=="" \ |
0f01b7bc | 449 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin" |
3ec8a1cf | 450 | @if not "$(SHLIBS)"=="" \ |
0f01b7bc | 451 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \ |
b8bbd8b1 | 452 | "$(INSTALLTOP)\bin" |
d582f154 | 453 | |
201a33f4 | 454 | install_programs: install_runtime_libs build_programs |
d582f154 RL |
455 | @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) |
456 | @$(ECHO) "*** Installing runtime programs" | |
457 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin" | |
0f01b7bc | 458 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \ |
b8bbd8b1 | 459 | "$(INSTALLTOP)\bin" |
0f01b7bc | 460 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \ |
b8bbd8b1 | 461 | "$(INSTALLTOP)\bin" |
cb663908 | 462 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \ |
b8bbd8b1 | 463 | "$(INSTALLTOP)\bin" |
8c16829e RL |
464 | |
465 | uninstall_runtime: | |
466 | ||
4813ad2d RL |
467 | install_html_docs: |
468 | "$(PERL)" "$(SRCDIR)\util\process_docs.pl" \ | |
b8bbd8b1 | 469 | "--destdir=$(INSTALLTOP)\html" --type=html |
4813ad2d RL |
470 | |
471 | uninstall_html_docs: | |
472 | ||
7c0e1aa6 RL |
473 | # Building targets ################################################### |
474 | ||
41240e68 | 475 | configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} |
9abce88b | 476 | @$(ECHO) "Detected changed: $?" |
a1b6933e | 477 | "$(PERL)" configdata.pm -r |
9abce88b RL |
478 | @$(ECHO) "**************************************************" |
479 | @$(ECHO) "*** ***" | |
480 | @$(ECHO) "*** Please run the same make command again ***" | |
481 | @$(ECHO) "*** ***" | |
482 | @$(ECHO) "**************************************************" | |
6ddb62a5 | 483 | @exit 1 |
7c0e1aa6 | 484 | |
bf01fbbf | 485 | reconfigure reconf: |
a1b6933e | 486 | "$(PERL)" configdata.pm -r |
bf01fbbf | 487 | |
7c0e1aa6 RL |
488 | {- |
489 | use File::Basename; | |
490 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
491 | ||
492 | # Helper function to figure out dependencies on libraries | |
493 | # It takes a list of library names and outputs a list of dependencies | |
494 | sub compute_lib_depends { | |
495 | if ($disabled{shared}) { | |
33105818 | 496 | return map { lib($_) } @_; |
7c0e1aa6 | 497 | } |
33105818 | 498 | return map { shlib_import($_) or lib($_) } @_; |
7c0e1aa6 RL |
499 | } |
500 | ||
9a1394c5 RL |
501 | sub generatesrc { |
502 | my %args = @_; | |
503 | (my $target = $args{src}) =~ s/\.[sS]$/.asm/; | |
1c9858d0 RL |
504 | my ($gen0, @gens) = @{$args{generator}}; |
505 | my $generator = '"'.$gen0.'"'.join('', map { " $_" } @gens); | |
cb663908 RL |
506 | my $generator_incs = join("", map { " -I \"$_\"" } @{$args{generator_incs}}); |
507 | my $incs = join("", map { " /I \"$_\"" } @{$args{incs}}); | |
508 | my $deps = @{$args{deps}} ? | |
509 | '"'.join('" "', @{$args{generator_deps}}, @{$args{deps}}).'"' : ''; | |
9a1394c5 RL |
510 | |
511 | if ($target !~ /\.asm$/) { | |
7cae3864 RL |
512 | if ($args{generator}->[0] =~ m|^.*\.in$|) { |
513 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
514 | "util", "dofile.pl")), | |
515 | rel2abs($config{builddir})); | |
516 | return <<"EOF"; | |
517 | $target: "$args{generator}->[0]" $deps | |
518 | "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ | |
519 | "-o$target{build_file}" $generator > \$@ | |
520 | EOF | |
521 | } else { | |
522 | return <<"EOF"; | |
cb663908 RL |
523 | $target: "$args{generator}->[0]" $deps |
524 | "\$(PERL)"$generator_incs $generator > \$@ | |
9a1394c5 | 525 | EOF |
7cae3864 | 526 | } |
9a1394c5 RL |
527 | } else { |
528 | if ($args{generator}->[0] =~ /\.pl$/) { | |
cb663908 | 529 | $generator = '"$(PERL)"'.$generator_incs.' '.$generator; |
9a1394c5 RL |
530 | } elsif ($args{generator}->[0] =~ /\.S$/) { |
531 | $generator = undef; | |
532 | } else { | |
533 | die "Generator type for $src unknown: $generator\n"; | |
534 | } | |
535 | ||
722c9762 | 536 | my $cppflags = $incs; |
8bc0147f RL |
537 | $cppflags .= { |
538 | lib => ' $(LIB_CFLAGS) $(LIB_CPPFLAGS)', | |
539 | dso => ' $(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
540 | bin => ' $(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
541 | } -> {$args{intent}}; | |
9a1394c5 RL |
542 | if (defined($generator)) { |
543 | # If the target is named foo.S in build.info, we want to | |
544 | # end up generating foo.s in two steps. | |
545 | if ($args{src} =~ /\.S$/) { | |
546 | return <<"EOF"; | |
cb663908 | 547 | $target: "$args{generator}->[0]" $deps |
9a1394c5 | 548 | set ASM=\$(AS) |
9a1394c5 | 549 | $generator \$@.S |
d8e2b4f9 | 550 | \$(CPP) $cppflags \$@.S > \$@.i && move /Y \$@.i \$@ |
9a1394c5 RL |
551 | del /Q \$@.S |
552 | EOF | |
553 | } | |
554 | # Otherwise.... | |
555 | return <<"EOF"; | |
cb663908 | 556 | $target: "$args{generator}->[0]" $deps |
9a1394c5 | 557 | set ASM=\$(AS) |
9a1394c5 RL |
558 | $generator \$@ |
559 | EOF | |
560 | } | |
561 | return <<"EOF"; | |
cb663908 | 562 | $target: "$args{generator}->[0]" $deps |
d8e2b4f9 | 563 | \$(CPP) $incs $cppflags "$args{generator}->[0]" > \$@.i && move /Y \$@.i \$@ |
9a1394c5 RL |
564 | EOF |
565 | } | |
566 | } | |
567 | ||
7c0e1aa6 RL |
568 | sub src2obj { |
569 | my %args = @_; | |
6ddb62a5 AP |
570 | my @srcs = map { (my $x = $_) =~ s/\.s$/.asm/; $x |
571 | } ( @{$args{srcs}} ); | |
cb663908 RL |
572 | my $srcs = '"'.join('" "', @srcs).'"'; |
573 | my $deps = '"'.join('" "', @srcs, @{$args{deps}}).'"'; | |
574 | my $incs = join("", map { ' /I "'.$_.'"' } @{$args{incs}}); | |
722c9762 RL |
575 | my $cflags = { lib => ' $(LIB_CFLAGS)', |
576 | dso => ' $(DSO_CFLAGS)', | |
577 | bin => ' $(BIN_CFLAGS)' } -> {$args{intent}}; | |
8c3bc594 | 578 | $cflags .= $incs; |
8c3bc594 RL |
579 | $cflags .= { lib => ' $(LIB_CPPFLAGS)', |
580 | dso => ' $(DSO_CPPFLAGS)', | |
581 | bin => ' $(BIN_CPPFLAGS)' } -> {$args{intent}}; | |
abe256e7 RL |
582 | my $asflags = { lib => ' $(LIB_ASFLAGS)', |
583 | dso => ' $(DSO_ASFLAGS)', | |
584 | bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}}; | |
7c0e1aa6 | 585 | my $makedepprog = $config{makedepprog}; |
81183680 RL |
586 | if ($srcs[0] =~ /\.rc$/) { |
587 | return <<"EOF"; | |
588 | $args{obj}: $deps | |
589 | \$(RC) \$(RCOUTFLAG)\$\@ $srcs | |
590 | EOF | |
591 | } | |
592 | (my $obj = $args{obj}) =~ s|\.o$||; | |
7c0e1aa6 RL |
593 | if ($srcs[0] =~ /\.asm$/) { |
594 | return <<"EOF"; | |
595 | $obj$objext: $deps | |
abe256e7 | 596 | \$(AS) $asflags \$(ASOUTFLAG)\$\@ $srcs |
18d15882 AP |
597 | EOF |
598 | } elsif ($srcs[0] =~ /.S$/) { | |
599 | return <<"EOF"; | |
600 | $obj$objext: $deps | |
601 | \$(CC) /EP /D__ASSEMBLER__ $cflags $srcs > \$@.asm && \$(AS) $asflags \$(ASOUTFLAG)\$\@ \$@.asm | |
7c0e1aa6 RL |
602 | EOF |
603 | } | |
7e01266f | 604 | my $recipe = <<"EOF"; |
bb6b950e | 605 | $obj$objext: $deps |
8c3bc594 | 606 | \$(CC) $cflags -c \$(COUTFLAG)\$\@ $srcs |
7c0e1aa6 | 607 | EOF |
7e01266f RL |
608 | $recipe .= <<"EOF" unless $disabled{makedepend}; |
609 | \$(CC) $cflags /Zs /showIncludes $srcs 2>&1 > $obj$depext | |
610 | EOF | |
611 | return $recipe; | |
7c0e1aa6 RL |
612 | } |
613 | ||
132fd512 RL |
614 | # We *know* this routine is only called when we've configure 'shared'. |
615 | # Also, note that even though the import library built here looks like | |
616 | # a static library, it really isn't. | |
7c0e1aa6 RL |
617 | sub libobj2shlib { |
618 | my %args = @_; | |
619 | my $lib = $args{lib}; | |
81183680 | 620 | my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } |
0973b470 | 621 | grep { $_ =~ m/\.(?:o|res)$/ } |
81183680 RL |
622 | @{$args{objs}}; |
623 | my @defs = grep { $_ =~ /\.def$/ } @{$args{objs}}; | |
624 | my @deps = compute_lib_depends(@{$args{deps}}); | |
625 | die "More than one exported symbols list" if scalar @defs > 1; | |
626 | my $linklibs = join("", map { "$_\n" } @deps); | |
627 | my $objs = join("\n", @objs); | |
628 | my $deps = join(" ", @objs, @defs, @deps); | |
132fd512 RL |
629 | my $import = shlib_import($lib); |
630 | my $dll = shlib($lib); | |
81183680 | 631 | my $shared_def = join("", map { " /def:$_" } @defs); |
7c0e1aa6 | 632 | return <<"EOF" |
132fd512 RL |
633 | # The import library may look like a static library, but it is not. |
634 | # We MUST make the import library depend on the DLL, in case someone | |
635 | # mistakenly removes the latter. | |
636 | $import: $dll | |
637 | $dll: $deps | |
638 | IF EXIST $full.manifest DEL /F /Q $full.manifest | |
0d9b5fa3 | 639 | IF EXIST \$@ DEL /F /Q \$@ |
bbd9a50f | 640 | \$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) \\ |
132fd512 | 641 | /implib:$import \$(LDOUTFLAG)$dll$shared_def @<< || (DEL /Q \$(\@B).* $import && EXIT 1) |
81183680 | 642 | $objs |
abe256e7 | 643 | $linklibs\$(LIB_EX_LIBS) |
7c0e1aa6 | 644 | << |
132fd512 RL |
645 | IF EXIST $dll.manifest \\ |
646 | \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dll.manifest \$(MTOUTFLAG)$dll | |
647 | IF EXIST apps\\$dll DEL /Q /F apps\\$dll | |
648 | IF EXIST test\\$dll DEL /Q /F test\\$dll | |
649 | IF EXIST fuzz\\$dll DEL /Q /F fuzz\\$dll | |
650 | COPY $dll apps | |
651 | COPY $dll test | |
652 | COPY $dll fuzz | |
7c0e1aa6 RL |
653 | EOF |
654 | } | |
655 | sub obj2dso { | |
656 | my %args = @_; | |
657 | my $dso = $args{lib}; | |
2fe73036 | 658 | my $dso_n = basename($dso); |
81183680 RL |
659 | my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}}; |
660 | my @deps = compute_lib_depends(@{$args{deps}}); | |
661 | my $objs = join("\n", @objs); | |
662 | my $linklibs = join("", map { "$_\n" } @deps); | |
663 | my $deps = join(" ", @objs, @deps); | |
7c0e1aa6 RL |
664 | return <<"EOF"; |
665 | $dso$dsoext: $deps | |
755542cb | 666 | IF EXIST $dso$dsoext.manifest DEL /F /Q $dso$dsoext.manifest |
2fe73036 RL |
667 | \$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) \$(LDOUTFLAG)$dso$dsoext /def:<< @<< |
668 | LIBRARY $dso_n | |
7c0e1aa6 RL |
669 | EXPORTS |
670 | bind_engine @1 | |
671 | v_check @2 | |
672 | << | |
81183680 | 673 | $objs |
abe256e7 | 674 | $linklibs \$(DSO_EX_LIBS) |
7c0e1aa6 | 675 | << |
755542cb | 676 | IF EXIST $dso$dsoext.manifest \\ |
1fc431ba | 677 | \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso$dsoext.manifest \$(MTOUTFLAG)$dso$dsoext |
7c0e1aa6 RL |
678 | EOF |
679 | } | |
680 | sub obj2lib { | |
33105818 | 681 | my %args = @_; |
85299451 | 682 | my $lib = lib($args{lib}); |
81183680 RL |
683 | my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}}; |
684 | my $objs = join("\n", @objs); | |
685 | my $deps = join(" ", @objs); | |
7c0e1aa6 | 686 | return <<"EOF"; |
85299451 RL |
687 | $lib: $deps |
688 | \$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib @<< | |
81183680 | 689 | $objs |
7c0e1aa6 RL |
690 | << |
691 | EOF | |
692 | } | |
693 | sub obj2bin { | |
694 | my %args = @_; | |
695 | my $bin = $args{bin}; | |
81183680 RL |
696 | my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}}; |
697 | my @deps = compute_lib_depends(@{$args{deps}}); | |
698 | my $objs = join("\n", @objs); | |
699 | my $linklibs = join("", map { "$_\n" } @deps); | |
700 | my $deps = join(" ", @objs, @deps); | |
7c0e1aa6 RL |
701 | return <<"EOF"; |
702 | $bin$exeext: $deps | |
755542cb | 703 | IF EXIST $bin$exeext.manifest DEL /F /Q $bin$exeext.manifest |
2fe73036 | 704 | \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) \$(LDOUTFLAG)$bin$exeext @<< |
81183680 RL |
705 | $objs |
706 | setargv.obj | |
abe256e7 | 707 | $linklibs\$(BIN_EX_LIBS) |
7c0e1aa6 | 708 | << |
755542cb | 709 | IF EXIST $bin$exeext.manifest \\ |
1fc431ba | 710 | \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin$exeext.manifest \$(MTOUTFLAG)$bin$exeext |
7c0e1aa6 RL |
711 | EOF |
712 | } | |
713 | sub in2script { | |
714 | my %args = @_; | |
715 | my $script = $args{script}; | |
cb663908 | 716 | my $sources = '"'.join('" "', @{$args{sources}}).'"'; |
7c0e1aa6 RL |
717 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, |
718 | "util", "dofile.pl")), | |
719 | rel2abs($config{builddir})); | |
720 | return <<"EOF"; | |
721 | $script: $sources | |
cb663908 | 722 | "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
7c0e1aa6 | 723 | "-o$target{build_file}" $sources > "$script" |
0ad1d94d RL |
724 | EOF |
725 | } | |
726 | sub generatedir { | |
727 | my %args = @_; | |
728 | my $dir = $args{dir}; | |
729 | my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}}; | |
730 | my @actions = (); | |
731 | my %extinfo = ( dso => $dsoext, | |
732 | lib => $libext, | |
733 | bin => $exeext ); | |
734 | ||
222b0a8e RL |
735 | # We already have a 'test' target, and the top directory is just plain |
736 | # silly | |
737 | return if $dir eq "test" || $dir eq "."; | |
738 | ||
0ad1d94d RL |
739 | foreach my $type (("dso", "lib", "bin", "script")) { |
740 | next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); | |
850000aa RL |
741 | # For lib object files, we could update the library. However, |
742 | # LIB on Windows doesn't work that way, so we won't create any | |
743 | # actions for it, and the dependencies are already taken care of. | |
744 | if ($type ne "lib") { | |
0ad1d94d RL |
745 | foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { |
746 | if (dirname($prod) eq $dir) { | |
747 | push @deps, $prod.$extinfo{$type}; | |
0ad1d94d RL |
748 | } |
749 | } | |
750 | } | |
751 | } | |
752 | ||
753 | my $deps = join(" ", @deps); | |
754 | my $actions = join("\n", "", @actions); | |
755 | return <<"EOF"; | |
222b0a8e | 756 | $dir $dir\\ : $deps$actions |
7c0e1aa6 RL |
757 | EOF |
758 | } | |
759 | "" # Important! This becomes part of the template result. | |
760 | -} |