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