]>
Commit | Line | Data |
---|---|---|
567a9e6f RL |
1 | ## |
2 | ## Makefile for OpenSSL | |
3 | ## | |
4 | ## {- join("\n## ", @autowarntext) -} | |
5 | {- | |
834aae2a BL |
6 | our $objext = $target{obj_extension} || ".o"; |
7 | our $depext = $target{dep_extension} || ".d"; | |
8 | our $exeext = $target{exe_extension} || ""; | |
9 | our $libext = $target{lib_extension} || ".a"; | |
10 | our $shlibext = $target{shared_extension} || ".so"; | |
822b5e26 | 11 | our $shlibvariant = $target{shlib_variant} || ""; |
834aae2a BL |
12 | our $shlibextsimple = $target{shared_extension_simple} || ".so"; |
13 | our $shlibextimport = $target{shared_import_extension} || ""; | |
14 | our $dsoext = $target{dso_extension} || ".so"; | |
15 | ||
567a9e6f | 16 | sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } |
f5c174ff | 17 | |
d4453024 RL |
18 | our $sover_dirname = $config{shlib_version_number}; |
19 | $sover_dirname =~ s|\.|_|g | |
20 | if $config{target} =~ /^mingw/; | |
b2de11c5 | 21 | |
f5c174ff RL |
22 | # shlib and shlib_simple both take a static library name and figure |
23 | # out what the shlib name should be. | |
24 | # | |
25 | # When OpenSSL is configured "no-shared", these functions will just | |
26 | # return empty lists, making them suitable to join(). | |
27 | # | |
28 | # With Windows DLL producers, shlib($libname) will return the shared | |
29 | # library name (which usually is different from the static library | |
30 | # name) with the default shared extension appended to it, while | |
31 | # shlib_simple($libname) will return the static library name with | |
32 | # the shared extension followed by ".a" appended to it. The former | |
33 | # result is used as the runtime shared library while the latter is | |
34 | # used as the DLL import library. | |
35 | # | |
36 | # On all Unix systems, shlib($libname) will return the library name | |
37 | # with the default shared extension, while shlib_simple($libname) | |
38 | # will return the name from shlib($libname) with any SO version number | |
39 | # removed. On some systems, they may therefore return the exact same | |
40 | # string. | |
41 | sub shlib { | |
f5c174ff | 42 | my $lib = shift; |
33105818 | 43 | return () if $disabled{shared} || $lib =~ /\.a$/; |
822b5e26 | 44 | return $unified_info{sharednames}->{$lib}. $shlibvariant. '$(SHLIB_EXT)'; |
f5c174ff RL |
45 | } |
46 | sub shlib_simple { | |
f5c174ff | 47 | my $lib = shift; |
33105818 RL |
48 | return () if $disabled{shared} || $lib =~ /\.a$/; |
49 | ||
f5c174ff | 50 | if (windowsdll()) { |
d4453024 | 51 | return $lib . '$(SHLIB_EXT_IMPORT)'; |
f5c174ff | 52 | } |
d4453024 | 53 | return $lib . '$(SHLIB_EXT_SIMPLE)'; |
f5c174ff RL |
54 | } |
55 | ||
33105818 RL |
56 | # Easy fixing of static library names |
57 | sub lib { | |
58 | (my $lib = shift) =~ s/\.a$//; | |
59 | return $lib . $libext; | |
60 | } | |
61 | ||
f5c174ff RL |
62 | # dso is a complement to shlib / shlib_simple that returns the |
63 | # given libname with the simple shared extension (possible SO version | |
64 | # removed). This differs from shlib_simple() by being unconditional. | |
65 | sub dso { | |
f5c174ff RL |
66 | my $engine = shift; |
67 | ||
834aae2a | 68 | return $engine . $dsoext; |
f5c174ff | 69 | } |
27c40a93 BL |
70 | # This makes sure things get built in the order they need |
71 | # to. You're welcome. | |
72 | sub dependmagic { | |
73 | my $target = shift; | |
74 | ||
75 | return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target"; | |
76 | } | |
834aae2a | 77 | ''; |
567a9e6f RL |
78 | -} |
79 | PLATFORM={- $config{target} -} | |
80 | OPTIONS={- $config{options} -} | |
81 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
82 | SRCDIR={- $config{sourcedir} -} | |
83 | BLDDIR={- $config{builddir} -} | |
84 | ||
85 | VERSION={- $config{version} -} | |
86 | MAJOR={- $config{major} -} | |
87 | MINOR={- $config{minor} -} | |
88 | SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} | |
89 | SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -} | |
90 | SHLIB_MAJOR={- $config{shlib_major} -} | |
91 | SHLIB_MINOR={- $config{shlib_minor} -} | |
92 | SHLIB_TARGET={- $target{shared_target} -} | |
d4453024 RL |
93 | SHLIB_EXT={- $shlibext -} |
94 | SHLIB_EXT_SIMPLE={- $shlibextsimple -} | |
95 | SHLIB_EXT_IMPORT={- $shlibextimport -} | |
567a9e6f | 96 | |
33105818 | 97 | LIBS={- join(" ", map { lib($_) } @{$unified_info{libraries}}) -} |
f5c174ff | 98 | SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -} |
0f01b7bc | 99 | SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -} |
f5c174ff | 100 | ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -} |
1e3d16b0 | 101 | PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -} |
567a9e6f | 102 | SCRIPTS={- join(" ", @{$unified_info{scripts}}) -} |
29eed3dd | 103 | {- output_off() if $disabled{makedepend}; "" -} |
834aae2a | 104 | DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; } |
c058fcd7 RL |
105 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } |
106 | keys %{$unified_info{sources}}); -} | |
29eed3dd | 107 | {- output_on() if $disabled{makedepend}; "" -} |
7cae3864 | 108 | GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}} ) -} |
05a7aee0 RL |
109 | GENERATED={- join(" ", |
110 | ( map { (my $x = $_) =~ s|\.S$|\.s|; $x } | |
111 | grep { defined $unified_info{generate}->{$_} } | |
112 | map { @{$unified_info{sources}->{$_}} } | |
113 | grep { /\.o$/ } keys %{$unified_info{sources}} ), | |
114 | ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -} | |
c058fcd7 | 115 | |
33105818 | 116 | INSTALL_LIBS={- join(" ", map { lib($_) } @{$unified_info{install}->{libraries}}) -} |
0f01b7bc RL |
117 | INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -} |
118 | INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -} | |
119 | INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -} | |
120 | INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -} | |
df653379 | 121 | {- output_off() if $disabled{apps}; "" -} |
567a9e6f | 122 | BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash |
b8a9af68 | 123 | MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget |
df653379 | 124 | {- output_on() if $disabled{apps}; "" -} |
567a9e6f | 125 | |
6a74806e RL |
126 | APPS_OPENSSL={- use File::Spec::Functions; |
127 | catfile("apps","openssl") -} | |
128 | ||
3c65577f RL |
129 | # DESTDIR is for package builders so that they can configure for, say, |
130 | # /usr/ and yet have everything installed to /tmp/somedir/usr/. | |
567a9e6f | 131 | # Normally it is left empty. |
3c65577f | 132 | DESTDIR= |
567a9e6f RL |
133 | |
134 | # Do not edit these manually. Use Configure with --prefix or --openssldir | |
135 | # to change this! Short explanation in the top comment in Configure | |
136 | INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet | |
137 | # | |
138 | our $prefix = $config{prefix} || "/usr/local"; | |
139 | $prefix -} | |
140 | OPENSSLDIR={- # | |
141 | # The logic here is that if no --openssldir was given, | |
142 | # OPENSSLDIR will get the value from $prefix plus "/ssl". | |
143 | # If --openssldir was given and the value is an absolute | |
144 | # path, OPENSSLDIR will get its value without change. | |
145 | # If the value from --openssldir is a relative path, | |
146 | # OPENSSLDIR will get $prefix with the --openssldir | |
147 | # value appended as a subdirectory. | |
148 | # | |
149 | use File::Spec::Functions; | |
150 | our $openssldir = | |
151 | $config{openssldir} ? | |
152 | (file_name_is_absolute($config{openssldir}) ? | |
153 | $config{openssldir} | |
154 | : catdir($prefix, $config{openssldir})) | |
155 | : catdir($prefix, "ssl"); | |
156 | $openssldir -} | |
157 | LIBDIR={- # | |
158 | # if $prefix/lib$target{multilib} is not an existing | |
159 | # directory, then assume that it's not searched by linker | |
160 | # automatically, in which case adding $target{multilib} suffix | |
161 | # causes more grief than we're ready to tolerate, so don't... | |
162 | our $multilib = | |
163 | -d "$prefix/lib$target{multilib}" ? $target{multilib} : ""; | |
164 | our $libdir = $config{libdir} || "lib$multilib"; | |
165 | $libdir -} | |
166 | ENGINESDIR={- use File::Spec::Functions; | |
d4453024 | 167 | catdir($prefix,$libdir,"engines-$sover_dirname") -} |
567a9e6f | 168 | |
fad599f7 RL |
169 | # Convenience variable for those who want to set the rpath in shared |
170 | # libraries and applications | |
171 | LIBRPATH=$(INSTALLTOP)/$(LIBDIR) | |
172 | ||
dde10ab4 | 173 | MANDIR=$(INSTALLTOP)/share/man |
8be7bdb5 RL |
174 | DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) |
175 | HTMLDIR=$(DOCDIR)/html | |
567a9e6f | 176 | |
3544091a RL |
177 | # MANSUFFIX is for the benefit of anyone who may want to have a suffix |
178 | # appended after the manpage file section number. "ssl" is popular, | |
179 | # resulting in files such as config.5ssl rather than config.5. | |
180 | MANSUFFIX= | |
567a9e6f RL |
181 | HTMLSUFFIX=html |
182 | ||
5407338a RS |
183 | # For "optional" echo messages, to get "real" silence |
184 | ECHO = echo | |
567a9e6f RL |
185 | |
186 | CROSS_COMPILE= {- $config{cross_compile_prefix} -} | |
8c3bc594 | 187 | CPPFLAGS={- our $cppflags = join(" ", |
5b18235a RL |
188 | (map { "-D".$_} @{$config{defines}}), |
189 | (map { "-I".$_} @{$config{includes}}), | |
190 | @{$config{cppflags}}) -} | |
8c3bc594 | 191 | CPPFLAGS_Q={- $cppflags =~ s|([\\"])|\\$1|g; $cppflags -} |
5b18235a RL |
192 | CC= $(CROSS_COMPILE){- $config{cc} -} |
193 | CFLAGS={- join(' ', @{$config{cflags}}) -} | |
194 | CXX= $(CROSS_COMPILE){- $config{cxx} -} | |
fa153b57 | 195 | CXXFLAGS={- join(' ', @{$config{cxxflags}}) -} |
5b18235a RL |
196 | LDFLAGS= {- join(' ', @{$config{lflags}}) -} |
197 | PLIB_LDFLAGS= {- join(' ', @{$config{plib_lflags}}) -} | |
198 | EX_LIBS= {- join(' ', @{$config{ex_libs}}) -} | |
199 | LIB_CPPFLAGS={- join(' ', | |
200 | (map { '-D'.$_ } | |
201 | ('OPENSSLDIR="\"$(OPENSSLDIR)\""', | |
202 | 'ENGINESDIR="\"$(ENGINESDIR)\""')), | |
203 | $target{shared_cppflag}) || "" -} | |
bbd9a50f | 204 | LIB_CFLAGS={- $target{shared_cflag} || "" -} |
7763472f | 205 | LIB_CXXFLAGS={- $target{shared_cxxflag} || "" -} |
075f7e2c | 206 | LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} -} |
8c3bc594 | 207 | DSO_CPPFLAGS={- $target{dso_cppflags} || "" -} |
793077d0 RL |
208 | DSO_CFLAGS={- $target{dso_cflags} || "" -} |
209 | DSO_CXXFLAGS={- $target{dso_cxxflags} || "" -} | |
210 | DSO_LDFLAGS={- $target{dso_lflags} || "" -} | |
8c3bc594 | 211 | BIN_CPPFLAGS={- $target{bin_cppflags} || "" -} |
793077d0 RL |
212 | BIN_CFLAGS={- $target{bin_cflags} || "" -} |
213 | BIN_CXXFLAGS={- $target{bin_cxxflags} || "" -} | |
214 | BIN_LDFLAGS={- $target{bin_lflags} || "" -} | |
567a9e6f RL |
215 | |
216 | PERL={- $config{perl} -} | |
217 | ||
5b18235a RL |
218 | AR=$(CROSS_COMPILE){- $config{ar} -} |
219 | ARFLAGS= {- join(' ', @{$config{arflags}}) -} | |
220 | RANLIB= {- $config{ranlib} -} | |
8f41ff2d | 221 | RC= $(CROSS_COMPILE){- $target{rc} || "windres" -} |
5b18235a | 222 | RCFLAGS={- join(' ', @{$config{rcflags}}) -} {- $target{shared_rcflag} -} |
567a9e6f | 223 | RM= rm -f |
98e5534e | 224 | RMDIR= rmdir |
567a9e6f RL |
225 | TAR= {- $target{tar} || "tar" -} |
226 | TARFLAGS= {- $target{tarflags} -} | |
29eed3dd | 227 | MAKEDEPEND={- $config{makedepprog} -} |
567a9e6f RL |
228 | |
229 | BASENAME= openssl | |
230 | NAME= $(BASENAME)-$(VERSION) | |
231 | TARFILE= ../$(NAME).tar | |
232 | ||
233 | # We let the C compiler driver to take care of .s files. This is done in | |
234 | # order to be excused from maintaining a separate set of architecture | |
235 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | |
236 | # gcc, then the driver will automatically translate it to -xarch=v8plus | |
237 | # and pass it down to assembler. | |
5b18235a RL |
238 | AS={- $config{as} || '$(CC) -c' -} |
239 | ASFLAGS={- join(' ', @{$config{asflags}}) || '$(CFLAGS)' -} | |
567a9e6f RL |
240 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} |
241 | ||
242 | # For x86 assembler: Set PROCESSOR to 386 if you want to support | |
243 | # the 80386. | |
244 | PROCESSOR= {- $config{processor} -} | |
245 | ||
9c7ce40b AP |
246 | # We want error [and other] messages in English. Trouble is that make(1) |
247 | # doesn't pass macros down as environment variables unless there already | |
248 | # was corresponding variable originally set. In other words we can only | |
249 | # reassign environment variables, but not set new ones, not in portable | |
250 | # manner that is. That's why we reassign several, just to be sure... | |
251 | LC_ALL=C | |
252 | LC_MESSAGES=C | |
253 | LANG=C | |
254 | ||
567a9e6f RL |
255 | # The main targets ################################################### |
256 | ||
1e3d16b0 | 257 | {- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils |
27c40a93 BL |
258 | {- dependmagic('build_libs'); -}: build_libs_nodep |
259 | {- dependmagic('build_engines'); -}: build_engines_nodep | |
1e3d16b0 | 260 | {- dependmagic('build_programs'); -}: build_programs_nodep |
567a9e6f | 261 | |
27c40a93 | 262 | build_generated: $(GENERATED_MANDATORY) |
c058fcd7 | 263 | build_libs_nodep: libcrypto.pc libssl.pc openssl.pc |
c058fcd7 | 264 | build_engines_nodep: $(ENGINES) |
1e3d16b0 RL |
265 | build_programs_nodep: $(PROGRAMS) $(SCRIPTS) |
266 | ||
267 | # Kept around for backward compatibility | |
268 | build_apps build_tests: build_programs | |
68a5f1a2 | 269 | |
9b03b91b RL |
270 | # Convenience target to prebuild all generated files, not just the mandatory |
271 | # ones | |
272 | build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) | |
273 | ||
1b741653 | 274 | test: tests |
1e3d16b0 | 275 | {- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils |
d90a6beb | 276 | @ : {- output_off() if $disabled{tests}; "" -} |
567a9e6f | 277 | ( cd test; \ |
41f571e1 | 278 | mkdir -p test-runs; \ |
567a9e6f RL |
279 | SRCTOP=../$(SRCDIR) \ |
280 | BLDTOP=../$(BLDDIR) \ | |
41f571e1 | 281 | RESULT_D=test-runs \ |
cbece220 | 282 | PERL="$(PERL)" \ |
834aae2a | 283 | EXE_EXT={- $exeext -} \ |
41f571e1 | 284 | OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines; pwd` \ |
6d4bc8a3 | 285 | OPENSSL_DEBUG_MEMORY=on \ |
567a9e6f | 286 | $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) ) |
d90a6beb MC |
287 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
288 | @echo "Tests are not supported with your chosen Configure options" | |
289 | @ : {- output_on() if !$disabled{tests}; "" -} | |
567a9e6f RL |
290 | |
291 | list-tests: | |
4813ad2d RL |
292 | @ : {- output_off() if $disabled{tests}; "" -} |
293 | @SRCTOP="$(SRCDIR)" \ | |
294 | $(PERL) $(SRCDIR)/test/run_tests.pl list | |
295 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} | |
296 | @echo "Tests are not supported with your chosen Configure options" | |
297 | @ : {- output_on() if !$disabled{tests}; "" -} | |
298 | ||
299 | install: install_sw install_ssldirs install_docs | |
300 | ||
301 | uninstall: uninstall_docs uninstall_sw | |
567a9e6f RL |
302 | |
303 | libclean: | |
f99f91f1 RL |
304 | @set -e; for s in $(SHLIB_INFO); do \ |
305 | s1=`echo "$$s" | cut -f1 -d";"`; \ | |
306 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
5407338a | 307 | $(ECHO) $(RM) $$s1; \ |
f99f91f1 RL |
308 | $(RM) $$s1; \ |
309 | if [ "$$s1" != "$$s2" ]; then \ | |
5407338a | 310 | $(ECHO) $(RM) $$s2; \ |
f99f91f1 RL |
311 | $(RM) $$s2; \ |
312 | fi; \ | |
313 | done | |
314 | $(RM) $(LIBS) | |
4813ad2d | 315 | $(RM) *.map |
567a9e6f RL |
316 | |
317 | clean: libclean | |
4813ad2d RL |
318 | $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS) |
319 | $(RM) $(GENERATED) | |
320 | -$(RM) `find . -name '*{- $depext -}' -a \! -path "./.git/*"` | |
321 | -$(RM) `find . -name '*{- $objext -}' -a \! -path "./.git/*"` | |
322 | $(RM) core | |
9e183d22 | 323 | $(RM) tags TAGS doc-nits |
d016d1ec | 324 | $(RM) -r test/test-runs |
4813ad2d RL |
325 | $(RM) openssl.pc libcrypto.pc libssl.pc |
326 | -$(RM) `find . -type l -a \! -path "./.git/*"` | |
327 | $(RM) $(TARFILE) | |
567a9e6f | 328 | |
7cae3864 | 329 | distclean: clean |
4813ad2d RL |
330 | $(RM) configdata.pm |
331 | $(RM) Makefile | |
7cae3864 | 332 | |
f8d9d6e4 | 333 | # We check if any depfile is newer than Makefile and decide to |
a6adf099 | 334 | # concatenate only if that is true. |
ea80a25e | 335 | depend: |
29eed3dd | 336 | @: {- output_off() if $disabled{makedepend}; "" -} |
d423c5ad | 337 | @if egrep "^# DO NOT DELETE THIS LINE" Makefile >/dev/null && [ -z "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then :; else \ |
ebca7961 | 338 | ( $(PERL) -pe 'exit 0 if /^# DO NOT DELETE THIS LINE.*/' < Makefile; \ |
f8d9d6e4 RL |
339 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \ |
340 | echo; \ | |
a6adf099 RL |
341 | for f in $(DEPS); do \ |
342 | if [ -f $$f ]; then cat $$f; fi; \ | |
f8d9d6e4 | 343 | done ) > Makefile.new; \ |
29b28eee | 344 | if cmp Makefile.new Makefile >/dev/null 2>&1; then \ |
f8d9d6e4 | 345 | rm -f Makefile.new; \ |
29b28eee RL |
346 | else \ |
347 | mv -f Makefile.new Makefile; \ | |
f8d9d6e4 | 348 | fi; \ |
c058fcd7 | 349 | fi |
29eed3dd | 350 | @: {- output_on() if $disabled{makedepend}; "" -} |
567a9e6f RL |
351 | |
352 | # Install helper targets ############################################# | |
353 | ||
354 | install_sw: all install_dev install_engines install_runtime | |
355 | ||
f99f91f1 | 356 | uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev |
567a9e6f RL |
357 | |
358 | install_docs: install_man_docs install_html_docs | |
359 | ||
360 | uninstall_docs: uninstall_man_docs uninstall_html_docs | |
8be7bdb5 | 361 | $(RM) -r -v $(DESTDIR)$(DOCDIR) |
567a9e6f | 362 | |
dde10ab4 RL |
363 | install_ssldirs: |
364 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs | |
365 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private | |
66c2eb8b | 366 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc |
4813ad2d RL |
367 | @set -e; for x in dummy $(MISC_SCRIPTS); do \ |
368 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
369 | fn=`basename $$x`; \ | |
5407338a | 370 | $(ECHO) "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ |
4813ad2d RL |
371 | cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ |
372 | chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
373 | mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \ | |
374 | $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ | |
375 | done | |
5407338a | 376 | @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" |
4813ad2d RL |
377 | @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new |
378 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new | |
cb926df2 | 379 | @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist |
c7af65c7 | 380 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ |
5407338a | 381 | $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ |
cb926df2 RL |
382 | cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ |
383 | chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf; \ | |
384 | fi | |
5407338a | 385 | @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" |
c7af65c7 RS |
386 | @cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new |
387 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new | |
388 | @mv -f $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist | |
389 | @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ | |
5407338a | 390 | $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ |
c7af65c7 RS |
391 | cp $(SRCDIR)/apps/ct_log_list.cnf $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ |
392 | chmod 644 $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf; \ | |
393 | fi | |
dde10ab4 | 394 | |
567a9e6f RL |
395 | install_dev: |
396 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
5407338a | 397 | @$(ECHO) "*** Installing development files" |
3c65577f | 398 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl |
24c4f736 | 399 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} |
5407338a | 400 | @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
24c4f736 RL |
401 | @cp $(SRCDIR)/ms/applink.c $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c |
402 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c | |
403 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} | |
567a9e6f RL |
404 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
405 | $(BLDDIR)/include/openssl/*.h; do \ | |
406 | fn=`basename $$i`; \ | |
5407338a | 407 | $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
3c65577f RL |
408 | cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ |
409 | chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f | 410 | done |
3c65577f | 411 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) |
0f01b7bc | 412 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 413 | fn=`basename $$l`; \ |
5407338a | 414 | $(ECHO) "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
3c65577f RL |
415 | cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ |
416 | $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
417 | chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
418 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ | |
419 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
567a9e6f | 420 | done |
84af1bae | 421 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 422 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
423 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
424 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
425 | fn1=`basename $$s1`; \ | |
426 | fn2=`basename $$s2`; \ | |
427 | : {- output_off() if windowsdll(); "" -}; \ | |
5407338a | 428 | $(ECHO) "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ |
c8c2b779 | 429 | cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \ |
3503549e | 430 | chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \ |
c8c2b779 RL |
431 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \ |
432 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \ | |
433 | if [ "$$fn1" != "$$fn2" ]; then \ | |
5407338a | 434 | $(ECHO) "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ |
c8c2b779 | 435 | ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ |
567a9e6f | 436 | fi; \ |
c8c2b779 | 437 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
5407338a | 438 | $(ECHO) "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ |
c8c2b779 | 439 | cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \ |
3503549e | 440 | chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \ |
c8c2b779 RL |
441 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \ |
442 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
ce5ed82f | 443 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 444 | done |
84af1bae | 445 | @ : {- output_on() if $disabled{shared}; "" -} |
3c65577f | 446 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig |
5407338a | 447 | @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc" |
3c65577f RL |
448 | @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig |
449 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc | |
5407338a | 450 | @$(ECHO) "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc" |
3c65577f RL |
451 | @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig |
452 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc | |
5407338a | 453 | @$(ECHO) "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc" |
3c65577f RL |
454 | @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig |
455 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc | |
567a9e6f RL |
456 | |
457 | uninstall_dev: | |
5407338a | 458 | @$(ECHO) "*** Uninstalling development files" |
24c4f736 | 459 | @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} |
5407338a | 460 | @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" |
24c4f736 RL |
461 | @$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c |
462 | @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } @{$target{defines}}; "" -} | |
567a9e6f RL |
463 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
464 | $(BLDDIR)/include/openssl/*.h; do \ | |
465 | fn=`basename $$i`; \ | |
5407338a | 466 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
3c65577f | 467 | $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ |
567a9e6f | 468 | done |
98e5534e RL |
469 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl |
470 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include | |
0f01b7bc | 471 | @set -e; for l in $(INSTALL_LIBS); do \ |
567a9e6f | 472 | fn=`basename $$l`; \ |
5407338a | 473 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
3c65577f | 474 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ |
567a9e6f | 475 | done |
84af1bae | 476 | @ : {- output_off() if $disabled{shared}; "" -} |
0f01b7bc | 477 | @set -e; for s in $(INSTALL_SHLIB_INFO); do \ |
c8c2b779 RL |
478 | s1=`echo "$$s" | cut -f1 -d";"`; \ |
479 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
480 | fn1=`basename $$s1`; \ | |
481 | fn2=`basename $$s2`; \ | |
482 | : {- output_off() if windowsdll(); "" -}; \ | |
5407338a | 483 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ |
c8c2b779 RL |
484 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \ |
485 | if [ "$$fn1" != "$$fn2" ]; then \ | |
5407338a | 486 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ |
3c65577f | 487 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ |
567a9e6f | 488 | fi; \ |
c8c2b779 | 489 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
5407338a | 490 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ |
c8c2b779 | 491 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ |
ce5ed82f | 492 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 493 | done |
c8cca980 | 494 | @ : {- output_on() if $disabled{shared}; "" -} |
b894054e RL |
495 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc |
496 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc | |
497 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc | |
498 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
499 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) | |
567a9e6f RL |
500 | |
501 | install_engines: | |
502 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
b2de11c5 | 503 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/ |
5407338a | 504 | @$(ECHO) "*** Installing engines" |
0f01b7bc | 505 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 506 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 507 | fn=`basename $$e`; \ |
5407338a | 508 | $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
b2de11c5 RL |
509 | cp $$e $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ |
510 | chmod 755 $(DESTDIR)$(ENGINESDIR)/$$fn.new; \ | |
511 | mv -f $(DESTDIR)$(ENGINESDIR)/$$fn.new \ | |
512 | $(DESTDIR)$(ENGINESDIR)/$$fn; \ | |
567a9e6f RL |
513 | done |
514 | ||
515 | uninstall_engines: | |
5407338a | 516 | @$(ECHO) "*** Uninstalling engines" |
0f01b7bc | 517 | @set -e; for e in dummy $(INSTALL_ENGINES); do \ |
2b364f61 | 518 | if [ "$$e" = "dummy" ]; then continue; fi; \ |
567a9e6f | 519 | fn=`basename $$e`; \ |
f0c93a85 RL |
520 | if [ "$$fn" = '{- dso("ossltest") -}' ]; then \ |
521 | continue; \ | |
522 | fi; \ | |
5407338a | 523 | $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ |
b2de11c5 | 524 | $(RM) $(DESTDIR)$(ENGINESDIR)/$$fn; \ |
567a9e6f | 525 | done |
b2de11c5 | 526 | -$(RMDIR) $(DESTDIR)$(ENGINESDIR) |
567a9e6f RL |
527 | |
528 | install_runtime: | |
529 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
3c65577f | 530 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin |
36b53720 RL |
531 | @ : {- output_off() if windowsdll(); "" -} |
532 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) | |
533 | @ : {- output_on() if windowsdll(); "" -} | |
5407338a | 534 | @$(ECHO) "*** Installing runtime files" |
0f01b7bc | 535 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 536 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 537 | fn=`basename $$s`; \ |
36b53720 | 538 | : {- output_off() unless windowsdll(); "" -}; \ |
5407338a | 539 | $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f RL |
540 | cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
541 | chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
542 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
543 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
36b53720 | 544 | : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ |
5407338a | 545 | $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
36b53720 RL |
546 | cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ |
547 | chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
548 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ | |
549 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
550 | : {- output_on() if windowsdll(); "" -}; \ | |
fcf80c46 | 551 | done |
0f01b7bc | 552 | @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ |
2b364f61 | 553 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 554 | fn=`basename $$x`; \ |
5407338a | 555 | $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f RL |
556 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
557 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
558 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
559 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 560 | done |
2b364f61 RL |
561 | @set -e; for x in dummy $(BIN_SCRIPTS); do \ |
562 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 563 | fn=`basename $$x`; \ |
5407338a | 564 | $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f RL |
565 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ |
566 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
567 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
568 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 569 | done |
567a9e6f RL |
570 | |
571 | uninstall_runtime: | |
5407338a | 572 | @$(ECHO) "*** Uninstalling runtime files" |
0f01b7bc | 573 | @set -e; for x in dummy $(INSTALL_PROGRAMS); \ |
567a9e6f | 574 | do \ |
2b364f61 | 575 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 576 | fn=`basename $$x`; \ |
5407338a | 577 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 578 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
567a9e6f | 579 | done; |
2b364f61 | 580 | @set -e; for x in dummy $(BIN_SCRIPTS); \ |
567a9e6f | 581 | do \ |
2b364f61 | 582 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 583 | fn=`basename $$x`; \ |
5407338a | 584 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 585 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
567a9e6f | 586 | done |
b1837abd | 587 | @ : {- output_off() unless windowsdll(); "" -} |
0f01b7bc | 588 | @set -e; for s in dummy $(INSTALL_SHLIBS); do \ |
2b364f61 | 589 | if [ "$$s" = "dummy" ]; then continue; fi; \ |
f99f91f1 | 590 | fn=`basename $$s`; \ |
5407338a | 591 | $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
3c65577f | 592 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ |
fcf80c46 | 593 | done |
b1837abd | 594 | @ : {- output_on() unless windowsdll(); "" -} |
b894054e | 595 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin |
567a9e6f | 596 | |
567a9e6f RL |
597 | |
598 | install_man_docs: | |
599 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
5407338a | 600 | @$(ECHO) "*** Installing manpages" |
cadb015b RL |
601 | $(PERL) $(SRCDIR)/util/process_docs.pl \ |
602 | --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) | |
567a9e6f RL |
603 | |
604 | uninstall_man_docs: | |
5407338a | 605 | @$(ECHO) "*** Uninstalling manpages" |
cadb015b RL |
606 | $(PERL) $(SRCDIR)/util/process_docs.pl \ |
607 | --destdir=$(DESTDIR)$(MANDIR) --type=man --suffix=$(MANSUFFIX) \ | |
608 | --remove | |
567a9e6f RL |
609 | |
610 | install_html_docs: | |
611 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
5407338a | 612 | @$(ECHO) "*** Installing HTML manpages" |
cadb015b RL |
613 | $(PERL) $(SRCDIR)/util/process_docs.pl \ |
614 | --destdir=$(DESTDIR)$(HTMLDIR) --type=html | |
567a9e6f RL |
615 | |
616 | uninstall_html_docs: | |
5407338a | 617 | @$(ECHO) "*** Uninstalling manpages" |
cadb015b RL |
618 | $(PERL) $(SRCDIR)/util/process_docs.pl \ |
619 | --destdir=$(DESTDIR)$(HTMLDIR) --type=html --remove | |
567a9e6f RL |
620 | |
621 | ||
622 | # Developer targets (note: these are only available on Unix) ######### | |
623 | ||
6bb2106e RL |
624 | update: generate errors ordinals |
625 | ||
b7650c67 | 626 | generate: generate_apps generate_crypto_bn generate_crypto_objects \ |
8e32e1ab | 627 | generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids |
567a9e6f | 628 | |
65c1f979 | 629 | doc-nits: |
1722496f | 630 | (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits |
9e183d22 | 631 | if [ -s doc-nits ] ; then cat doc-nits; rm doc-nits ; exit 1; fi |
65c1f979 | 632 | |
567a9e6f RL |
633 | # Test coverage is a good idea for the future |
634 | #coverage: $(PROGRAMS) $(TESTPROGRAMS) | |
635 | # ... | |
636 | ||
567a9e6f RL |
637 | lint: |
638 | lint -DLINT $(INCLUDES) $(SRCS) | |
639 | ||
9a9f8ee7 RL |
640 | generate_apps: |
641 | ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ | |
642 | < apps/openssl.cnf > apps/openssl-vms.cnf ) | |
9a9f8ee7 RL |
643 | |
644 | generate_crypto_bn: | |
645 | ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) | |
646 | ||
647 | generate_crypto_objects: | |
9a9f8ee7 RL |
648 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ |
649 | crypto/objects/objects.txt \ | |
650 | crypto/objects/obj_mac.num \ | |
651 | include/openssl/obj_mac.h ) | |
e6f2bb66 KM |
652 | ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ |
653 | include/openssl/obj_mac.h \ | |
654 | crypto/objects/obj_dat.h ) | |
9a9f8ee7 RL |
655 | ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ |
656 | crypto/objects/obj_mac.num \ | |
657 | crypto/objects/obj_xref.txt \ | |
658 | > crypto/objects/obj_xref.h ) | |
6bb2106e | 659 | |
b7650c67 RL |
660 | generate_crypto_conf: |
661 | ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ | |
662 | > crypto/conf/conf_def.h ) | |
663 | ||
664 | generate_crypto_asn1: | |
665 | ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ | |
666 | > crypto/asn1/charmap.h ) | |
667 | ||
8e32e1ab RL |
668 | generate_fuzz_oids: |
669 | ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \ | |
670 | crypto/objects/obj_dat.h \ | |
671 | > fuzz/oids.txt ) | |
672 | ||
52df25cf RS |
673 | # Set to -force to force a rebuild |
674 | ERROR_REBUILD= | |
567a9e6f RL |
675 | errors: |
676 | ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c ) | |
52df25cf | 677 | ( cd $(SRCDIR); $(PERL) util/mkerr.pl $(ERROR_REBUILD) -internal ) |
567a9e6f | 678 | ( cd $(SRCDIR)/engines; \ |
52df25cf RS |
679 | for E in *.ec ; do \ |
680 | $(PERL) ../util/mkerr.pl $(ERROR_REBUILD) -static \ | |
681 | -conf $$E `basename $$E .ec`.c ; \ | |
682 | done ) | |
567a9e6f RL |
683 | |
684 | ordinals: | |
685 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update ) | |
686 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update ) | |
687 | ||
688 | test_ordinals: | |
689 | ( cd test; \ | |
690 | SRCTOP=../$(SRCDIR) \ | |
691 | BLDTOP=../$(BLDDIR) \ | |
692 | $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) | |
693 | ||
694 | tags TAGS: FORCE | |
695 | rm -f TAGS tags | |
696 | -ctags -R . | |
697 | -etags `find . -name '*.[ch]' -o -name '*.pm'` | |
698 | ||
699 | # Release targets (note: only available on Unix) ##################### | |
700 | ||
77a9c26e RL |
701 | # If your tar command doesn't support --owner and --group, make sure to |
702 | # use one that does, for example GNU tar | |
a1bce642 | 703 | TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf - |
54bb8f74 | 704 | PREPARE_CMD=: |
567a9e6f | 705 | tar: |
34a5b7d7 | 706 | set -e; \ |
567a9e6f | 707 | TMPDIR=/var/tmp/openssl-copy.$$$$; \ |
54bb8f74 | 708 | DISTDIR=$(NAME); \ |
567a9e6f RL |
709 | mkdir -p $$TMPDIR/$$DISTDIR; \ |
710 | (cd $(SRCDIR); \ | |
5b7b0115 RL |
711 | excl_re=`git submodule status | sed -e 's/^.//' | cut -d' ' -f2`; \ |
712 | excl_re="^(fuzz/corpora|`echo $$excl_re | sed -e 's/ /$$|/g'`\$$)"; \ | |
713 | echo "$$excl_re"; \ | |
567a9e6f | 714 | git ls-tree -r --name-only --full-tree HEAD \ |
17c84aa7 | 715 | | egrep -v "$$excl_re" \ |
567a9e6f RL |
716 | | while read F; do \ |
717 | mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \ | |
718 | cp $$F $$TMPDIR/$$DISTDIR/$$F; \ | |
719 | done); \ | |
17c84aa7 | 720 | (cd $$TMPDIR/$$DISTDIR; \ |
54bb8f74 | 721 | $(PREPARE_CMD); \ |
17c84aa7 RL |
722 | find . -type d -print | xargs chmod 755; \ |
723 | find . -type f -print | xargs chmod a+r; \ | |
724 | find . -type f -perm -0100 -print | xargs chmod a+x); \ | |
725 | (cd $$TMPDIR; $(TAR_COMMAND) $$DISTDIR) \ | |
567a9e6f RL |
726 | | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \ |
727 | rm -rf $$TMPDIR | |
728 | cd $(SRCDIR); ls -l $(TARFILE).gz | |
729 | ||
730 | dist: | |
bffa1ff8 | 731 | @$(MAKE) PREPARE_CMD='$(PERL) ./Configure dist' TARFILE="$(TARFILE)" NAME="$(NAME)" tar |
567a9e6f RL |
732 | |
733 | # Helper targets ##################################################### | |
734 | ||
342a1a23 | 735 | link-utils: $(BLDDIR)/util/opensslwrap.sh |
567a9e6f | 736 | |
27f42b46 | 737 | $(BLDDIR)/util/opensslwrap.sh: configdata.pm |
567a9e6f RL |
738 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
739 | mkdir -p "$(BLDDIR)/util"; \ | |
740 | ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \ | |
741 | fi | |
342a1a23 | 742 | |
c058fcd7 | 743 | FORCE: |
567a9e6f RL |
744 | |
745 | # Building targets ################################################### | |
746 | ||
8478a703 | 747 | libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -} |
567a9e6f RL |
748 | libcrypto.pc: |
749 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
750 | echo 'exec_prefix=$${prefix}'; \ | |
751 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
752 | echo 'includedir=$${prefix}/include'; \ | |
d4453024 | 753 | echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \ |
567a9e6f RL |
754 | echo ''; \ |
755 | echo 'Name: OpenSSL-libcrypto'; \ | |
756 | echo 'Description: OpenSSL cryptography library'; \ | |
757 | echo 'Version: '$(VERSION); \ | |
758 | echo 'Libs: -L$${libdir} -lcrypto'; \ | |
759 | echo 'Libs.private: $(EX_LIBS)'; \ | |
760 | echo 'Cflags: -I$${includedir}' ) > libcrypto.pc | |
761 | ||
762 | libssl.pc: | |
763 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
764 | echo 'exec_prefix=$${prefix}'; \ | |
765 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
766 | echo 'includedir=$${prefix}/include'; \ | |
767 | echo ''; \ | |
768 | echo 'Name: OpenSSL-libssl'; \ | |
769 | echo 'Description: Secure Sockets Layer and cryptography libraries'; \ | |
770 | echo 'Version: '$(VERSION); \ | |
771 | echo 'Requires.private: libcrypto'; \ | |
772 | echo 'Libs: -L$${libdir} -lssl'; \ | |
567a9e6f RL |
773 | echo 'Cflags: -I$${includedir}' ) > libssl.pc |
774 | ||
775 | openssl.pc: | |
776 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
777 | echo 'exec_prefix=$${prefix}'; \ | |
778 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
779 | echo 'includedir=$${prefix}/include'; \ | |
780 | echo ''; \ | |
781 | echo 'Name: OpenSSL'; \ | |
782 | echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ | |
783 | echo 'Version: '$(VERSION); \ | |
784 | echo 'Requires: libssl libcrypto' ) > openssl.pc | |
785 | ||
41240e68 | 786 | configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} |
27f42b46 | 787 | @echo "Detected changed: $?" |
f9856cc5 | 788 | $(PERL) configdata.pm -r -v |
567a9e6f RL |
789 | @echo "**************************************************" |
790 | @echo "*** ***" | |
791 | @echo "*** Please run the same make command again ***" | |
792 | @echo "*** ***" | |
793 | @echo "**************************************************" | |
794 | @false | |
795 | ||
796 | {- | |
797 | use File::Basename; | |
798 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
cedbb146 RL |
799 | |
800 | # Helper function to figure out dependencies on libraries | |
801 | # It takes a list of library names and outputs a list of dependencies | |
802 | sub compute_lib_depends { | |
84af1bae | 803 | if ($disabled{shared}) { |
33105818 | 804 | return map { lib($_) } @_; |
cedbb146 RL |
805 | } |
806 | ||
807 | # Depending on shared libraries: | |
808 | # On Windows POSIX layers, we depend on {libname}.dll.a | |
809 | # On Unix platforms, we depend on {shlibname}.so | |
186a31e5 | 810 | return map { $_ =~ /\.a$/ ? $`.$libext : shlib_simple($_) } @_; |
cedbb146 RL |
811 | } |
812 | ||
66ddf178 RL |
813 | sub generatesrc { |
814 | my %args = @_; | |
815 | my $generator = join(" ", @{$args{generator}}); | |
8d34daf0 | 816 | my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); |
d4605727 | 817 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
8d34daf0 | 818 | my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}}); |
66ddf178 RL |
819 | |
820 | if ($args{src} !~ /\.[sS]$/) { | |
7cae3864 RL |
821 | if ($args{generator}->[0] =~ m|^.*\.in$|) { |
822 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
823 | "util", "dofile.pl")), | |
824 | rel2abs($config{builddir})); | |
825 | return <<"EOF"; | |
826 | $args{src}: $args{generator}->[0] $deps | |
827 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ | |
828 | "-o$target{build_file}" $generator > \$@ | |
829 | EOF | |
830 | } else { | |
831 | return <<"EOF"; | |
769777b0 | 832 | $args{src}: $args{generator}->[0] $deps |
8d34daf0 | 833 | \$(PERL)$generator_incs $generator > \$@ |
66ddf178 | 834 | EOF |
7cae3864 | 835 | } |
66ddf178 | 836 | } else { |
8458f1bf | 837 | if ($args{generator}->[0] =~ /\.pl$/) { |
8d34daf0 | 838 | $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator; |
8458f1bf | 839 | } elsif ($args{generator}->[0] =~ /\.m4$/) { |
8d34daf0 | 840 | $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' |
8458f1bf RL |
841 | } elsif ($args{generator}->[0] =~ /\.S$/) { |
842 | $generator = undef; | |
843 | } else { | |
844 | die "Generator type for $args{src} unknown: $generator\n"; | |
845 | } | |
846 | ||
847 | if (defined($generator)) { | |
848 | # If the target is named foo.S in build.info, we want to | |
849 | # end up generating foo.s in two steps. | |
850 | if ($args{src} =~ /\.S$/) { | |
851 | (my $target = $args{src}) =~ s|\.S$|.s|; | |
852 | return <<"EOF"; | |
769777b0 | 853 | $target: $args{generator}->[0] $deps |
0218fc37 | 854 | ( trap "rm -f \$@.*" INT 0; \\ |
8458f1bf | 855 | $generator \$@.S; \\ |
8c3bc594 | 856 | \$(CC) $incs \$(CFLAGS) \$(CPPFLAGS) -E \$@.S | \\ |
39199fb3 AP |
857 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\ |
858 | mv -f \$@.i \$@ ) | |
66ddf178 | 859 | EOF |
8458f1bf RL |
860 | } |
861 | # Otherwise.... | |
66ddf178 | 862 | return <<"EOF"; |
769777b0 | 863 | $args{src}: $args{generator}->[0] $deps |
8458f1bf | 864 | $generator \$@ |
66ddf178 | 865 | EOF |
66ddf178 | 866 | } |
8458f1bf | 867 | return <<"EOF"; |
769777b0 | 868 | $args{src}: $args{generator}->[0] $deps |
8c3bc594 | 869 | \$(CC) $incs \$(CFLAGS) \$(CPPFLAGS) -E $args{generator}->[0] | \\ |
39199fb3 | 870 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ |
8458f1bf | 871 | EOF |
66ddf178 RL |
872 | } |
873 | } | |
874 | ||
bb26842d RL |
875 | # Should one wonder about the end of the Perl snippet, it's because this |
876 | # second regexp eats up line endings as well, if the removed path is the | |
877 | # last in the line. We may therefore need to put back a line ending. | |
88297284 | 878 | sub src2obj { |
567a9e6f | 879 | my %args = @_; |
81183680 | 880 | (my $obj = $args{obj}) =~ s|\.o$||; |
674d5858 RL |
881 | my @srcs = map { if ($unified_info{generate}->{$_}) { |
882 | (my $x = $_) =~ s/\.S$/.s/; $x | |
883 | } else { | |
884 | $_ | |
885 | } | |
886 | } ( @{$args{srcs}} ); | |
8458f1bf RL |
887 | my $srcs = join(" ", @srcs); |
888 | my $deps = join(" ", @srcs, @{$args{deps}}); | |
45502bfe | 889 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
da430a55 RL |
890 | unless ($disabled{zlib}) { |
891 | if ($withargs{zlib_include}) { | |
892 | $incs .= " -I".$withargs{zlib_include}; | |
893 | } | |
894 | } | |
81183680 | 895 | my $cmd = '$(CC)'; |
8c3bc594 RL |
896 | my $cmdflags = '$(CFLAGS)'; |
897 | my $cmdcompile = ' -c'; | |
81183680 RL |
898 | my $makedepprog = $disabled{makedepend} ? undef : $config{makedepprog}; |
899 | if (grep /\.rc$/, @srcs) { | |
900 | $cmd = '$(RC)'; | |
901 | $cmdflags = '$(RCFLAGS)'; | |
8c3bc594 | 902 | $cmdcompile = ''; |
81183680 RL |
903 | $makedepprog = undef; |
904 | } elsif (grep /\.(cc|cpp)$/, @srcs) { | |
905 | $cmd = '$(CXX)'; | |
8c3bc594 | 906 | $cmdflags = '$(CXXFLAGS)'; |
81183680 RL |
907 | $cmdflags .= ' ' . { lib => '$(LIB_CXXFLAGS)', |
908 | dso => '$(DSO_CXXFLAGS)', | |
909 | bin => '$(BIN_CXXFLAGS)' } -> {$args{intent}}; | |
8c3bc594 RL |
910 | $cmdflags .= ' $(CPPFLAGS)'; |
911 | $cmdflags .= ' ' . { lib => '$(LIB_CPPFLAGS)', | |
912 | dso => '$(DSO_CPPFLAGS)', | |
913 | bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}}; | |
7763472f | 914 | } else { |
81183680 RL |
915 | $cmdflags .= ' ' . { lib => '$(LIB_CFLAGS)', |
916 | dso => '$(DSO_CFLAGS)', | |
917 | bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; | |
8c3bc594 RL |
918 | $cmdflags .= ' $(CPPFLAGS)'; |
919 | $cmdflags .= ' ' . { lib => '$(LIB_CPPFLAGS)', | |
920 | dso => '$(DSO_CPPFLAGS)', | |
921 | bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}}; | |
7763472f | 922 | } |
8c3bc594 | 923 | $cmdflags .= $cmdcompile; |
7e5b8b93 RL |
924 | my $recipe = <<"EOF"; |
925 | $obj$objext: $deps | |
926 | EOF | |
81183680 | 927 | if (defined $makedepprog && $makedepprog !~ /\/makedepend/) { |
29eed3dd | 928 | $recipe .= <<"EOF"; |
81183680 | 929 | $cmd $incs $cmdflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs |
7e5b8b93 RL |
930 | \@touch $obj$depext.tmp |
931 | \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\ | |
932 | rm -f $obj$depext.tmp; \\ | |
29b28eee | 933 | else \\ |
7e5b8b93 | 934 | mv $obj$depext.tmp $obj$depext; \\ |
987dbc7f | 935 | fi |
29eed3dd | 936 | EOF |
7e5b8b93 | 937 | } else { |
29eed3dd | 938 | $recipe .= <<"EOF"; |
81183680 | 939 | $cmd $incs $cmdflags -o \$\@ $srcs |
567a9e6f | 940 | EOF |
81183680 | 941 | if (defined $makedepprog && $makedepprog =~ /\/makedepend/) { |
7e5b8b93 | 942 | $recipe .= <<"EOF"; |
81183680 | 943 | -\$(MAKEDEPEND) -f- -o"|\$\@" -- $incs $cmdflags -- $srcs \\ |
7e5b8b93 RL |
944 | >$obj$depext.tmp 2>/dev/null |
945 | -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' $obj$depext.tmp | |
29b28eee | 946 | \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\ |
987dbc7f | 947 | rm -f $obj$depext.tmp; \\ |
29b28eee RL |
948 | else \\ |
949 | mv $obj$depext.tmp $obj$depext; \\ | |
340da949 | 950 | fi |
567a9e6f | 951 | EOF |
7e5b8b93 | 952 | } |
29eed3dd RL |
953 | } |
954 | return $recipe; | |
567a9e6f RL |
955 | } |
956 | # On Unix, we build shlibs from static libs, so we're ignoring the | |
957 | # object file array. We *know* this routine is only called when we've | |
958 | # configure 'shared'. | |
959 | sub libobj2shlib { | |
960 | my %args = @_; | |
961 | my $lib = $args{lib}; | |
962 | my $shlib = $args{shlib}; | |
963 | my $libd = dirname($lib); | |
964 | my $libn = basename($lib); | |
965 | (my $libname = $libn) =~ s/^lib//; | |
47eeaf45 RL |
966 | my @linkdirs = (); |
967 | foreach (@{args{deps}}) { | |
968 | my $d = dirname($_); | |
969 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
970 | } | |
971 | my $linkflags = join("", map { "-L$_ " } @linkdirs); | |
972 | my $linklibs = join("", map { my $f = basename($_); | |
cedbb146 | 973 | (my $l = $f) =~ s/^lib//; |
47eeaf45 | 974 | " -l$l" } @{$args{deps}}); |
81183680 RL |
975 | my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } |
976 | grep { $_ =~ m|\.o$| } | |
977 | @{$args{objs}}; | |
978 | my @defs = grep { $_ =~ /\.(def|map)$/ } @{$args{objs}}; | |
979 | my @deps = compute_lib_depends(@{$args{deps}}); | |
980 | die "More than one exported symbol map" if scalar @defs > 1; | |
981 | my $objs = join(" ", @objs); | |
982 | my $deps = join(" ", @objs, @defs, @deps); | |
f5c174ff | 983 | my $target = shlib_simple($lib); |
d07abe13 | 984 | my $target_full = shlib($lib); |
81183680 RL |
985 | my $shared_soname = ""; |
986 | $shared_soname .= ' '.$target{shared_sonameflag}.basename($target_full) | |
987 | if defined $target{shared_sonameflag}; | |
988 | my $shared_imp = ""; | |
989 | $shared_imp .= ' '.$target{shared_impflag}.basename($target) | |
990 | if defined $target{shared_impflag}; | |
991 | my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); | |
992 | my $recipe = <<"EOF"; | |
993 | # When building on a Windows POSIX layer (Cygwin or Mingw), we know for a fact | |
cedbb146 RL |
994 | # that two files get produced, {shlibname}.dll and {libname}.dll.a. |
995 | # With all other Unix platforms, we often build a shared library with the | |
996 | # SO version built into the file name and a symlink without the SO version | |
997 | # It's not necessary to have both as targets. The choice falls on the | |
d4453024 RL |
998 | # simplest, {libname}\$(SHLIB_EXT_IMPORT) for Windows POSIX layers and |
999 | # {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms. | |
81183680 | 1000 | $target: $deps |
47eeaf45 | 1001 | \$(CC) \$(CFLAGS) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\ |
81183680 RL |
1002 | -o $target_full$shared_def $objs \\ |
1003 | \$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS) | |
fcf80c46 | 1004 | EOF |
81183680 RL |
1005 | if (windowsdll()) { |
1006 | $recipe .= <<"EOF"; | |
d4453024 RL |
1007 | rm -f apps/$shlib'\$(SHLIB_EXT)' |
1008 | rm -f test/$shlib'\$(SHLIB_EXT)' | |
81183680 | 1009 | rm -f fuzz/$shlib'\$(SHLIB_EXT)' |
d4453024 RL |
1010 | cp -p $shlib'\$(SHLIB_EXT)' apps/ |
1011 | cp -p $shlib'\$(SHLIB_EXT)' test/ | |
81183680 RL |
1012 | cp -p $shlib'\$(SHLIB_EXT)' fuzz/ |
1013 | EOF | |
1014 | } else { | |
1015 | $recipe .= <<"EOF"; | |
50625bf5 RL |
1016 | if [ '$target' != '$target_full' ]; then \\ |
1017 | rm -f $target; \\ | |
1018 | ln -s $target_full $target; \\ | |
1019 | fi | |
567a9e6f | 1020 | EOF |
81183680 | 1021 | } |
567a9e6f | 1022 | } |
5386287c | 1023 | sub obj2dso { |
567a9e6f | 1024 | my %args = @_; |
d07abe13 RL |
1025 | my $dso = $args{lib}; |
1026 | my $dsod = dirname($dso); | |
1027 | my $dson = basename($dso); | |
47eeaf45 RL |
1028 | my @linkdirs = (); |
1029 | foreach (@{args{deps}}) { | |
1030 | my $d = dirname($_); | |
1031 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1032 | } | |
1033 | my $linkflags = join("", map { "-L$_ " } @linkdirs); | |
1034 | my $linklibs = join("", map { my $f = basename($_); | |
81183680 | 1035 | (my $l = $f) =~ s/^lib//; |
47eeaf45 | 1036 | " -l$l" } @{$args{deps}}); |
81183680 RL |
1037 | my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}}; |
1038 | my @deps = compute_lib_depends(@{$args{deps}}); | |
1039 | my $objs = join(" ", @objs); | |
1040 | my $deps = join(" ", @deps); | |
d07abe13 | 1041 | my $target = dso($dso); |
567a9e6f | 1042 | return <<"EOF"; |
f5c174ff | 1043 | $target: $objs $deps |
47eeaf45 | 1044 | \$(CC) \$(CFLAGS) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\ |
81183680 RL |
1045 | -o $target $objs \\ |
1046 | \$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS) | |
567a9e6f RL |
1047 | EOF |
1048 | } | |
1049 | sub obj2lib { | |
1050 | my %args = @_; | |
33105818 | 1051 | (my $lib = $args{lib}) =~ s/\.a$//; |
81183680 RL |
1052 | my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}}; |
1053 | my $objs = join(" ", @objs); | |
567a9e6f | 1054 | return <<"EOF"; |
834aae2a | 1055 | $lib$libext: $objs |
5b18235a | 1056 | \$(AR) \$(ARFLAGS) \$\@ \$\? |
567a9e6f RL |
1057 | \$(RANLIB) \$\@ || echo Never mind. |
1058 | EOF | |
1059 | } | |
1060 | sub obj2bin { | |
1061 | my %args = @_; | |
1062 | my $bin = $args{bin}; | |
1063 | my $bind = dirname($bin); | |
1064 | my $binn = basename($bin); | |
81183680 RL |
1065 | my $objs = join(" ", map { (my $x = $_) =~ s|\.o$|$objext|; $x } |
1066 | @{$args{objs}}); | |
cedbb146 | 1067 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); |
47eeaf45 RL |
1068 | my @linkdirs = (); |
1069 | foreach (@{args{deps}}) { | |
1070 | next if $_ =~ /\.a$/; | |
1071 | my $d = dirname($_); | |
1072 | push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; | |
1073 | } | |
1074 | my $linkflags = join("", map { "-L$_ " } @linkdirs); | |
186a31e5 RL |
1075 | my $linklibs = join("", map { if ($_ =~ /\.a$/) { |
1076 | " $_"; | |
1077 | } else { | |
186a31e5 | 1078 | my $f = basename($_); |
186a31e5 | 1079 | (my $l = $f) =~ s/^lib//; |
47eeaf45 | 1080 | " -l$l" |
186a31e5 RL |
1081 | } |
1082 | } @{$args{deps}}); | |
81183680 RL |
1083 | my $cmd = '$(CC)'; |
1084 | my $cmdflags = '$(CFLAGS) $(BIN_CFLAGS)'; | |
1085 | if (grep /_cc\.o$/, @{$args{objs}}) { | |
1086 | $cmd = '$(CXX)'; | |
1087 | $cmdflags = '$(CXXFLAGS) $(BIN_CXXFLAGS)'; | |
7763472f | 1088 | } |
567a9e6f | 1089 | return <<"EOF"; |
834aae2a | 1090 | $bin$exeext: $objs $deps |
81183680 | 1091 | rm -f $bin$exeext |
47eeaf45 RL |
1092 | \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(LDFLAGS) \$(BIN_LDFLAGS) \\ |
1093 | -o $bin$exeext $objs \\ | |
81183680 | 1094 | \$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS) |
567a9e6f RL |
1095 | EOF |
1096 | } | |
1097 | sub in2script { | |
1098 | my %args = @_; | |
1099 | my $script = $args{script}; | |
1100 | my $sources = join(" ", @{$args{sources}}); | |
1101 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1102 | "util", "dofile.pl")), | |
1103 | rel2abs($config{builddir})); | |
1104 | return <<"EOF"; | |
88297284 | 1105 | $script: $sources |
4b799cea | 1106 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
ba327ade | 1107 | "-o$target{build_file}" $sources > "$script" |
567a9e6f | 1108 | chmod a+x $script |
0ad1d94d RL |
1109 | EOF |
1110 | } | |
1111 | sub generatedir { | |
1112 | my %args = @_; | |
1113 | my $dir = $args{dir}; | |
1114 | my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}}; | |
1115 | my @actions = (); | |
1116 | my %extinfo = ( dso => $dsoext, | |
1117 | lib => $libext, | |
1118 | bin => $exeext ); | |
1119 | ||
1120 | foreach my $type (("dso", "lib", "bin", "script")) { | |
1121 | next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); | |
850000aa RL |
1122 | # For lib object files, we could update the library. However, it |
1123 | # was decided that it's enough to build the directory local object | |
1124 | # files, so we don't need to add any actions, and the dependencies | |
1125 | # are already taken care of. | |
1126 | if ($type ne "lib") { | |
0ad1d94d RL |
1127 | foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { |
1128 | if (dirname($prod) eq $dir) { | |
1129 | push @deps, $prod.$extinfo{$type}; | |
1130 | } else { | |
1131 | push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); | |
1132 | } | |
1133 | } | |
1134 | } | |
1135 | } | |
1136 | ||
1137 | my $deps = join(" ", @deps); | |
1138 | my $actions = join("\n", "", @actions); | |
1139 | return <<"EOF"; | |
1140 | $args{dir} $args{dir}/: $deps$actions | |
567a9e6f RL |
1141 | EOF |
1142 | } | |
1143 | "" # Important! This becomes part of the template result. | |
1144 | -} |