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