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