]>
Commit | Line | Data |
---|---|---|
7c0e1aa6 RL |
1 | ## |
2 | ## Makefile for OpenSSL | |
3 | ## | |
4 | ## {- join("\n## ", @autowarntext) -} | |
5 | {- | |
81250065 | 6 | use File::Basename; |
da51dc5f | 7 | use OpenSSL::Util; |
81250065 | 8 | |
95768961 | 9 | our $sover_dirname = platform->shlib_version_as_filename(); |
ee0a61cf | 10 | |
6a145a32 AP |
11 | my $build_scheme = $target{build_scheme}; |
12 | my $install_flavour = $build_scheme->[$#$build_scheme]; # last element | |
8c16829e | 13 | my $win_installenv = |
6a145a32 AP |
14 | $install_flavour eq "VC-WOW" ? "ProgramFiles(x86)" |
15 | : "ProgramW6432"; | |
8c16829e | 16 | my $win_commonenv = |
6a145a32 AP |
17 | $install_flavour eq "VC-WOW" ? "CommonProgramFiles(x86)" |
18 | : "CommonProgramW6432"; | |
8c16829e | 19 | our $win_installroot = |
6a145a32 | 20 | defined($ENV{$win_installenv}) ? $win_installenv : 'ProgramFiles'; |
8c16829e | 21 | our $win_commonroot = |
6a145a32 | 22 | defined($ENV{$win_commonenv}) ? $win_commonenv : 'CommonProgramFiles'; |
9921b7b6 AP |
23 | |
24 | # expand variables early | |
25 | $win_installroot = $ENV{$win_installroot}; | |
26 | $win_commonroot = $ENV{$win_commonroot}; | |
8c16829e | 27 | |
f919c12f RL |
28 | # This makes sure things get built in the order they need |
29 | # to. You're welcome. | |
30 | sub dependmagic { | |
31 | my $target = shift; | |
32 | ||
1bb38122 | 33 | return "$target: build_generated\n\t\$(MAKE) /\$(MAKEFLAGS) depend\n\t\$(MAKE) /\$(MAKEFLAGS) _$target\n_$target"; |
f919c12f | 34 | } |
7c0e1aa6 RL |
35 | ''; |
36 | -} | |
37 | ||
38 | PLATFORM={- $config{target} -} | |
39 | SRCDIR={- $config{sourcedir} -} | |
40 | BLDDIR={- $config{builddir} -} | |
31214258 | 41 | FIPSKEY={- $config{FIPSKEY} -} |
7c0e1aa6 | 42 | |
16942e08 | 43 | VERSION={- "$config{full_version}" -} |
435981cb | 44 | VERSION_NUMBER={- "$config{version}" -} |
7c0e1aa6 RL |
45 | MAJOR={- $config{major} -} |
46 | MINOR={- $config{minor} -} | |
47 | ||
3a63dbef | 48 | SHLIB_VERSION_NUMBER={- $config{shlib_version} -} |
7c0e1aa6 | 49 | |
95768961 RL |
50 | LIBS={- join(" ", map { ( platform->sharedlib_import($_), platform->staticlib($_) ) } @{$unified_info{libraries}}) -} |
51 | SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -} | |
52 | SHLIBPDBS={- join(" ", map { platform->sharedlibpdb($_) // () } @{$unified_info{libraries}}) -} | |
a2405c5f RL |
53 | MODULES={- our @MODULES = map { platform->dso($_) } |
54 | # Drop all modules that are dependencies, they will | |
55 | # be processed through their dependents | |
56 | grep { my $x = $_; | |
57 | !grep { grep { $_ eq $x } @$_ } | |
58 | values %{$unified_info{depends}} } | |
59 | @{$unified_info{modules}}; | |
f4c88073 | 60 | join(" ", @MODULES) -} |
1842f369 | 61 | MODULEPDBS={- join(" ", map { platform->dsopdb($_) } @{$unified_info{modules}}) -} |
a2405c5f RL |
62 | FIPSMODULE={- # We do some extra checking here, as there should be only one |
63 | use File::Basename; | |
64 | our @fipsmodules = | |
65 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
66 | && $unified_info{attributes}->{modules}->{$_}->{fips} } | |
67 | @{$unified_info{modules}}; | |
68 | die "More that one FIPS module" if scalar @fipsmodules > 1; | |
e47ed5fe | 69 | join(" ", map { platform->dso($_) } @fipsmodules) -} |
a2405c5f RL |
70 | FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1; |
71 | join(", ", map { basename(platform->dso($_)) } @fipsmodules) -} | |
95768961 | 72 | PROGRAMS={- our @PROGRAMS = map { platform->bin($_) } @{$unified_info{programs}}; join(" ", @PROGRAMS) -} |
1e3d16b0 | 73 | PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -} |
f4c88073 | 74 | SCRIPTS={- our @SCRIPTS = @{$unified_info{scripts}}; join(" ", @SCRIPTS) -} |
bb6b950e | 75 | {- output_off() if $disabled{makedepend}; "" -} |
95768961 | 76 | DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () } |
7c0e1aa6 RL |
77 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } |
78 | keys %{$unified_info{sources}}); -} | |
bb6b950e | 79 | {- output_on() if $disabled{makedepend}; "" -} |
f4c88073 RL |
80 | GENERATED_MANDATORY={- our @GENERATED_MANDATORY = @{$unified_info{depends}->{""}}; |
81 | join(" ", @GENERATED_MANDATORY) -} | |
8258975c | 82 | GENERATED={- # common0.tmpl provides @generated |
f4c88073 RL |
83 | our @GENERATED = map { platform->convertext($_) } @generated; |
84 | join(" ", @GENERATED) -} | |
95768961 | 85 | |
ac6bba6f RL |
86 | INSTALL_LIBS={- |
87 | join(" ", map { quotify1(platform->sharedlib_import($_) | |
88 | // platform->staticlib($_)) } | |
285daccd | 89 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } |
ac6bba6f RL |
90 | @{$unified_info{libraries}}) |
91 | -} | |
92 | INSTALL_SHLIBS={- | |
93 | join(" ", map { my $x = platform->sharedlib($_); | |
94 | $x ? quotify_l($x) : () } | |
285daccd | 95 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } |
ac6bba6f RL |
96 | @{$unified_info{libraries}}) |
97 | -} | |
98 | INSTALL_SHLIBPDBS={- | |
99 | join(" ", map { my $x = platform->sharedlibpdb($_); | |
100 | $x ? quotify_l($x) : () } | |
285daccd | 101 | grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } |
ac6bba6f RL |
102 | @{$unified_info{libraries}}) |
103 | -} | |
104 | INSTALL_ENGINES={- | |
105 | join(" ", map { quotify1(platform->dso($_)) } | |
285daccd RL |
106 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} |
107 | && $unified_info{attributes}->{modules}->{$_}->{engine} } | |
1842f369 | 108 | @{$unified_info{modules}}) |
ac6bba6f RL |
109 | -} |
110 | INSTALL_ENGINEPDBS={- | |
111 | join(" ", map { quotify1(platform->dsopdb($_)) } | |
285daccd RL |
112 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} |
113 | && $unified_info{attributes}->{modules}->{$_}->{engine} } | |
1842f369 | 114 | @{$unified_info{modules}}) |
ac6bba6f | 115 | -} |
32a5dc9e | 116 | INSTALL_MODULES={- |
5b689181 | 117 | join(" ", map { quotify1(platform->dso($_)) } |
70411a50 | 118 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} |
5b689181 DMSP |
119 | && !$unified_info{attributes}->{modules}->{$_}->{engine} |
120 | && !$unified_info{attributes}->{modules}->{$_}->{fips} } | |
70411a50 | 121 | @{$unified_info{modules}}) |
41149648 RL |
122 | -} |
123 | INSTALL_MODULEPDBS={- | |
124 | join(" ", map { quotify1(platform->dsopdb($_)) } | |
125 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
126 | && !$unified_info{attributes}->{modules}->{$_}->{engine} } | |
127 | @{$unified_info{modules}}) | |
128 | -} | |
f5657ce8 RL |
129 | INSTALL_FIPSMODULE={- |
130 | join(" ", map { quotify1(platform->dso($_)) } | |
131 | grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} | |
132 | && $unified_info{attributes}->{modules}->{$_}->{fips} } | |
133 | @{$unified_info{modules}}) | |
134 | -} | |
135 | INSTALL_FIPSMODULECONF=providers\fipsmodule.cnf | |
ac6bba6f RL |
136 | INSTALL_PROGRAMS={- |
137 | join(" ", map { quotify1(platform->bin($_)) } | |
285daccd | 138 | grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } |
ac6bba6f RL |
139 | @{$unified_info{programs}}) |
140 | -} | |
141 | INSTALL_PROGRAMPDBS={- | |
142 | join(" ", map { quotify1(platform->binpdb($_)) } | |
285daccd | 143 | grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } |
ac6bba6f RL |
144 | @{$unified_info{programs}}) |
145 | -} | |
994e86a9 RL |
146 | BIN_SCRIPTS={- |
147 | join(" ", map { quotify1($_) } | |
285daccd RL |
148 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} |
149 | && !$unified_info{attributes}->{scripts}->{$_}->{misc} } | |
994e86a9 RL |
150 | @{$unified_info{scripts}}) |
151 | -} | |
152 | MISC_SCRIPTS={- | |
153 | join(" ", map { quotify1($_) } | |
285daccd RL |
154 | grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} |
155 | && $unified_info{attributes}->{scripts}->{$_}->{misc} } | |
994e86a9 RL |
156 | @{$unified_info{scripts}}) |
157 | -} | |
c768cceb RL |
158 | INSTALL_EXPORTERS_CMAKE={- |
159 | join(" ", map { quotify1($_) } | |
160 | grep { $unified_info{attributes}->{generate}->{$_}->{exporter} eq 'cmake'} | |
161 | sort keys %{$unified_info{generate}}) | |
162 | -} | |
06621ba3 P |
163 | IMAGEDOCS1={- our @IMAGEDOCS1 = @{$unified_info{imagedocs}->{man1}}; |
164 | join(" ", @IMAGEDOCS1) -} | |
165 | IMAGEDOCS3={- our @IMAGEDOCS3 = @{$unified_info{imagedocs}->{man3}}; | |
166 | join(" ", @IMAGEDOCS3) -} | |
167 | IMAGEDOCS5={- our @IMAGEDOCS5 = @{$unified_info{imagedocs}->{man5}}; | |
168 | join(" ", @IMAGEDOCS5) -} | |
169 | IMAGEDOCS7={- our @IMAGEDOCS7 = @{$unified_info{imagedocs}->{man7}}; | |
170 | join(" ", @IMAGEDOCS7) -} | |
81250065 RL |
171 | HTMLDOCS1={- our @HTMLDOCS1 = @{$unified_info{htmldocs}->{man1}}; |
172 | join(" ", @HTMLDOCS1) -} | |
173 | HTMLDOCS3={- our @HTMLDOCS3 = @{$unified_info{htmldocs}->{man3}}; | |
174 | join(" ", @HTMLDOCS3) -} | |
175 | HTMLDOCS5={- our @HTMLDOCS5 = @{$unified_info{htmldocs}->{man5}}; | |
176 | join(" ", @HTMLDOCS5) -} | |
177 | HTMLDOCS7={- our @HTMLDOCS7 = @{$unified_info{htmldocs}->{man7}}; | |
178 | join(" ", @HTMLDOCS7) -} | |
179 | HTMLDOCS1_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS1; | |
180 | join(' ', sort keys %dirs) -} | |
181 | HTMLDOCS3_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS3; | |
182 | join(' ', sort keys %dirs) -} | |
183 | HTMLDOCS5_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS5; | |
184 | join(' ', sort keys %dirs) -} | |
185 | HTMLDOCS7_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS7; | |
186 | join(' ', sort keys %dirs) -} | |
0f01b7bc | 187 | |
a3f1fc25 RL |
188 | APPS_OPENSSL="{- use File::Spec::Functions; |
189 | catfile("apps","openssl") -}" | |
6a74806e | 190 | |
7c0e1aa6 RL |
191 | # Do not edit these manually. Use Configure with --prefix or --openssldir |
192 | # to change this! Short explanation in the top comment in Configure | |
b8bbd8b1 RL |
193 | INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet |
194 | # | |
195 | use File::Spec::Functions qw(:DEFAULT splitpath); | |
dc6a62d5 RL |
196 | our $prefix = canonpath($config{prefix} |
197 | || "$win_installroot\\OpenSSL"); | |
b8bbd8b1 | 198 | our ($prefix_dev, $prefix_dir, $prefix_file) = |
0685b15a | 199 | splitpath($prefix, 1); |
b8bbd8b1 | 200 | $prefix_dev -} |
dc6a62d5 | 201 | INSTALLTOP_dir={- canonpath($prefix_dir) -} |
b8bbd8b1 RL |
202 | OPENSSLDIR_dev={- # |
203 | # The logic here is that if no --openssldir was given, | |
f8baec39 | 204 | # OPENSSLDIR will get the value "$win_commonroot\\SSL". |
b8bbd8b1 RL |
205 | # If --openssldir was given and the value is an absolute |
206 | # path, OPENSSLDIR will get its value without change. | |
207 | # If the value from --openssldir is a relative path, | |
208 | # OPENSSLDIR will get $prefix with the --openssldir | |
209 | # value appended as a subdirectory. | |
210 | # | |
211 | use File::Spec::Functions qw(:DEFAULT splitpath); | |
3ffb060e | 212 | our $openssldir = |
b8bbd8b1 RL |
213 | $config{openssldir} ? |
214 | (file_name_is_absolute($config{openssldir}) ? | |
dc6a62d5 | 215 | canonpath($config{openssldir}) |
b8bbd8b1 | 216 | : catdir($prefix, $config{openssldir})) |
dc6a62d5 | 217 | : canonpath("$win_commonroot\\SSL"); |
b8bbd8b1 RL |
218 | our ($openssldir_dev, $openssldir_dir, $openssldir_file) = |
219 | splitpath($openssldir, 1); | |
220 | $openssldir_dev -} | |
dc6a62d5 | 221 | OPENSSLDIR_dir={- canonpath($openssldir_dir) -} |
8c16829e | 222 | LIBDIR={- our $libdir = $config{libdir} || "lib"; |
e454f3ad | 223 | file_name_is_absolute($libdir) ? "" : $libdir -} |
52eb5b7c | 224 | MODULESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath catpath); |
3f4e8d66 RL |
225 | our $modulesprefix = catdir($prefix,$libdir); |
226 | our ($modulesprefix_dev, $modulesprefix_dir, | |
227 | $modulesprefix_file) = | |
228 | splitpath($modulesprefix, 1); | |
229 | our $modulesdir_dev = $modulesprefix_dev; | |
230 | our $modulesdir_dir = | |
231 | catdir($modulesprefix_dir, "ossl-modules"); | |
232 | our $modulesdir = catpath($modulesdir_dev, $modulesdir_dir); | |
233 | our $enginesdir_dev = $modulesprefix_dev; | |
52eb5b7c | 234 | our $enginesdir_dir = |
3f4e8d66 RL |
235 | catdir($modulesprefix_dir, "engines-$sover_dirname"); |
236 | our $enginesdir = catpath($enginesdir_dev, $enginesdir_dir); | |
237 | $modulesdir_dev -} | |
238 | MODULESDIR_dir={- canonpath($modulesdir_dir) -} | |
239 | ENGINESDIR_dev={- $enginesdir_dev -} | |
dc6a62d5 | 240 | ENGINESDIR_dir={- canonpath($enginesdir_dir) -} |
b8bbd8b1 RL |
241 | !IF "$(DESTDIR)" != "" |
242 | INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir) | |
243 | OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir) | |
244 | ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir) | |
3f4e8d66 | 245 | MODULESDIR=$(DESTDIR)$(MODULESDIR_dir) |
b8bbd8b1 RL |
246 | !ELSE |
247 | INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir) | |
248 | OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir) | |
249 | ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir) | |
3f4e8d66 | 250 | MODULESDIR=$(MODULESDIR_dev)$(MODULESDIR_dir) |
b8bbd8b1 | 251 | !ENDIF |
7c0e1aa6 | 252 | |
e454f3ad RL |
253 | # $(libdir) is chosen to be compatible with the GNU coding standards |
254 | libdir={- file_name_is_absolute($libdir) | |
255 | ? $libdir : '$(INSTALLTOP)\$(LIBDIR)' -} | |
256 | ||
c768cceb RL |
257 | CMAKECONFIGDIR=$(libdir)\cmake\OpenSSL |
258 | ||
abe256e7 RL |
259 | ##### User defined commands and flags ################################ |
260 | ||
b5756085 | 261 | CC="{- $config{CC} -}" |
16f2a444 | 262 | CPP={- $config{CPP} -} |
abe256e7 RL |
263 | CPPFLAGS={- our $cppflags1 = join(" ", |
264 | (map { "-D".$_} @{$config{CPPDEFINES}}), | |
118faf5f | 265 | (map { " -I".$_} @{$config{CPPINCLUDES}}), |
abe256e7 RL |
266 | @{$config{CPPFLAGS}}) -} |
267 | CFLAGS={- join(' ', @{$config{CFLAGS}}) -} | |
b5756085 | 268 | LD="{- $config{LD} -}" |
abe256e7 RL |
269 | LDFLAGS={- join(' ', @{$config{LDFLAGS}}) -} |
270 | EX_LIBS={- join(' ', @{$config{LDLIBS}}) -} | |
7c0e1aa6 | 271 | |
9e265322 | 272 | PERL={- $config{PERL} -} |
7c0e1aa6 | 273 | |
b5756085 | 274 | AR="{- $config{AR} -}" |
abe256e7 RL |
275 | ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -} |
276 | ||
b5756085 | 277 | MT="{- $config{MT} -}" |
abe256e7 RL |
278 | MTFLAGS= {- join(' ', @{$config{MTFLAGS}}) -} |
279 | ||
b5756085 | 280 | AS="{- $config{AS} -}" |
abe256e7 | 281 | ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -} |
7c0e1aa6 | 282 | |
b5756085 | 283 | RC="{- $config{RC} -}" |
a583172d | 284 | RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} |
755542cb | 285 | |
9abce88b RL |
286 | ECHO="$(PERL)" "$(SRCDIR)\util\echo.pl" |
287 | ||
abe256e7 RL |
288 | ##### Special command flags ########################################## |
289 | ||
290 | COUTFLAG={- $target{coutflag} -}$(OSSL_EMPTY) | |
291 | LDOUTFLAG={- $target{ldoutflag} -}$(OSSL_EMPTY) | |
292 | AROUTFLAG={- $target{aroutflag} -}$(OSSL_EMPTY) | |
293 | MTINFLAG={- $target{mtinflag} -}$(OSSL_EMPTY) | |
294 | MTOUTFLAG={- $target{mtoutflag} -}$(OSSL_EMPTY) | |
1fc431ba | 295 | ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY) |
abe256e7 RL |
296 | RCOUTFLAG={- $target{rcoutflag} -}$(OSSL_EMPTY) |
297 | ||
298 | ##### Project flags ################################################## | |
299 | ||
300 | # Variables starting with CNF_ are common variables for all product types | |
301 | ||
302 | CNF_ASFLAGS={- join(' ', $target{asflags} || (), | |
303 | @{$config{asflags}}) -} | |
304 | CNF_CPPFLAGS={- our $cppfags2 = | |
305 | join(' ', $target{cppflags} || (), | |
2cc8fe11 RL |
306 | (map { '-D'.quotify1($_) } @{$target{defines}}, |
307 | @{$config{defines}}), | |
a1736f37 | 308 | (map { '-I'.'"'.$_.'"' } @{$target{includes}}, |
309 | @{$config{includes}}), | |
abe256e7 RL |
310 | @{$config{cppflags}}) -} |
311 | CNF_CFLAGS={- join(' ', $target{cflags} || (), | |
312 | @{$config{cflags}}) -} | |
313 | CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (), | |
314 | @{$config{cxxflags}}) -} | |
315 | CNF_LDFLAGS={- join(' ', $target{lflags} || (), | |
316 | @{$config{lflags}}) -} | |
317 | CNF_EX_LIBS={- join(' ', $target{ex_libs} || (), | |
318 | @{$config{ex_libs}}) -} | |
319 | ||
320 | # Variables starting with LIB_ are used to build library object files | |
321 | # and shared libraries. | |
322 | # Variables starting with DSO_ are used to build DSOs and their object files. | |
323 | # Variables starting with BIN_ are used to build programs and their object | |
324 | # files. | |
325 | ||
326 | LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (), | |
327 | @{$config{lib_asflags}}, | |
328 | '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} | |
58d6be5b RL |
329 | LIB_CPPFLAGS={- our $lib_cppflags = |
330 | join(' ', $target{lib_cppflags} || (), | |
abe256e7 | 331 | $target{shared_cppflag} || (), |
2cc8fe11 | 332 | (map { '-D'.quotify1($_) } |
abe256e7 RL |
333 | @{$target{lib_defines}}, |
334 | @{$target{shared_defines}}, | |
335 | @{$config{lib_defines}}, | |
58d6be5b | 336 | @{$config{shared_defines}}), |
2cc8fe11 | 337 | (map { '-I'.quotify1($_) } |
abe256e7 RL |
338 | @{$target{lib_includes}}, |
339 | @{$target{shared_includes}}, | |
340 | @{$config{lib_includes}}, | |
341 | @{$config{shared_includes}}), | |
342 | @{$config{lib_cppflags}}, | |
58d6be5b RL |
343 | @{$config{shared_cppflag}}); |
344 | join(' ', $lib_cppflags, | |
2cc8fe11 | 345 | (map { '-D'.quotify1($_) } |
58d6be5b | 346 | "OPENSSLDIR=\"$openssldir\"", |
3f4e8d66 RL |
347 | "ENGINESDIR=\"$enginesdir\"", |
348 | "MODULESDIR=\"$modulesdir\""), | |
abe256e7 RL |
349 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} |
350 | LIB_CFLAGS={- join(' ', $target{lib_cflags} || (), | |
351 | $target{shared_cflag} || (), | |
352 | @{$config{lib_cflags}}, | |
353 | @{$config{shared_cflag}}, | |
354 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
355 | LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (), | |
356 | $config{shared_ldflag} || (), | |
357 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
358 | LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
359 | DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (), | |
360 | $target{module_asflags} || (), | |
361 | @{$config{dso_asflags}}, | |
362 | @{$config{module_asflags}}, | |
363 | '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} | |
364 | DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (), | |
41525ed6 MC |
365 | $target{module_cppflag} || (), |
366 | (map { '-D'.quotify1($_) } | |
367 | @{$target{dso_defines}}, | |
368 | @{$target{module_defines}}, | |
369 | @{$config{dso_defines}}, | |
370 | @{$config{module_defines}}), | |
371 | (map { '-I'.quotify1($_) } | |
372 | @{$target{dso_includes}}, | |
373 | @{$target{module_includes}}, | |
374 | @{$config{dso_includes}}, | |
375 | @{$config{module_includes}}), | |
abe256e7 RL |
376 | @{$config{dso_cppflags}}, |
377 | @{$config{module_cppflags}}, | |
378 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
379 | DSO_CFLAGS={- join(' ', $target{dso_cflags} || (), | |
380 | $target{module_cflags} || (), | |
381 | @{$config{dso_cflags}}, | |
382 | @{$config{module_cflags}}, | |
383 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
384 | DSO_LDFLAGS={- join(' ', $target{dso_lflags} || (), | |
385 | $target{module_ldflags} || (), | |
386 | @{$config{dso_lflags}}, | |
387 | @{$config{module_ldflags}}, | |
388 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
389 | DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
390 | BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (), | |
391 | @{$config{bin_asflags}}, | |
392 | '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} | |
393 | BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (), | |
d368d9d2 | 394 | (map { '-D'.$_ } @{$config{bin_defines} || ()}), |
abe256e7 RL |
395 | @{$config{bin_cppflags}}, |
396 | '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} | |
397 | BIN_CFLAGS={- join(' ', $target{bin_cflags} || (), | |
398 | @{$config{bin_cflags}}, | |
399 | '$(CNF_CFLAGS)', '$(CFLAGS)') -} | |
400 | BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), | |
401 | @{$config{bin_lflags}}, | |
402 | '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} | |
403 | BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) | |
404 | ||
405 | # CPPFLAGS_Q is used for one thing only: to build up buildinf.h | |
406 | CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; | |
407 | $cppflags2 =~ s|([\\"])|\\$1|g; | |
58d6be5b RL |
408 | join(' ', $lib_cppflags || (), $cppflags2 || (), |
409 | $cppflags1 || ()) -} | |
abe256e7 | 410 | |
7c0e1aa6 RL |
411 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} |
412 | ||
413 | PROCESSOR= {- $config{processor} -} | |
414 | ||
415 | # The main targets ################################################### | |
416 | ||
c3845ceb | 417 | {- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep copy-utils |
f919c12f | 418 | {- dependmagic('build_libs'); -}: build_libs_nodep |
1842f369 | 419 | {- dependmagic('build_modules'); -}: build_modules_nodep |
f919c12f | 420 | {- dependmagic('build_programs'); -}: build_programs_nodep |
7c0e1aa6 | 421 | |
b0940b33 RL |
422 | build_docs: build_html_docs |
423 | build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) | |
830cd025 | 424 | @ |
f919c12f | 425 | build_generated: $(GENERATED_MANDATORY) |
830cd025 | 426 | @ |
95768961 | 427 | build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -} |
830cd025 | 428 | @ |
1842f369 | 429 | build_modules_nodep: $(MODULES) |
830cd025 | 430 | @ |
1e3d16b0 | 431 | build_programs_nodep: $(PROGRAMS) $(SCRIPTS) |
830cd025 | 432 | @ |
7c0e1aa6 | 433 | |
1e3d16b0 RL |
434 | # Kept around for backward compatibility |
435 | build_apps build_tests: build_programs | |
436 | ||
9b03b91b RL |
437 | # Convenience target to prebuild all generated files, not just the mandatory |
438 | # ones | |
b0940b33 | 439 | build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs |
53111a88 | 440 | @{- output_off() if $disabled{makedepend}; "\@rem" -} |
9abce88b RL |
441 | @$(ECHO) "Warning: consider configuring with no-makedepend, because if" |
442 | @$(ECHO) " target system doesn't have $(PERL)," | |
443 | @$(ECHO) " then make will fail..." | |
53111a88 | 444 | @{- output_on() if $disabled{makedepend}; "\@rem" -} |
9b03b91b | 445 | |
956b4c75 | 446 | all: build_sw {- "build_docs" if !$disabled{docs}; -} |
b0940b33 | 447 | |
1b741653 | 448 | test: tests |
c3845ceb | 449 | {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep copy-utils |
53111a88 | 450 | @{- output_off() if $disabled{tests}; "\@rem" -} |
583a9f1f | 451 | cmd /C "set "SRCTOP=$(SRCDIR)" & set "BLDTOP=$(BLDDIR)" & set "PERL=$(PERL)" & set "FIPSKEY=$(FIPSKEY)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)" |
1b6a0a26 | 452 | @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
9abce88b | 453 | @$(ECHO) "Tests are not supported with your chosen Configure options" |
53111a88 | 454 | @{- output_on() if !$disabled{tests}; "\@rem" -} |
7c0e1aa6 RL |
455 | |
456 | list-tests: | |
53111a88 | 457 | @{- output_off() if $disabled{tests}; "\@rem" -} |
583a9f1f | 458 | @cmd /C "set "SRCTOP=$(SRCDIR)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" list" |
1b6a0a26 | 459 | @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
9abce88b | 460 | @$(ECHO) "Tests are not supported with your chosen Configure options" |
53111a88 | 461 | @{- output_on() if !$disabled{tests}; "\@rem" -} |
7c0e1aa6 | 462 | |
956b4c75 | 463 | install: install_sw install_ssldirs {- "install_docs" if !$disabled{docs}; -} {- $disabled{fips} ? "" : "install_fips" -} |
8c16829e | 464 | |
956b4c75 | 465 | uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} |
8c16829e | 466 | |
3415c711 | 467 | libclean: |
dead788f AP |
468 | "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """{.,apps,test,fuzz}/$$1.*"""; } @ARGV" $(SHLIBS) |
469 | -del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb | |
3415c711 RL |
470 | |
471 | clean: libclean | |
bc6d9c93 MC |
472 | {- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS1) || "\@rem" -} |
473 | {- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS3) || "\@rem" -} | |
474 | {- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS5) || "\@rem" -} | |
475 | {- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS7) || "\@rem" -} | |
53111a88 RL |
476 | {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) || "\@rem" -} |
477 | {- join("\n\t", map { "-del /Q /F $_" } @MODULES) || "\@rem" -} | |
478 | {- join("\n\t", map { "-del /Q /F $_" } @SCRIPTS) || "\@rem" -} | |
479 | {- join("\n\t", map { "-del /Q /F $_" } @GENERATED_MANDATORY) || "\@rem" -} | |
480 | {- join("\n\t", map { "-del /Q /F $_" } @GENERATED) || "\@rem" -} | |
4ffc1842 F |
481 | -del /Q /S /F *.d *.obj *.pdb *.ilk *.manifest |
482 | -del /Q /S /F engines\*.lib engines\*.exp | |
483 | -del /Q /S /F apps\*.lib apps\*.rc apps\*.res apps\*.exp | |
484 | -del /Q /S /F test\*.exp | |
6d2e0076 | 485 | -rd /Q /S test\test-runs |
3415c711 | 486 | |
7cae3864 | 487 | distclean: clean |
ef8040bc | 488 | -del /Q /F include\openssl\configuration.h |
7cae3864 RL |
489 | -del /Q /F configdata.pm |
490 | -del /Q /F makefile | |
491 | ||
468d1517 | 492 | depend: makefile |
53111a88 | 493 | @ {- output_off() if $disabled{makedepend}; "\@rem" -} |
2e535eb5 | 494 | @ "$(PERL)" "$(SRCDIR)\util\add-depends.pl" "{- $target{makedep_scheme} -}" |
53111a88 | 495 | @ {- output_on() if $disabled{makedepend}; "\@rem" -} |
7c0e1aa6 | 496 | |
8c16829e RL |
497 | # Install helper targets ############################################# |
498 | ||
41149648 | 499 | install_sw: install_dev install_engines install_modules install_runtime |
8c16829e | 500 | |
41149648 | 501 | uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev |
8c16829e | 502 | |
4813ad2d | 503 | install_docs: install_html_docs |
8c16829e | 504 | |
4813ad2d | 505 | uninstall_docs: uninstall_html_docs |
8c16829e | 506 | |
18da9fc3 | 507 | {- output_off() if $disabled{fips}; "" -} |
25ab5424 | 508 | install_fips: build_sw $(INSTALL_FIPSMODULECONF) |
5b689181 | 509 | # @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) |
709651c9 RL |
510 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(MODULESDIR)" |
511 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)" | |
5b689181 | 512 | @$(ECHO) "*** Installing FIPS module" |
f5657ce8 | 513 | @$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(MODULESDIR)\$(FIPSMODULENAME)" |
a8f35a55 | 514 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(INSTALL_FIPSMODULE)" "$(MODULESDIR)" |
403a5edc | 515 | @$(ECHO) "*** Installing FIPS module configuration" |
f5657ce8 | 516 | @$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(OPENSSLDIR)\fipsmodule.cnf" |
a8f35a55 | 517 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(INSTALL_FIPSMODULECONF)" "$(OPENSSLDIR)" |
403a5edc | 518 | |
5b689181 | 519 | uninstall_fips: |
403a5edc | 520 | @$(ECHO) "*** Uninstalling FIPS module configuration" |
c3bda8a2 | 521 | $(RM) "$(OPENSSLDIR)\fipsmodule.cnf" |
5b689181 DMSP |
522 | @$(ECHO) "*** Uninstalling FIPS module" |
523 | $(RM) "$(MODULESDIR)\$(FIPSMODULENAME)" | |
18da9fc3 DMSP |
524 | {- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -} |
525 | install_fips: | |
526 | @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option" | |
527 | ||
528 | uninstall_fips: | |
529 | @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option" | |
530 | {- output_on() if !$disabled{fips}; "" -} | |
403a5edc | 531 | |
8c16829e | 532 | install_ssldirs: |
b8bbd8b1 RL |
533 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs" |
534 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private" | |
535 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc" | |
cb663908 | 536 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \ |
cb926df2 RL |
537 | "$(OPENSSLDIR)\openssl.cnf.dist" |
538 | @IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \ | |
539 | "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \ | |
540 | "$(OPENSSLDIR)\openssl.cnf" | |
b5756085 HM |
541 | @if not "$(MISC_SCRIPTS)"=="" \ |
542 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \ | |
b8bbd8b1 | 543 | "$(OPENSSLDIR)\misc" |
c7af65c7 RS |
544 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \ |
545 | "$(OPENSSLDIR)\ct_log_list.cnf.dist" | |
546 | @IF NOT EXIST "$(OPENSSLDIR)\ct_log_list.cnf" \ | |
547 | "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \ | |
548 | "$(OPENSSLDIR)\ct_log_list.cnf" | |
8c16829e | 549 | |
c1123d9f | 550 | install_dev: install_runtime_libs |
9abce88b RL |
551 | @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) |
552 | @$(ECHO) "*** Installing development files" | |
b8bbd8b1 | 553 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl" |
6d56fcd8 | 554 | @{- output_off() if $disabled{uplink}; "" -} |
24c4f736 RL |
555 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \ |
556 | "$(INSTALLTOP)\include\openssl" | |
6d56fcd8 | 557 | @{- output_on() if $disabled{uplink}; "" -} |
246bd8fd RL |
558 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "-exclude_re=/__DECC_" \ |
559 | "$(SRCDIR)\include\openssl\*.h" \ | |
b8bbd8b1 | 560 | "$(INSTALLTOP)\include\openssl" |
fb853fa2 | 561 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(BLDDIR)\include\openssl\*.h" \ |
b8bbd8b1 | 562 | "$(INSTALLTOP)\include\openssl" |
e454f3ad RL |
563 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)" |
564 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)" | |
3ec8a1cf | 565 | @if "$(SHLIBS)"=="" \ |
e454f3ad | 566 | "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)" |
c768cceb RL |
567 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(CMAKECONFIGDIR)" |
568 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_EXPORTERS_CMAKE) "$(CMAKECONFIGDIR)" | |
8c16829e RL |
569 | |
570 | uninstall_dev: | |
571 | ||
41149648 RL |
572 | _install_modules_deps: install_runtime_libs build_modules |
573 | ||
574 | install_engines: _install_modules_deps | |
9abce88b | 575 | @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) |
41149648 | 576 | @$(ECHO) "*** Installing engines" |
b8bbd8b1 | 577 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)" |
1842f369 | 578 | @if not "$(INSTALL_ENGINES)"=="" \ |
0f01b7bc | 579 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)" |
1842f369 | 580 | @if not "$(INSTALL_ENGINES)"=="" \ |
0f01b7bc | 581 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)" |
8c16829e RL |
582 | |
583 | uninstall_engines: | |
584 | ||
41149648 RL |
585 | install_modules: _install_modules_deps |
586 | @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) | |
587 | @$(ECHO) "*** Installing modules" | |
588 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(MODULESDIR)" | |
589 | @if not "$(INSTALL_MODULES)"=="" \ | |
590 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULES) "$(MODULESDIR)" | |
591 | @if not "$(INSTALL_MODULES)"=="" \ | |
592 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULEPDBS) "$(MODULESDIR)" | |
593 | ||
594 | uninstall_modules: | |
595 | ||
c1123d9f RL |
596 | install_runtime: install_programs |
597 | ||
e8d01a60 | 598 | install_runtime_libs: build_libs |
9abce88b | 599 | @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) |
c1123d9f | 600 | @$(ECHO) "*** Installing runtime libraries" |
b8bbd8b1 | 601 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin" |
8c16829e | 602 | @if not "$(SHLIBS)"=="" \ |
0f01b7bc | 603 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin" |
3ec8a1cf | 604 | @if not "$(SHLIBS)"=="" \ |
0f01b7bc | 605 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \ |
b8bbd8b1 | 606 | "$(INSTALLTOP)\bin" |
c1123d9f | 607 | |
e8d01a60 | 608 | install_programs: install_runtime_libs build_programs |
c1123d9f RL |
609 | @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) |
610 | @$(ECHO) "*** Installing runtime programs" | |
b5756085 HM |
611 | @if not "$(INSTALL_PROGRAMS)"=="" \ |
612 | "$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin" | |
613 | @if not "$(INSTALL_PROGRAMS)"=="" \ | |
614 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \ | |
b8bbd8b1 | 615 | "$(INSTALLTOP)\bin" |
b5756085 HM |
616 | @if not "$(INSTALL_PROGRAMS)"=="" \ |
617 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \ | |
b8bbd8b1 | 618 | "$(INSTALLTOP)\bin" |
b5756085 HM |
619 | @if not "$(INSTALL_PROGRAMS)"=="" \ |
620 | "$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \ | |
b8bbd8b1 | 621 | "$(INSTALLTOP)\bin" |
8c16829e RL |
622 | |
623 | uninstall_runtime: | |
624 | ||
06621ba3 | 625 | install_html_docs: install_image_docs build_html_docs |
b0940b33 RL |
626 | @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 ) |
627 | @echo *** Installing HTML docs | |
628 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man1" | |
629 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man3" | |
630 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man5" | |
631 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7" | |
632 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man1\*.html \ | |
633 | "$(INSTALLTOP)\html\man1" | |
634 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man3\*.html \ | |
635 | "$(INSTALLTOP)\html\man3" | |
636 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man5\*.html \ | |
637 | "$(INSTALLTOP)\html\man5" | |
638 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man7\*.html \ | |
639 | "$(INSTALLTOP)\html\man7" | |
4813ad2d | 640 | |
06621ba3 P |
641 | uninstall_html_docs: uninstall_image_docs |
642 | ||
643 | install_image_docs: | |
644 | @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 ) | |
645 | @echo *** Installing HTML images | |
06621ba3 | 646 | @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7\img" |
06621ba3 P |
647 | @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(SRCDIR)\doc\man7\img\*.png \ |
648 | "$(INSTALLTOP)\html\man7\img" | |
649 | ||
650 | uninstall_image_docs: | |
4813ad2d | 651 | |
c3845ceb RL |
652 | # Helper targets ##################################################### |
653 | ||
0eed845c | 654 | copy-utils: $(BLDDIR)\apps\openssl.cnf |
c3845ceb | 655 | |
468d1517 | 656 | $(BLDDIR)\apps\openssl.cnf: makefile |
3ab736ac DMSP |
657 | @if NOT EXIST "$(BLDDIR)\apps" mkdir "$(BLDDIR)\apps" |
658 | @if NOT "$(SRCDIR)"=="$(BLDDIR)" copy "$(SRCDIR)\apps\$(@F)" "$(BLDDIR)\apps" | |
659 | ||
7c0e1aa6 RL |
660 | # Building targets ################################################### |
661 | ||
468d1517 RL |
662 | makefile: configdata.pm {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}) -} |
663 | @$(ECHO) "Detected changed: $?" | |
664 | "$(PERL)" configdata.pm | |
665 | @$(ECHO) "**************************************************" | |
666 | @$(ECHO) "*** ***" | |
667 | @$(ECHO) "*** Please run the same make command again ***" | |
668 | @$(ECHO) "*** ***" | |
669 | @$(ECHO) "**************************************************" | |
670 | @exit 1 | |
671 | ||
672 | configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_infos}}, @{$config{conf_files}}) -} | |
9abce88b | 673 | @$(ECHO) "Detected changed: $?" |
a1b6933e | 674 | "$(PERL)" configdata.pm -r |
9abce88b RL |
675 | @$(ECHO) "**************************************************" |
676 | @$(ECHO) "*** ***" | |
677 | @$(ECHO) "*** Please run the same make command again ***" | |
678 | @$(ECHO) "*** ***" | |
679 | @$(ECHO) "**************************************************" | |
6ddb62a5 | 680 | @exit 1 |
7c0e1aa6 | 681 | |
bf01fbbf | 682 | reconfigure reconf: |
a1b6933e | 683 | "$(PERL)" configdata.pm -r |
bf01fbbf | 684 | |
7c0e1aa6 RL |
685 | {- |
686 | use File::Basename; | |
8557bdde | 687 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs file_name_is_absolute/; |
7c0e1aa6 | 688 | |
6dd07a93 RL |
689 | # Helper function to convert dependencies in platform agnostic form to |
690 | # dependencies in platform form. | |
691 | sub compute_platform_depends { | |
692 | map { my $x = $_; | |
693 | ||
694 | grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x) | |
695 | or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x) | |
696 | or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x) | |
697 | or platform->convertext($x); } @_; | |
698 | } | |
699 | ||
7c0e1aa6 RL |
700 | # Helper function to figure out dependencies on libraries |
701 | # It takes a list of library names and outputs a list of dependencies | |
702 | sub compute_lib_depends { | |
703 | if ($disabled{shared}) { | |
95768961 | 704 | return map { platform->staticlib($_) } @_; |
7c0e1aa6 | 705 | } |
95768961 | 706 | return map { platform->sharedlib_import($_) // platform->staticlib($_) } @_; |
7c0e1aa6 RL |
707 | } |
708 | ||
3f399e37 RL |
709 | sub generatetarget { |
710 | my %args = @_; | |
6dd07a93 | 711 | my $deps = join(" ", compute_platform_depends(@{$args{deps}})); |
3f399e37 RL |
712 | return <<"EOF"; |
713 | $args{target}: $deps | |
714 | EOF | |
715 | } | |
716 | ||
847f41d9 TI |
717 | # This function (and the next) avoids quoting paths of generated dependencies |
718 | # (in the build tree), but quotes paths of non-generated dependencies (in the | |
719 | # source tree). This is a workaround for a limitation of C++Builder's make.exe | |
720 | # in handling quoted paths: https://quality.embarcadero.com/browse/RSP-31756 | |
9a1394c5 RL |
721 | sub generatesrc { |
722 | my %args = @_; | |
79f47ef5 RL |
723 | my $gen0 = $args{generator}->[0]; |
724 | my $gen_args = join('', map { " $_" } | |
725 | @{$args{generator}}[1..$#{$args{generator}}]); | |
118faf5f TI |
726 | my $gen_incs = join("", map { " -I\"$_\"" } @{$args{generator_incs}}); |
727 | my $incs = join("", map { " -I\"$_\"" } @{$args{incs}}); | |
de158198 | 728 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
6dd07a93 RL |
729 | my $deps = join(' ', |
730 | map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ } | |
731 | compute_platform_depends(@{$args{generator_deps}}, | |
732 | @{$args{deps}})); | |
9a1394c5 | 733 | |
b0940b33 | 734 | if ($args{src} =~ /\.html$/) { |
79f47ef5 RL |
735 | # |
736 | # HTML generator | |
737 | # | |
738 | my $title = basename($args{src}, ".html"); | |
739 | my $pod = $gen0; | |
740 | return <<"EOF"; | |
98706c5a | 741 | $args{src}: "$pod" |
02669b67 | 742 | "\$(PERL)" "\$(SRCDIR)/util/mkpod2html.pl" -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc" |
b0940b33 RL |
743 | EOF |
744 | } elsif (platform->isdef($args{src})) { | |
79f47ef5 RL |
745 | # |
746 | # Linker script-ish generator | |
747 | # | |
95768961 | 748 | my $target = platform->def($args{src}); |
ef2dfc99 RL |
749 | my $mkdef = abs2rel(rel2abs(catfile($config{sourcedir}, |
750 | "util", "mkdef.pl")), | |
751 | rel2abs($config{builddir})); | |
435981cb | 752 | my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : ''; |
66a24ab8 | 753 | my $ord_name = |
5cc9ab5c | 754 | $args{generator}->[1] || basename(platform->dsoname($args{product})); |
ef2dfc99 | 755 | return <<"EOF"; |
79f47ef5 | 756 | $target: $gen0 $deps $mkdef |
e5f831a0 | 757 | "\$(PERL)" "$mkdef"$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS windows > $target |
7cae3864 | 758 | EOF |
b8d3cf09 RL |
759 | } elsif (platform->isasm($args{src}) |
760 | || platform->iscppasm($args{src})) { | |
79f47ef5 RL |
761 | # |
762 | # Assembler generator | |
763 | # | |
593d5c2f RL |
764 | my $cppflags = { |
765 | shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', | |
766 | lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', | |
767 | dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', | |
768 | bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' | |
769 | } -> {$args{intent}}; | |
b8d3cf09 RL |
770 | my $target = platform->isasm($args{src}) |
771 | ? platform->asm($args{src}) | |
772 | : $args{src}; | |
593d5c2f | 773 | |
79f47ef5 RL |
774 | my $generator; |
775 | if ($gen0 =~ /\.pl$/) { | |
3b85d9de | 776 | $generator = '"$(PERL)"'.$gen_incs.' "'.$gen0.'"'.$gen_args |
e5a054b7 | 777 | .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)'; |
79f47ef5 | 778 | } elsif ($gen0 =~ /\.S$/) { |
9a1394c5 RL |
779 | $generator = undef; |
780 | } else { | |
79f47ef5 | 781 | die "Generator type for $src unknown: $gen0\n"; |
9a1394c5 RL |
782 | } |
783 | ||
784 | if (defined($generator)) { | |
9a1394c5 | 785 | return <<"EOF"; |
79f47ef5 | 786 | $target: "$gen0" $deps |
583a9f1f | 787 | cmd /C "set "ASM=\$(AS)" & $generator \$@" |
9a1394c5 RL |
788 | EOF |
789 | } | |
790 | return <<"EOF"; | |
79f47ef5 | 791 | $target: "$gen0" $deps |
b863e1e4 | 792 | \$(CPP) /D__ASSEMBLER__ $incs $cppflags $defs "$gen0" > \$@.i |
1bb38122 | 793 | move /Y \$@.i \$@ |
79f47ef5 RL |
794 | EOF |
795 | } elsif ($gen0 =~ m|^.*\.in$|) { | |
796 | # | |
797 | # "dofile" generator (file.in -> file) | |
798 | # | |
799 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
800 | "util", "dofile.pl")), | |
801 | rel2abs($config{builddir})); | |
b684ee2c RL |
802 | my @perlmodules = (); |
803 | my %perlmoduleincs = (); | |
804 | my %perlmoduledeps = (); | |
805 | foreach my $x (('configdata.pm', @{$args{deps}})) { | |
806 | # Compute (i)nclusion directory, (m)odule name and (d)ependency | |
807 | my $i, $m, $d; | |
808 | if ($x =~ /\|/) { | |
809 | $i = $`; | |
810 | $d = $'; | |
811 | ||
812 | # Massage the module part to become a real perl module spec | |
813 | $m = $d; | |
814 | $m =~ s|\.pm$||; | |
815 | # Directory specs are :: in perl package names | |
816 | $m =~ s|/|::|g; | |
817 | ||
818 | # Full file name of the dependency | |
819 | $d = catfile($i, $d) if $i; | |
820 | } elsif ($x =~ /\.pm$/) { | |
821 | $i = dirname($x); | |
822 | $m = basename($x, '.pm'); | |
823 | $d = $x; | |
824 | } else { | |
825 | # All other dependencies are simply collected | |
826 | $d = $x; | |
827 | } | |
828 | push @perlmodules, '"-M'.$m.'"' if $m; | |
829 | $perlmoduledeps{$d} = 1; | |
830 | $perlmoduleincs{'"-I'.$i.'"'} = 1 if $i; | |
831 | } | |
832 | ||
833 | # Because of the special treatment of dependencies, we need to | |
834 | # recompute $deps completely | |
835 | my $deps | |
836 | = join(" ", compute_platform_depends(@{$args{generator_deps}}, | |
837 | sort keys %perlmoduledeps)); | |
838 | my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules); | |
839 | ||
79f47ef5 RL |
840 | return <<"EOF"; |
841 | $args{src}: "$gen0" $deps | |
6dd07a93 | 842 | "\$(PERL)"$perlmodules "$dofile" "-o$target{build_file}" "$gen0"$gen_args > \$@ |
79f47ef5 RL |
843 | EOF |
844 | } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) { | |
845 | # | |
846 | # Generic generator using OpenSSL programs | |
847 | # | |
848 | ||
6dd07a93 | 849 | # Redo $gen0, to ensure that we have the proper extension. |
79f47ef5 RL |
850 | $gen0 = platform->bin($gen0); |
851 | return <<"EOF"; | |
d9ce2681 | 852 | $args{src}: $gen0 $deps "\$(BLDDIR)\\util\\wrap.pl" |
3b85d9de | 853 | "\$(PERL)" "\$(BLDDIR)\\util\\wrap.pl" "$gen0"$gen_args > \$@ |
79f47ef5 RL |
854 | EOF |
855 | } else { | |
856 | # | |
857 | # Generic generator using Perl | |
858 | # | |
859 | return <<"EOF"; | |
860 | $args{src}: "$gen0" $deps | |
3b85d9de | 861 | "\$(PERL)"$gen_incs "$gen0"$gen_args > \$@ |
9a1394c5 RL |
862 | EOF |
863 | } | |
864 | } | |
865 | ||
7c0e1aa6 | 866 | sub src2obj { |
d88736df | 867 | my $asmext = platform->asmext(); |
7c0e1aa6 | 868 | my %args = @_; |
d88736df RL |
869 | my @srcs = |
870 | map { my $x = $_; | |
871 | (platform->isasm($x) && grep { $x eq $_ } @generated) | |
872 | ? platform->asm($x) : $x } | |
873 | ( @{$args{srcs}} ); | |
cb663908 | 874 | my $srcs = '"'.join('" "', @srcs).'"'; |
8557bdde TI |
875 | my $deps = join(' ', |
876 | map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ } | |
877 | (@srcs, @{$args{deps}})); | |
118faf5f | 878 | my $incs = join("", map { ' -I"'.$_.'"' } @{$args{incs}}); |
de158198 | 879 | my $defs = join("", map { " -D".$_ } @{$args{defs}}); |
9dfc8680 RL |
880 | my $cflags = { shlib => ' $(LIB_CFLAGS)', |
881 | lib => ' $(LIB_CFLAGS)', | |
722c9762 RL |
882 | dso => ' $(DSO_CFLAGS)', |
883 | bin => ' $(BIN_CFLAGS)' } -> {$args{intent}}; | |
8c3bc594 | 884 | $cflags .= $incs; |
9dfc8680 RL |
885 | $cflags .= { shlib => ' $(LIB_CPPFLAGS)', |
886 | lib => ' $(LIB_CPPFLAGS)', | |
8c3bc594 RL |
887 | dso => ' $(DSO_CPPFLAGS)', |
888 | bin => ' $(BIN_CPPFLAGS)' } -> {$args{intent}}; | |
9dfc8680 RL |
889 | my $asflags = { shlib => ' $(LIB_ASFLAGS)', |
890 | lib => ' $(LIB_ASFLAGS)', | |
abe256e7 RL |
891 | dso => ' $(DSO_ASFLAGS)', |
892 | bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}}; | |
2e535eb5 | 893 | my $makedepcmd = $config{makedepcmd} unless $disabled{makedepend}; |
81183680 | 894 | if ($srcs[0] =~ /\.rc$/) { |
95768961 | 895 | my $res = platform->res($args{obj}); |
81183680 | 896 | return <<"EOF"; |
95768961 | 897 | $res: $deps |
a583172d | 898 | \$(RC) \$(RCFLAGS) \$(RCOUTFLAG)\$\@ $srcs |
81183680 RL |
899 | EOF |
900 | } | |
95768961 | 901 | my $obj = platform->obj($args{obj}); |
13234dd3 | 902 | my $dep = platform->dep($args{obj}); |
d88736df | 903 | if ($srcs[0] =~ /\Q${asmext}\E$/) { |
7c0e1aa6 | 904 | return <<"EOF"; |
95768961 | 905 | $obj: $deps |
abe256e7 | 906 | \$(AS) $asflags \$(ASOUTFLAG)\$\@ $srcs |
18d15882 AP |
907 | EOF |
908 | } elsif ($srcs[0] =~ /.S$/) { | |
909 | return <<"EOF"; | |
95768961 | 910 | $obj: $deps |
1bb38122 TI |
911 | \$(CC) /EP -D__ASSEMBLER__ $cflags $defs $srcs > \$@.asm |
912 | \$(AS) $asflags \$(ASOUTFLAG)\$\@ \$@.asm | |
7c0e1aa6 RL |
913 | EOF |
914 | } | |
ecc347f5 | 915 | my $recipe = <<"EOF"; |
95768961 | 916 | $obj: $deps |
21712b2f | 917 | \$(CC) $cflags $defs -c \$(COUTFLAG)\$\@ $srcs |
7c0e1aa6 | 918 | EOF |
ecc347f5 | 919 | $recipe .= <<"EOF" unless $disabled{makedepend}; |
2e535eb5 | 920 | cmd /C "$makedepcmd $cflags $defs $srcs > $dep 2>&1" |
ecc347f5 RL |
921 | EOF |
922 | return $recipe; | |
7c0e1aa6 RL |
923 | } |
924 | ||
d8cac50b RL |
925 | # We *know* this routine is only called when we've configure 'shared'. |
926 | # Also, note that even though the import library built here looks like | |
927 | # a static library, it really isn't. | |
f6196227 | 928 | sub obj2shlib { |
7c0e1aa6 RL |
929 | my %args = @_; |
930 | my $lib = $args{lib}; | |
95768961 | 931 | my @objs = map { platform->convertext($_) } |
6afb3634 TI |
932 | grep { platform->isobj($_) } |
933 | @{$args{objs}}; | |
934 | my @ress = map { platform->convertext($_) } | |
935 | grep { platform->isres($_) } | |
81183680 | 936 | @{$args{objs}}; |
95768961 RL |
937 | my @defs = map { platform->def($_) } |
938 | grep { platform->isdef($_) } | |
ef2dfc99 | 939 | @{$args{objs}}; |
81183680 RL |
940 | my @deps = compute_lib_depends(@{$args{deps}}); |
941 | die "More than one exported symbols list" if scalar @defs > 1; | |
a75a8756 TI |
942 | my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps); |
943 | my $objs = join($target{ld_resp_delim}, @objs); | |
6afb3634 TI |
944 | my $ress = join($target{ld_resp_delim}, @ress); |
945 | my $deps = join(" ", @objs, @ress, @defs, @deps); | |
95768961 RL |
946 | my $import = platform->sharedlib_import($lib); |
947 | my $dll = platform->sharedlib($lib); | |
6afb3634 | 948 | my $shared_def = $target{lddefflag} . join("", @defs); |
5fee3fe2 TI |
949 | my $implib_rule = $target{ld_implib_rule} || ""; |
950 | my $implib_flag = $target{ld_implib_flag} | |
951 | ? "$target{ld_implib_flag}$import" | |
952 | : ""; | |
7c0e1aa6 | 953 | return <<"EOF" |
d8cac50b RL |
954 | # The import library may look like a static library, but it is not. |
955 | # We MUST make the import library depend on the DLL, in case someone | |
956 | # mistakenly removes the latter. | |
957 | $import: $dll | |
5fee3fe2 | 958 | $implib_rule |
d8cac50b RL |
959 | $dll: $deps |
960 | IF EXIST $full.manifest DEL /F /Q $full.manifest | |
0d9b5fa3 | 961 | IF EXIST \$@ DEL /F /Q \$@ |
491a1e33 | 962 | cmd /C "\$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) @<< $implib_flag || (DEL /Q \$(\@B).* $import & EXIT 1)" |
6afb3634 | 963 | $objs$target{ld_resp_delim}\$(LDOUTFLAG)$dll$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(LIB_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress |
7c0e1aa6 | 964 | << |
d8cac50b RL |
965 | IF EXIST $dll.manifest \\ |
966 | \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dll.manifest \$(MTOUTFLAG)$dll | |
967 | IF EXIST apps\\$dll DEL /Q /F apps\\$dll | |
968 | IF EXIST test\\$dll DEL /Q /F test\\$dll | |
969 | IF EXIST fuzz\\$dll DEL /Q /F fuzz\\$dll | |
970 | COPY $dll apps | |
971 | COPY $dll test | |
972 | COPY $dll fuzz | |
7c0e1aa6 RL |
973 | EOF |
974 | } | |
975 | sub obj2dso { | |
976 | my %args = @_; | |
285daccd RL |
977 | my $dso = platform->dso($args{module}); |
978 | my $dso_n = platform->dsoname($args{module}); | |
95768961 | 979 | my @objs = map { platform->convertext($_) } |
6afb3634 TI |
980 | grep { platform->isobj($_) } |
981 | @{$args{objs}}; | |
982 | my @ress = map { platform->convertext($_) } | |
983 | grep { platform->isres($_) } | |
66a24ab8 | 984 | @{$args{objs}}; |
95768961 RL |
985 | my @defs = map { platform->def($_) } |
986 | grep { platform->isdef($_) } | |
66a24ab8 | 987 | @{$args{objs}}; |
81183680 | 988 | my @deps = compute_lib_depends(@{$args{deps}}); |
6afb3634 | 989 | die "More than one exported symbols list" if scalar @defs > 1; |
a75a8756 | 990 | my $objs = join($target{ld_resp_delim}, @objs); |
6afb3634 | 991 | my $ress = join($target{ld_resp_delim}, @ress); |
a75a8756 | 992 | my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps); |
6afb3634 TI |
993 | my $deps = join(" ", @objs, @ress, @defs, @deps); |
994 | my $shared_def = $target{lddefflag} . join("", @defs); | |
7c0e1aa6 | 995 | return <<"EOF"; |
95768961 RL |
996 | $dso: $deps |
997 | IF EXIST $dso.manifest DEL /F /Q $dso.manifest | |
491a1e33 | 998 | cmd /C "\$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) @<< || (DEL /Q \$(\@B).* $dso_n.* & EXIT 1)" |
6afb3634 | 999 | $objs$target{ld_resp_delim}\$(LDOUTFLAG)$dso$target{ldpostoutflag}$target{ld_resp_delim}$linklibs \$(DSO_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress |
7c0e1aa6 | 1000 | << |
95768961 RL |
1001 | IF EXIST $dso.manifest \\ |
1002 | \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso.manifest \$(MTOUTFLAG)$dso | |
7c0e1aa6 RL |
1003 | EOF |
1004 | } | |
1005 | sub obj2lib { | |
33105818 | 1006 | my %args = @_; |
95768961 RL |
1007 | my $lib = platform->staticlib($args{lib}); |
1008 | my @objs = map { platform->obj($_) } @{$args{objs}}; | |
e15eff3a | 1009 | my $objs = join($target{ar_resp_delim}, @objs); |
81183680 | 1010 | my $deps = join(" ", @objs); |
7c0e1aa6 | 1011 | return <<"EOF"; |
b3023ced RL |
1012 | $lib: $deps |
1013 | \$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib @<< | |
81183680 | 1014 | $objs |
7c0e1aa6 RL |
1015 | << |
1016 | EOF | |
1017 | } | |
1018 | sub obj2bin { | |
1019 | my %args = @_; | |
95768961 RL |
1020 | my $bin = platform->bin($args{bin}); |
1021 | my @objs = map { platform->convertext($_) } | |
6afb3634 TI |
1022 | grep { platform->isobj($_) } |
1023 | @{$args{objs}}; | |
1024 | my @ress = map { platform->convertext($_) } | |
1025 | grep { platform->isres($_) } | |
95768961 | 1026 | @{$args{objs}}; |
81183680 | 1027 | my @deps = compute_lib_depends(@{$args{deps}}); |
a75a8756 | 1028 | my $objs = join($target{ld_resp_delim}, @objs); |
01451721 | 1029 | my $ress = join($target{ld_resp_delim}, @ress); |
a75a8756 | 1030 | my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps); |
6afb3634 | 1031 | my $deps = join(" ", @objs, @ress, @deps); |
7c0e1aa6 | 1032 | return <<"EOF"; |
95768961 RL |
1033 | $bin: $deps |
1034 | IF EXIST $bin.manifest DEL /F /Q $bin.manifest | |
a75a8756 | 1035 | \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) @<< |
6afb3634 | 1036 | $objs$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(BIN_EX_LIBS)$target{ldresflag}$target{ldresflag}$ress |
7c0e1aa6 | 1037 | << |
95768961 RL |
1038 | IF EXIST $bin.manifest \\ |
1039 | \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin.manifest \$(MTOUTFLAG)$bin | |
7c0e1aa6 RL |
1040 | EOF |
1041 | } | |
1042 | sub in2script { | |
1043 | my %args = @_; | |
1044 | my $script = $args{script}; | |
cb663908 | 1045 | my $sources = '"'.join('" "', @{$args{sources}}).'"'; |
7c0e1aa6 RL |
1046 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, |
1047 | "util", "dofile.pl")), | |
1048 | rel2abs($config{builddir})); | |
1049 | return <<"EOF"; | |
079f8d36 | 1050 | $script: $sources configdata.pm |
cb663908 | 1051 | "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
a8368d57 | 1052 | "-o$target{build_file}" $sources > \$@ |
0ad1d94d RL |
1053 | EOF |
1054 | } | |
1055 | sub generatedir { | |
1056 | my %args = @_; | |
1057 | my $dir = $args{dir}; | |
95768961 | 1058 | my @deps = map { platform->convertext($_) } @{$args{deps}}; |
0ad1d94d | 1059 | my @actions = (); |
95768961 RL |
1060 | my %extinfo = ( dso => platform->dsoext(), |
1061 | lib => platform->libext(), | |
1062 | bin => platform->binext() ); | |
0ad1d94d | 1063 | |
b6e66075 RL |
1064 | # We already have a 'test' target, and the top directory is just plain |
1065 | # silly | |
1066 | return if $dir eq "test" || $dir eq "."; | |
1067 | ||
0ad1d94d RL |
1068 | foreach my $type (("dso", "lib", "bin", "script")) { |
1069 | next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); | |
850000aa RL |
1070 | # For lib object files, we could update the library. However, |
1071 | # LIB on Windows doesn't work that way, so we won't create any | |
1072 | # actions for it, and the dependencies are already taken care of. | |
1073 | if ($type ne "lib") { | |
0ad1d94d RL |
1074 | foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { |
1075 | if (dirname($prod) eq $dir) { | |
1076 | push @deps, $prod.$extinfo{$type}; | |
0ad1d94d RL |
1077 | } |
1078 | } | |
1079 | } | |
1080 | } | |
1081 | ||
1082 | my $deps = join(" ", @deps); | |
1083 | my $actions = join("\n", "", @actions); | |
1084 | return <<"EOF"; | |
b6e66075 | 1085 | $dir $dir\\ : $deps$actions |
7c0e1aa6 RL |
1086 | EOF |
1087 | } | |
1088 | "" # Important! This becomes part of the template result. | |
1089 | -} |