]>
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"; | |
11 | our $shlibextsimple = $target{shared_extension_simple} || ".so"; | |
12 | our $shlibextimport = $target{shared_import_extension} || ""; | |
13 | our $dsoext = $target{dso_extension} || ".so"; | |
14 | ||
567a9e6f | 15 | sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } |
f5c174ff RL |
16 | |
17 | # shlib and shlib_simple both take a static library name and figure | |
18 | # out what the shlib name should be. | |
19 | # | |
20 | # When OpenSSL is configured "no-shared", these functions will just | |
21 | # return empty lists, making them suitable to join(). | |
22 | # | |
23 | # With Windows DLL producers, shlib($libname) will return the shared | |
24 | # library name (which usually is different from the static library | |
25 | # name) with the default shared extension appended to it, while | |
26 | # shlib_simple($libname) will return the static library name with | |
27 | # the shared extension followed by ".a" appended to it. The former | |
28 | # result is used as the runtime shared library while the latter is | |
29 | # used as the DLL import library. | |
30 | # | |
31 | # On all Unix systems, shlib($libname) will return the library name | |
32 | # with the default shared extension, while shlib_simple($libname) | |
33 | # will return the name from shlib($libname) with any SO version number | |
34 | # removed. On some systems, they may therefore return the exact same | |
35 | # string. | |
36 | sub shlib { | |
84af1bae | 37 | return () if $disabled{shared}; |
f5c174ff | 38 | my $lib = shift; |
834aae2a | 39 | return $unified_info{sharednames}->{$lib} . $shlibext; |
f5c174ff RL |
40 | } |
41 | sub shlib_simple { | |
84af1bae | 42 | return () if $disabled{shared}; |
f5c174ff RL |
43 | |
44 | my $lib = shift; | |
45 | if (windowsdll()) { | |
834aae2a | 46 | return $lib . $shlibextimport; |
f5c174ff | 47 | } |
834aae2a | 48 | return $lib . $shlibextsimple; |
f5c174ff RL |
49 | } |
50 | ||
51 | # dso is a complement to shlib / shlib_simple that returns the | |
52 | # given libname with the simple shared extension (possible SO version | |
53 | # removed). This differs from shlib_simple() by being unconditional. | |
54 | sub dso { | |
f5c174ff RL |
55 | my $engine = shift; |
56 | ||
834aae2a | 57 | return $engine . $dsoext; |
f5c174ff | 58 | } |
834aae2a | 59 | ''; |
567a9e6f RL |
60 | -} |
61 | PLATFORM={- $config{target} -} | |
62 | OPTIONS={- $config{options} -} | |
63 | CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) | |
64 | SRCDIR={- $config{sourcedir} -} | |
65 | BLDDIR={- $config{builddir} -} | |
66 | ||
67 | VERSION={- $config{version} -} | |
68 | MAJOR={- $config{major} -} | |
69 | MINOR={- $config{minor} -} | |
70 | SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} | |
71 | SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -} | |
72 | SHLIB_MAJOR={- $config{shlib_major} -} | |
73 | SHLIB_MINOR={- $config{shlib_minor} -} | |
74 | SHLIB_TARGET={- $target{shared_target} -} | |
75 | ||
834aae2a | 76 | LIBS={- join(" ", map { $_.$libext } @{$unified_info{libraries}}) -} |
f5c174ff RL |
77 | SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -} |
78 | ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -} | |
834aae2a BL |
79 | PROGRAMS={- join(" ", map { $_.$exeext } grep { !m|^test/| } @{$unified_info{programs}}) -} |
80 | TESTPROGS={- join(" ", map { $_.$exeext } grep { m|^test/| } @{$unified_info{programs}}) -} | |
567a9e6f | 81 | SCRIPTS={- join(" ", @{$unified_info{scripts}}) -} |
29eed3dd | 82 | {- output_off() if $disabled{makedepend}; "" -} |
834aae2a | 83 | DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; } |
c058fcd7 RL |
84 | grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } |
85 | keys %{$unified_info{sources}}); -} | |
29eed3dd | 86 | {- output_on() if $disabled{makedepend}; "" -} |
05a7aee0 RL |
87 | GENERATED={- join(" ", |
88 | ( map { (my $x = $_) =~ s|\.S$|\.s|; $x } | |
89 | grep { defined $unified_info{generate}->{$_} } | |
90 | map { @{$unified_info{sources}->{$_}} } | |
91 | grep { /\.o$/ } keys %{$unified_info{sources}} ), | |
92 | ( grep { /\.h$/ } keys %{$unified_info{generate}} )) -} | |
c058fcd7 | 93 | |
df653379 | 94 | {- output_off() if $disabled{apps}; "" -} |
567a9e6f | 95 | BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash |
b8a9af68 | 96 | MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget |
df653379 | 97 | {- output_on() if $disabled{apps}; "" -} |
567a9e6f | 98 | |
c8c2b779 RL |
99 | SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -} |
100 | ||
3c65577f RL |
101 | # DESTDIR is for package builders so that they can configure for, say, |
102 | # /usr/ and yet have everything installed to /tmp/somedir/usr/. | |
567a9e6f | 103 | # Normally it is left empty. |
3c65577f | 104 | DESTDIR= |
567a9e6f RL |
105 | |
106 | # Do not edit these manually. Use Configure with --prefix or --openssldir | |
107 | # to change this! Short explanation in the top comment in Configure | |
108 | INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet | |
109 | # | |
110 | our $prefix = $config{prefix} || "/usr/local"; | |
111 | $prefix -} | |
112 | OPENSSLDIR={- # | |
113 | # The logic here is that if no --openssldir was given, | |
114 | # OPENSSLDIR will get the value from $prefix plus "/ssl". | |
115 | # If --openssldir was given and the value is an absolute | |
116 | # path, OPENSSLDIR will get its value without change. | |
117 | # If the value from --openssldir is a relative path, | |
118 | # OPENSSLDIR will get $prefix with the --openssldir | |
119 | # value appended as a subdirectory. | |
120 | # | |
121 | use File::Spec::Functions; | |
122 | our $openssldir = | |
123 | $config{openssldir} ? | |
124 | (file_name_is_absolute($config{openssldir}) ? | |
125 | $config{openssldir} | |
126 | : catdir($prefix, $config{openssldir})) | |
127 | : catdir($prefix, "ssl"); | |
128 | $openssldir -} | |
129 | LIBDIR={- # | |
130 | # if $prefix/lib$target{multilib} is not an existing | |
131 | # directory, then assume that it's not searched by linker | |
132 | # automatically, in which case adding $target{multilib} suffix | |
133 | # causes more grief than we're ready to tolerate, so don't... | |
134 | our $multilib = | |
135 | -d "$prefix/lib$target{multilib}" ? $target{multilib} : ""; | |
136 | our $libdir = $config{libdir} || "lib$multilib"; | |
137 | $libdir -} | |
138 | ENGINESDIR={- use File::Spec::Functions; | |
139 | catdir($prefix,$libdir,"engines") -} | |
140 | ||
dde10ab4 | 141 | MANDIR=$(INSTALLTOP)/share/man |
8be7bdb5 RL |
142 | DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) |
143 | HTMLDIR=$(DOCDIR)/html | |
567a9e6f | 144 | |
3544091a RL |
145 | # MANSUFFIX is for the benefit of anyone who may want to have a suffix |
146 | # appended after the manpage file section number. "ssl" is popular, | |
147 | # resulting in files such as config.5ssl rather than config.5. | |
148 | MANSUFFIX= | |
567a9e6f RL |
149 | HTMLSUFFIX=html |
150 | ||
151 | ||
152 | ||
153 | CROSS_COMPILE= {- $config{cross_compile_prefix} -} | |
154 | CC= $(CROSS_COMPILE){- $target{cc} -} | |
2952b9b8 | 155 | CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -} |
076e596f | 156 | CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -} |
940a09ba RL |
157 | LDFLAGS= {- $target{lflags} -} |
158 | PLIB_LDFLAGS= {- $target{plib_lflags} -} | |
2952b9b8 | 159 | EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -} |
bbd9a50f RL |
160 | LIB_CFLAGS={- $target{shared_cflag} || "" -} |
161 | LIB_LDFLAGS={- $target{shared_ldflag}." ".$config{shared_ldflag} | |
162 | # Unlike other OSes (like Solaris, Linux, Tru64, | |
163 | # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD | |
164 | # and FreeBSD) "demand" RPATH set on .so objects. | |
165 | # Apparently application RPATH is not global and | |
166 | # does not apply to .so linked with other .so. | |
167 | # Problem manifests itself when libssl.so fails to | |
168 | # load libcrypto.so. One can argue that we should | |
169 | # engrave this into Makefile.shared rules or into | |
170 | # BSD-* config lines above. Meanwhile let's try to | |
171 | # be cautious and pass -rpath to linker only when | |
172 | # $prefix is not /usr. | |
173 | . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$| | |
174 | ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -} | |
45502bfe | 175 | DSO_CFLAGS={- $target{shared_cflag} || "" -} |
bbd9a50f | 176 | DSO_LDFLAGS=$(LIB_LDFLAGS) |
cba792a1 | 177 | BIN_CFLAGS={- $target{bin_cflags} -} |
567a9e6f RL |
178 | |
179 | PERL={- $config{perl} -} | |
180 | ||
181 | ARFLAGS= {- $target{arflags} -} | |
182 | AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r | |
183 | RANLIB= {- $target{ranlib} -} | |
184 | NM= $(CROSS_COMPILE){- $target{nm} || "nm" -} | |
8f41ff2d RL |
185 | RCFLAGS={- $target{shared_rcflag} -} |
186 | RC= $(CROSS_COMPILE){- $target{rc} || "windres" -} | |
567a9e6f | 187 | RM= rm -f |
98e5534e | 188 | RMDIR= rmdir |
567a9e6f RL |
189 | TAR= {- $target{tar} || "tar" -} |
190 | TARFLAGS= {- $target{tarflags} -} | |
29eed3dd | 191 | MAKEDEPEND={- $config{makedepprog} -} |
567a9e6f RL |
192 | |
193 | BASENAME= openssl | |
194 | NAME= $(BASENAME)-$(VERSION) | |
195 | TARFILE= ../$(NAME).tar | |
196 | ||
197 | # We let the C compiler driver to take care of .s files. This is done in | |
198 | # order to be excused from maintaining a separate set of architecture | |
199 | # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC | |
200 | # gcc, then the driver will automatically translate it to -xarch=v8plus | |
201 | # and pass it down to assembler. | |
202 | AS=$(CC) -c | |
203 | ASFLAG=$(CFLAGS) | |
204 | PERLASM_SCHEME= {- $target{perlasm_scheme} -} | |
205 | ||
206 | # For x86 assembler: Set PROCESSOR to 386 if you want to support | |
207 | # the 80386. | |
208 | PROCESSOR= {- $config{processor} -} | |
209 | ||
210 | # The main targets ################################################### | |
211 | ||
27f42b46 | 212 | all: configdata.pm build_libs_nodep build_engines_nodep build_apps_nodep \ |
c058fcd7 | 213 | depend link-utils |
567a9e6f | 214 | |
27f42b46 | 215 | build_libs: configdata.pm build_libs_nodep depend |
c058fcd7 | 216 | build_libs_nodep: libcrypto.pc libssl.pc openssl.pc |
27f42b46 | 217 | build_engines: configdata.pm build_engines_nodep depend |
c058fcd7 | 218 | build_engines_nodep: $(ENGINES) |
27f42b46 | 219 | build_apps: configdata.pm build_apps_nodep depend |
c058fcd7 | 220 | build_apps_nodep: $(PROGRAMS) $(SCRIPTS) |
27f42b46 | 221 | build_tests: configdata.pm build_tests_nodep depend |
c058fcd7 | 222 | build_tests_nodep: $(TESTPROGS) |
68a5f1a2 | 223 | |
1b741653 RL |
224 | test: tests |
225 | tests: build_tests_nodep build_apps_nodep build_engines_nodep \ | |
226 | depend link-utils | |
d90a6beb | 227 | @ : {- output_off() if $disabled{tests}; "" -} |
567a9e6f RL |
228 | ( cd test; \ |
229 | SRCTOP=../$(SRCDIR) \ | |
230 | BLDTOP=../$(BLDDIR) \ | |
cbece220 | 231 | PERL="$(PERL)" \ |
834aae2a | 232 | EXE_EXT={- $exeext -} \ |
a717738b | 233 | OPENSSL_ENGINES=../$(BLDDIR)/engines \ |
567a9e6f | 234 | $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) ) |
d90a6beb MC |
235 | @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} |
236 | @echo "Tests are not supported with your chosen Configure options" | |
237 | @ : {- output_on() if !$disabled{tests}; "" -} | |
567a9e6f RL |
238 | |
239 | list-tests: | |
cbece220 | 240 | @TOP="$(SRCDIR)" PERL="$(PERL)" $(PERL) $(SRCDIR)/test/run_tests.pl list |
567a9e6f RL |
241 | |
242 | libclean: | |
f99f91f1 RL |
243 | @set -e; for s in $(SHLIB_INFO); do \ |
244 | s1=`echo "$$s" | cut -f1 -d";"`; \ | |
245 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
246 | echo $(RM) $$s1; \ | |
247 | $(RM) $$s1; \ | |
248 | if [ "$$s1" != "$$s2" ]; then \ | |
249 | echo $(RM) $$s2; \ | |
250 | $(RM) $$s2; \ | |
251 | fi; \ | |
252 | done | |
253 | $(RM) $(LIBS) | |
567a9e6f | 254 | |
dde10ab4 | 255 | install: install_sw install_ssldirs install_docs |
567a9e6f RL |
256 | |
257 | uninstall: uninstall_docs uninstall_sw | |
258 | ||
259 | clean: libclean | |
4c1cf7e4 RL |
260 | rm -f $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS) |
261 | rm -f $(GENERATED) | |
262 | -rm -f `find . -name '*{- $depext -}'` | |
263 | -rm -f `find . -name '*{- $objext -}'` | |
264 | rm -f core | |
265 | rm -f tags TAGS | |
266 | rm -f openssl.pc libcrypto.pc libssl.pc | |
1b4d0e3c | 267 | -rm -f `find . -type l -a \! -path "./.git/*"` |
567a9e6f RL |
268 | rm -f $(TARFILE) |
269 | ||
c058fcd7 | 270 | # This exists solely for those who still type 'make depend' |
f8d9d6e4 RL |
271 | # |
272 | # We check if any depfile is newer than Makefile and decide to | |
a6adf099 | 273 | # concatenate only if that is true. |
ea80a25e | 274 | depend: |
29eed3dd | 275 | @: {- output_off() if $disabled{makedepend}; "" -} |
e3d81858 | 276 | @if [ -n "`find $(DEPS) -newer Makefile 2>/dev/null; exit 0`" ]; then \ |
f8d9d6e4 RL |
277 | ( sed -e '/^# DO NOT DELETE THIS LINE.*/,$$d' < Makefile; \ |
278 | echo '# DO NOT DELETE THIS LINE -- make depend depends on it.'; \ | |
279 | echo; \ | |
a6adf099 RL |
280 | for f in $(DEPS); do \ |
281 | if [ -f $$f ]; then cat $$f; fi; \ | |
f8d9d6e4 | 282 | done ) > Makefile.new; \ |
29b28eee | 283 | if cmp Makefile.new Makefile >/dev/null 2>&1; then \ |
f8d9d6e4 | 284 | rm -f Makefile.new; \ |
29b28eee RL |
285 | else \ |
286 | mv -f Makefile.new Makefile; \ | |
f8d9d6e4 | 287 | fi; \ |
c058fcd7 | 288 | fi |
29eed3dd | 289 | @: {- output_on() if $disabled{makedepend}; "" -} |
567a9e6f RL |
290 | |
291 | # Install helper targets ############################################# | |
292 | ||
293 | install_sw: all install_dev install_engines install_runtime | |
294 | ||
f99f91f1 | 295 | uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev |
567a9e6f RL |
296 | |
297 | install_docs: install_man_docs install_html_docs | |
298 | ||
299 | uninstall_docs: uninstall_man_docs uninstall_html_docs | |
8be7bdb5 | 300 | $(RM) -r -v $(DESTDIR)$(DOCDIR) |
567a9e6f | 301 | |
dde10ab4 RL |
302 | install_ssldirs: |
303 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/certs | |
304 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/private | |
305 | ||
567a9e6f RL |
306 | install_dev: |
307 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
308 | @echo "*** Installing development files" | |
3c65577f | 309 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/include/openssl |
567a9e6f RL |
310 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ |
311 | $(BLDDIR)/include/openssl/*.h; do \ | |
312 | fn=`basename $$i`; \ | |
3c65577f RL |
313 | echo "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
314 | cp $$i $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
315 | chmod 644 $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f | 316 | done |
3c65577f | 317 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) |
567a9e6f RL |
318 | @set -e; for l in $(LIBS); do \ |
319 | fn=`basename $$l`; \ | |
3c65577f RL |
320 | echo "install $$l -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
321 | cp $$l $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
322 | $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
323 | chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \ | |
324 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \ | |
325 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
567a9e6f | 326 | done |
84af1bae | 327 | @ : {- output_off() if $disabled{shared}; "" -} |
c8c2b779 RL |
328 | @set -e; for s in $(SHLIB_INFO); do \ |
329 | s1=`echo "$$s" | cut -f1 -d";"`; \ | |
330 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
331 | fn1=`basename $$s1`; \ | |
332 | fn2=`basename $$s2`; \ | |
333 | : {- output_off() if windowsdll(); "" -}; \ | |
334 | echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ | |
335 | cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \ | |
336 | chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \ | |
337 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \ | |
338 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \ | |
339 | if [ "$$fn1" != "$$fn2" ]; then \ | |
340 | echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ | |
341 | ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
567a9e6f | 342 | fi; \ |
c8c2b779 RL |
343 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
344 | echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ | |
345 | cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \ | |
346 | chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \ | |
347 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \ | |
348 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
ce5ed82f | 349 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 350 | done |
84af1bae | 351 | @ : {- output_on() if $disabled{shared}; "" -} |
3c65577f RL |
352 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig |
353 | @echo "install libcrypto.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc" | |
354 | @cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
355 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc | |
356 | @echo "install libssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc" | |
357 | @cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
358 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc | |
359 | @echo "install openssl.pc -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc" | |
360 | @cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
361 | @chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc | |
567a9e6f RL |
362 | |
363 | uninstall_dev: | |
364 | @echo "*** Uninstalling development files" | |
365 | @set -e; for i in $(SRCDIR)/include/openssl/*.h \ | |
366 | $(BLDDIR)/include/openssl/*.h; do \ | |
367 | fn=`basename $$i`; \ | |
3c65577f RL |
368 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ |
369 | $(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \ | |
567a9e6f | 370 | done |
98e5534e RL |
371 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl |
372 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include | |
567a9e6f RL |
373 | @set -e; for l in $(LIBS); do \ |
374 | fn=`basename $$l`; \ | |
3c65577f RL |
375 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \ |
376 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \ | |
567a9e6f | 377 | done |
84af1bae | 378 | @ : {- output_off() if $disabled{shared}; "" -} |
c8c2b779 RL |
379 | @set -e; for s in $(SHLIB_INFO); do \ |
380 | s1=`echo "$$s" | cut -f1 -d";"`; \ | |
381 | s2=`echo "$$s" | cut -f2 -d";"`; \ | |
382 | fn1=`basename $$s1`; \ | |
383 | fn2=`basename $$s2`; \ | |
384 | : {- output_off() if windowsdll(); "" -}; \ | |
385 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \ | |
386 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \ | |
387 | if [ "$$fn1" != "$$fn2" ]; then \ | |
3c65577f RL |
388 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ |
389 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
567a9e6f | 390 | fi; \ |
c8c2b779 RL |
391 | : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ |
392 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \ | |
393 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \ | |
ce5ed82f | 394 | : {- output_on() unless windowsdll(); "" -}; \ |
567a9e6f | 395 | done |
c8cca980 | 396 | @ : {- output_on() if $disabled{shared}; "" -} |
b894054e RL |
397 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc |
398 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc | |
399 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc | |
400 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig | |
401 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) | |
567a9e6f RL |
402 | |
403 | install_engines: | |
404 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
3c65577f | 405 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/ |
567a9e6f | 406 | @echo "*** Installing engines" |
2b364f61 RL |
407 | @set -e; for e in dummy $(ENGINES); do \ |
408 | if [ "$$e" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 409 | fn=`basename $$e`; \ |
f0c93a85 RL |
410 | if [ "$$fn" = '{- dso("ossltest") -}' ]; then \ |
411 | continue; \ | |
412 | fi; \ | |
413 | echo "install $$e -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn"; \ | |
3c65577f RL |
414 | cp $$e $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \ |
415 | chmod 755 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new; \ | |
416 | mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn.new \ | |
417 | $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \ | |
567a9e6f RL |
418 | done |
419 | ||
420 | uninstall_engines: | |
421 | @echo "*** Uninstalling engines" | |
2b364f61 RL |
422 | @set -e; for e in dummy $(ENGINES); do \ |
423 | if [ "$$e" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 424 | fn=`basename $$e`; \ |
f0c93a85 RL |
425 | if [ "$$fn" = '{- dso("ossltest") -}' ]; then \ |
426 | continue; \ | |
427 | fi; \ | |
428 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn"; \ | |
3c65577f | 429 | $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \ |
567a9e6f | 430 | done |
b894054e | 431 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines |
567a9e6f RL |
432 | |
433 | install_runtime: | |
434 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
3c65577f RL |
435 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/bin |
436 | @$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(OPENSSLDIR)/misc | |
567a9e6f | 437 | @echo "*** Installing runtime files" |
fcf80c46 | 438 | : {- output_off() unless windowsdll(); "" -}; |
2b364f61 RL |
439 | @set -e; for s in dummy $(SHLIBS); do \ |
440 | if [ "$$s" = "dummy" ]; then continue; fi; \ | |
f99f91f1 | 441 | fn=`basename $$s`; \ |
3c65577f RL |
442 | echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
443 | cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
444 | chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
445 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
446 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
fcf80c46 | 447 | done |
dac494d2 | 448 | : {- output_on() unless windowsdll(); "" -}; |
2b364f61 RL |
449 | @set -e; for x in dummy $(PROGRAMS); do \ |
450 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 451 | fn=`basename $$x`; \ |
3c65577f RL |
452 | echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
453 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
454 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
455 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
456 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 457 | done |
2b364f61 RL |
458 | @set -e; for x in dummy $(BIN_SCRIPTS); do \ |
459 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 460 | fn=`basename $$x`; \ |
3c65577f RL |
461 | echo "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
462 | cp $$x $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
463 | chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \ | |
464 | mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new \ | |
465 | $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 466 | done |
2b364f61 RL |
467 | @set -e; for x in dummy $(MISC_SCRIPTS); do \ |
468 | if [ "$$x" = "dummy" ]; then continue; fi; \ | |
567a9e6f | 469 | fn=`basename $$x`; \ |
3c65577f RL |
470 | echo "install $$x -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ |
471 | cp $$x $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
472 | chmod 755 $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new; \ | |
473 | mv -f $(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new \ | |
474 | $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ | |
567a9e6f | 475 | done |
3c65577f RL |
476 | @echo "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf" |
477 | @cp $(SRCDIR)/apps/openssl.cnf $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new | |
478 | @chmod 644 $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new | |
479 | @mv -f $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new $(DESTDIR)$(OPENSSLDIR)/openssl.cnf | |
567a9e6f RL |
480 | |
481 | uninstall_runtime: | |
482 | @echo "*** Uninstalling runtime files" | |
2b364f61 | 483 | @set -e; for x in dummy $(PROGRAMS); \ |
567a9e6f | 484 | do \ |
2b364f61 | 485 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 486 | fn=`basename $$x`; \ |
3c65577f RL |
487 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
488 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 489 | done; |
2b364f61 | 490 | @set -e; for x in dummy $(BIN_SCRIPTS); \ |
567a9e6f | 491 | do \ |
2b364f61 | 492 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 493 | fn=`basename $$x`; \ |
3c65577f RL |
494 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
495 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
567a9e6f | 496 | done |
2b364f61 | 497 | @set -e; for x in dummy $(MISC_SCRIPTS); \ |
567a9e6f | 498 | do \ |
2b364f61 | 499 | if [ "$$x" = "dummy" ]; then continue; fi; \ |
567a9e6f | 500 | fn=`basename $$x`; \ |
3c65577f RL |
501 | echo "$(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ |
502 | $(RM) $(DESTDIR)$(OPENSSLDIR)/misc/$$fn; \ | |
567a9e6f | 503 | done |
fcf80c46 | 504 | : {- output_off() unless windowsdll(); "" -}; |
2b364f61 RL |
505 | @set -e; for s in dummy $(SHLIBS); do \ |
506 | if [ "$$s" = "dummy" ]; then continue; fi; \ | |
f99f91f1 | 507 | fn=`basename $$s`; \ |
3c65577f RL |
508 | echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ |
509 | $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \ | |
fcf80c46 | 510 | done |
dac494d2 | 511 | : {- output_on() unless windowsdll(); "" -}; |
3c65577f | 512 | $(RM) $(DESTDIR)$(OPENSSLDIR)/openssl.cnf |
b894054e RL |
513 | -$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin |
514 | -$(RMDIR) $(DESTDIR)$(OPENSSLDIR)/misc | |
567a9e6f RL |
515 | |
516 | # A method to extract all names from a .pod file | |
517 | # The first sed extracts everything between "=head1 NAME" and the next =head1 | |
5287761b RL |
518 | # The perl command joins all the lines into one |
519 | # The second sed removes the description and turns all commas into spaces | |
567a9e6f RL |
520 | # Voilà , you have a space separated list of names! |
521 | EXTRACT_NAMES=sed -e '1,/^=head1 *NAME *$$/d;/^=head1/,$$d' | \ | |
5287761b | 522 | $(PERL) -p -0 -e 's/\n/ /g; END {print "\n"}' | \ |
567a9e6f RL |
523 | sed -e 's/ - .*$$//;s/,/ /g' |
524 | PROCESS_PODS=\ | |
525 | set -e; \ | |
526 | here=`cd $(SRCDIR); pwd`; \ | |
527 | point=$$here/util/point.sh; \ | |
528 | for ds in apps:1 crypto:3 ssl:3; do \ | |
529 | defdir=`echo $$ds | cut -f1 -d:`; \ | |
530 | defsec=`echo $$ds | cut -f2 -d:`; \ | |
531 | for p in $(SRCDIR)/doc/$$defdir/*.pod; do \ | |
532 | SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \ | |
533 | [ -z "$$SEC" ] && SEC=$$defsec; \ | |
534 | fn=`basename $$p .pod`; \ | |
beadb441 | 535 | Name=$$fn; \ |
567a9e6f RL |
536 | NAME=`echo $$fn | tr [a-z] [A-Z]`; \ |
537 | suf=`eval "echo $$OUTSUFFIX"`; \ | |
538 | top=`eval "echo $$OUTTOP"`; \ | |
539 | $(PERL) $(SRCDIR)/util/mkdir-p.pl $$top/man$$SEC; \ | |
540 | echo "install $$p -> $$top/man$$SEC/$$fn$$suf"; \ | |
541 | cat $$p | eval "$$GENERATE" \ | |
542 | > $$top/man$$SEC/$$fn$$suf; \ | |
543 | names=`cat $$p | $(EXTRACT_NAMES)`; \ | |
544 | ( cd $$top/man$$SEC; \ | |
545 | for n in $$names; do \ | |
3af104f3 RL |
546 | comp_n="$$n"; \ |
547 | comp_fn="$$fn"; \ | |
548 | case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \ | |
549 | comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \ | |
550 | comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \ | |
551 | ;; \ | |
552 | esac; \ | |
553 | if [ "$$comp_n" != "$$comp_fn" ]; then \ | |
567a9e6f RL |
554 | echo "link $$top/man$$SEC/$$n$$suf -> $$top/man$$SEC/$$fn$$suf"; \ |
555 | PLATFORM=$(PLATFORM) $$point $$fn$$suf $$n$$suf; \ | |
556 | fi; \ | |
557 | done ); \ | |
558 | done; \ | |
559 | done | |
560 | UNINSTALL_DOCS=\ | |
561 | set -e; \ | |
562 | here=`cd $(SRCDIR); pwd`; \ | |
563 | for ds in apps:1 crypto:3 ssl:3; do \ | |
564 | defdir=`echo $$ds | cut -f1 -d:`; \ | |
565 | defsec=`echo $$ds | cut -f2 -d:`; \ | |
566 | for p in $(SRCDIR)/doc/$$defdir/*.pod; do \ | |
567 | SEC=`sed -ne 's/^=for *comment *openssl_manual_section: *\([0-9]\) *$$/\1/p' $$p`; \ | |
568 | [ -z "$$SEC" ] && SEC=$$defsec; \ | |
569 | fn=`basename $$p .pod`; \ | |
570 | suf=`eval "echo $$OUTSUFFIX"`; \ | |
571 | top=`eval "echo $$OUTTOP"`; \ | |
572 | echo "$(RM) $$top/man$$SEC/$$fn$$suf"; \ | |
573 | $(RM) $$top/man$$SEC/$$fn$$suf; \ | |
574 | names=`cat $$p | $(EXTRACT_NAMES)`; \ | |
575 | for n in $$names; do \ | |
3af104f3 RL |
576 | comp_n="$$n"; \ |
577 | comp_fn="$$fn"; \ | |
578 | case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \ | |
579 | comp_n=`echo "$$n" | tr [A-Z] [a-z]`; \ | |
580 | comp_fn=`echo "$$fn" | tr [A-Z] [a-z]`; \ | |
581 | ;; \ | |
582 | esac; \ | |
583 | if [ "$$comp_n" != "$$comp_fn" ]; then \ | |
567a9e6f RL |
584 | echo "$(RM) $$top/man$$SEC/$$n$$suf"; \ |
585 | $(RM) $$top/man$$SEC/$$n$$suf; \ | |
586 | fi; \ | |
587 | done; \ | |
8be7bdb5 | 588 | ( $(RMDIR) $$top/man$$SEC 2>/dev/null || exit 0 ); \ |
567a9e6f RL |
589 | done; \ |
590 | done | |
591 | ||
592 | install_man_docs: | |
593 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
594 | @echo "*** Installing manpages" | |
595 | @\ | |
596 | OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \ | |
3c65577f | 597 | OUTTOP="$(DESTDIR)$(MANDIR)"; \ |
567a9e6f RL |
598 | GENERATE='pod2man --name=$$NAME --section=$$SEC --center=OpenSSL --release=$(VERSION)'; \ |
599 | $(PROCESS_PODS) | |
600 | ||
601 | uninstall_man_docs: | |
602 | @echo "*** Uninstalling manpages" | |
603 | @\ | |
604 | OUTSUFFIX='.$${SEC}$(MANSUFFIX)'; \ | |
3c65577f | 605 | OUTTOP="$(DESTDIR)$(MANDIR)"; \ |
567a9e6f RL |
606 | $(UNINSTALL_DOCS) |
607 | ||
608 | install_html_docs: | |
609 | @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) | |
610 | @echo "*** Installing HTML manpages" | |
611 | @\ | |
612 | OUTSUFFIX='.$(HTMLSUFFIX)'; \ | |
3c65577f | 613 | OUTTOP="$(DESTDIR)$(HTMLDIR)"; \ |
567a9e6f | 614 | GENERATE="pod2html --podroot=$(SRCDIR)/doc --htmldir=.. \ |
beadb441 | 615 | --podpath=apps:crypto:ssl --title=\$$Name \ |
567a9e6f RL |
616 | | sed -e 's|href=\"http://man.he.net/man|href=\"../man|g'"; \ |
617 | $(PROCESS_PODS) | |
618 | ||
619 | uninstall_html_docs: | |
620 | @echo "*** Uninstalling manpages" | |
621 | @\ | |
622 | OUTSUFFIX='.$(HTMLSUFFIX)'; \ | |
3c65577f | 623 | OUTTOP="$(DESTDIR)$(HTMLDIR)"; \ |
567a9e6f RL |
624 | $(UNINSTALL_DOCS) |
625 | ||
626 | ||
627 | # Developer targets (note: these are only available on Unix) ######### | |
628 | ||
6bb2106e RL |
629 | update: generate errors ordinals |
630 | ||
b7650c67 RL |
631 | generate: generate_apps generate_crypto_bn generate_crypto_objects \ |
632 | generate_crypto_conf generate_crypto_asn1 | |
567a9e6f RL |
633 | |
634 | # Test coverage is a good idea for the future | |
635 | #coverage: $(PROGRAMS) $(TESTPROGRAMS) | |
636 | # ... | |
637 | ||
638 | # Currently disabled, util/selftest.pl needs a rewrite | |
639 | #report: | |
640 | # SRCDIR=$(SRCDIR) @$(PERL) util/selftest.pl | |
641 | ||
642 | lint: | |
643 | lint -DLINT $(INCLUDES) $(SRCS) | |
644 | ||
9a9f8ee7 RL |
645 | {- # because the program apps/openssl has object files as sources, and |
646 | # they then have the corresponding C files as source, we need to chain | |
647 | # the lookups in %unified_info | |
648 | my $apps_openssl = catfile("apps","openssl"); | |
649 | our @openssl_source = map { @{$unified_info{sources}->{$_}} } | |
650 | @{$unified_info{sources}->{$apps_openssl}}; | |
651 | ""; -} | |
652 | generate_apps: | |
653 | ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ | |
654 | < apps/openssl.cnf > apps/openssl-vms.cnf ) | |
655 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b apps/progs.pl \ | |
656 | {- join(" ", @openssl_source) -} \ | |
657 | > apps/progs.h ) | |
658 | ||
659 | generate_crypto_bn: | |
660 | ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) | |
661 | ||
662 | generate_crypto_objects: | |
9a9f8ee7 RL |
663 | ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ |
664 | crypto/objects/objects.txt \ | |
665 | crypto/objects/obj_mac.num \ | |
666 | include/openssl/obj_mac.h ) | |
e6f2bb66 KM |
667 | ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ |
668 | include/openssl/obj_mac.h \ | |
669 | crypto/objects/obj_dat.h ) | |
9a9f8ee7 RL |
670 | ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ |
671 | crypto/objects/obj_mac.num \ | |
672 | crypto/objects/obj_xref.txt \ | |
673 | > crypto/objects/obj_xref.h ) | |
6bb2106e | 674 | |
b7650c67 RL |
675 | generate_crypto_conf: |
676 | ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ | |
677 | > crypto/conf/conf_def.h ) | |
678 | ||
679 | generate_crypto_asn1: | |
680 | ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ | |
681 | > crypto/asn1/charmap.h ) | |
682 | ||
567a9e6f RL |
683 | errors: |
684 | ( cd $(SRCDIR); $(PERL) util/ck_errf.pl -strict */*.c */*/*.c ) | |
685 | ( cd $(SRCDIR); $(PERL) util/mkerr.pl -recurse -write ) | |
686 | ( cd $(SRCDIR)/engines; \ | |
687 | for e in *.ec; do \ | |
688 | $(PERL) ../util/mkerr.pl -conf $$e \ | |
689 | -nostatic -staticloader -write *.c; \ | |
690 | done ) | |
567a9e6f RL |
691 | |
692 | ordinals: | |
693 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl crypto update ) | |
694 | ( b=`pwd`; cd $(SRCDIR); $(PERL) -I$$b util/mkdef.pl ssl update ) | |
695 | ||
696 | test_ordinals: | |
697 | ( cd test; \ | |
698 | SRCTOP=../$(SRCDIR) \ | |
699 | BLDTOP=../$(BLDDIR) \ | |
700 | $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) | |
701 | ||
702 | tags TAGS: FORCE | |
703 | rm -f TAGS tags | |
704 | -ctags -R . | |
705 | -etags `find . -name '*.[ch]' -o -name '*.pm'` | |
706 | ||
707 | # Release targets (note: only available on Unix) ##################### | |
708 | ||
54bb8f74 RL |
709 | TAR_COMMAND=$(TAR) $(TARFLAGS) --owner 0 --group 0 -cvf - |
710 | PREPARE_CMD=: | |
567a9e6f RL |
711 | tar: |
712 | TMPDIR=/var/tmp/openssl-copy.$$$$; \ | |
54bb8f74 | 713 | DISTDIR=$(NAME); \ |
567a9e6f RL |
714 | mkdir -p $$TMPDIR/$$DISTDIR; \ |
715 | (cd $(SRCDIR); \ | |
716 | git ls-tree -r --name-only --full-tree HEAD \ | |
717 | | while read F; do \ | |
718 | mkdir -p $$TMPDIR/$$DISTDIR/`dirname $$F`; \ | |
719 | cp $$F $$TMPDIR/$$DISTDIR/$$F; \ | |
720 | done); \ | |
721 | (cd $$TMPDIR; \ | |
54bb8f74 | 722 | $(PREPARE_CMD); \ |
567a9e6f RL |
723 | find $$TMPDIR/$$DISTDIR -type d -print | xargs chmod 755; \ |
724 | find $$TMPDIR/$$DISTDIR -type f -print | xargs chmod a+r; \ | |
725 | find $$TMPDIR/$$DISTDIR -type f -perm -0100 -print | xargs chmod a+x; \ | |
54bb8f74 | 726 | $(TAR_COMMAND) $$DISTDIR) \ |
567a9e6f RL |
727 | | (cd $(SRCDIR); gzip --best > $(TARFILE).gz); \ |
728 | rm -rf $$TMPDIR | |
729 | cd $(SRCDIR); ls -l $(TARFILE).gz | |
730 | ||
731 | dist: | |
732 | @$(MAKE) PREPARE_CMD='./Configure dist' tar | |
733 | ||
734 | # Helper targets ##################################################### | |
735 | ||
53ff6ac1 | 736 | link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/util/shlib_wrap.sh |
567a9e6f | 737 | |
27f42b46 | 738 | $(BLDDIR)/util/opensslwrap.sh: configdata.pm |
567a9e6f RL |
739 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
740 | mkdir -p "$(BLDDIR)/util"; \ | |
741 | ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \ | |
742 | fi | |
27f42b46 | 743 | $(BLDDIR)/util/shlib_wrap.sh: configdata.pm |
567a9e6f RL |
744 | @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ |
745 | mkdir -p "$(BLDDIR)/util"; \ | |
746 | ln -sf "../$(SRCDIR)/util/shlib_wrap.sh" "$(BLDDIR)/util"; \ | |
747 | fi | |
c058fcd7 | 748 | FORCE: |
567a9e6f RL |
749 | |
750 | # Building targets ################################################### | |
751 | ||
27f42b46 | 752 | libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) |
567a9e6f RL |
753 | libcrypto.pc: |
754 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
755 | echo 'exec_prefix=$${prefix}'; \ | |
756 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
757 | echo 'includedir=$${prefix}/include'; \ | |
758 | echo ''; \ | |
759 | echo 'Name: OpenSSL-libcrypto'; \ | |
760 | echo 'Description: OpenSSL cryptography library'; \ | |
761 | echo 'Version: '$(VERSION); \ | |
762 | echo 'Libs: -L$${libdir} -lcrypto'; \ | |
763 | echo 'Libs.private: $(EX_LIBS)'; \ | |
764 | echo 'Cflags: -I$${includedir}' ) > libcrypto.pc | |
765 | ||
766 | libssl.pc: | |
767 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
768 | echo 'exec_prefix=$${prefix}'; \ | |
769 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
770 | echo 'includedir=$${prefix}/include'; \ | |
771 | echo ''; \ | |
772 | echo 'Name: OpenSSL-libssl'; \ | |
773 | echo 'Description: Secure Sockets Layer and cryptography libraries'; \ | |
774 | echo 'Version: '$(VERSION); \ | |
775 | echo 'Requires.private: libcrypto'; \ | |
776 | echo 'Libs: -L$${libdir} -lssl'; \ | |
777 | echo 'Libs.private: $(EX_LIBS)'; \ | |
778 | echo 'Cflags: -I$${includedir}' ) > libssl.pc | |
779 | ||
780 | openssl.pc: | |
781 | @ ( echo 'prefix=$(INSTALLTOP)'; \ | |
782 | echo 'exec_prefix=$${prefix}'; \ | |
783 | echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ | |
784 | echo 'includedir=$${prefix}/include'; \ | |
785 | echo ''; \ | |
786 | echo 'Name: OpenSSL'; \ | |
787 | echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ | |
788 | echo 'Version: '$(VERSION); \ | |
789 | echo 'Requires: libssl libcrypto' ) > openssl.pc | |
790 | ||
791 | # Note on the use of $(MFLAGS): this was an older variant of MAKEFLAGS which | |
792 | # wasn't passed down automatically. It's quite safe to use it like we do | |
793 | # below; if it doesn't exist, the result will be empty and 'make' will pick | |
794 | # up $(MAKEFLAGS) which is passed down as an environment variable. | |
c1ea997a | 795 | configdata.pm: $(SRCDIR)/Configurations/unix-Makefile.tmpl $(SRCDIR)/Configurations/common.tmpl $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_infos}}) -} |
27f42b46 | 796 | @echo "Detected changed: $?" |
567a9e6f RL |
797 | @echo "Reconfiguring..." |
798 | $(SRCDIR)/Configure reconf | |
799 | @echo "**************************************************" | |
800 | @echo "*** ***" | |
801 | @echo "*** Please run the same make command again ***" | |
802 | @echo "*** ***" | |
803 | @echo "**************************************************" | |
804 | @false | |
805 | ||
806 | {- | |
807 | use File::Basename; | |
808 | use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; | |
cedbb146 RL |
809 | |
810 | # Helper function to figure out dependencies on libraries | |
811 | # It takes a list of library names and outputs a list of dependencies | |
812 | sub compute_lib_depends { | |
84af1bae | 813 | if ($disabled{shared}) { |
834aae2a | 814 | return map { $_.$libext } @_; |
cedbb146 RL |
815 | } |
816 | ||
817 | # Depending on shared libraries: | |
818 | # On Windows POSIX layers, we depend on {libname}.dll.a | |
819 | # On Unix platforms, we depend on {shlibname}.so | |
f5c174ff | 820 | return map { shlib_simple($_) } @_; |
cedbb146 RL |
821 | } |
822 | ||
66ddf178 RL |
823 | sub generatesrc { |
824 | my %args = @_; | |
825 | my $generator = join(" ", @{$args{generator}}); | |
8d34daf0 | 826 | my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); |
d4605727 | 827 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
8d34daf0 | 828 | my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}}); |
66ddf178 RL |
829 | |
830 | if ($args{src} !~ /\.[sS]$/) { | |
831 | return <<"EOF"; | |
769777b0 | 832 | $args{src}: $args{generator}->[0] $deps |
8d34daf0 | 833 | \$(PERL)$generator_incs $generator > \$@ |
66ddf178 RL |
834 | EOF |
835 | } else { | |
8458f1bf | 836 | if ($args{generator}->[0] =~ /\.pl$/) { |
8d34daf0 | 837 | $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator; |
8458f1bf | 838 | } elsif ($args{generator}->[0] =~ /\.m4$/) { |
8d34daf0 | 839 | $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' |
8458f1bf RL |
840 | } elsif ($args{generator}->[0] =~ /\.S$/) { |
841 | $generator = undef; | |
842 | } else { | |
843 | die "Generator type for $args{src} unknown: $generator\n"; | |
844 | } | |
845 | ||
846 | if (defined($generator)) { | |
847 | # If the target is named foo.S in build.info, we want to | |
848 | # end up generating foo.s in two steps. | |
849 | if ($args{src} =~ /\.S$/) { | |
850 | (my $target = $args{src}) =~ s|\.S$|.s|; | |
851 | return <<"EOF"; | |
769777b0 | 852 | $target: $args{generator}->[0] $deps |
0218fc37 | 853 | ( trap "rm -f \$@.*" INT 0; \\ |
8458f1bf | 854 | $generator \$@.S; \\ |
39199fb3 AP |
855 | \$(CC) \$(CFLAGS) $incs -E \$@.S | \\ |
856 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@.i && \\ | |
857 | mv -f \$@.i \$@ ) | |
66ddf178 | 858 | EOF |
8458f1bf RL |
859 | } |
860 | # Otherwise.... | |
66ddf178 | 861 | return <<"EOF"; |
769777b0 | 862 | $args{src}: $args{generator}->[0] $deps |
8458f1bf | 863 | $generator \$@ |
66ddf178 | 864 | EOF |
66ddf178 | 865 | } |
8458f1bf | 866 | return <<"EOF"; |
769777b0 | 867 | $args{src}: $args{generator}->[0] $deps |
39199fb3 AP |
868 | \$(CC) \$(CFLAGS) $incs -E \$< | \\ |
869 | \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ | |
8458f1bf | 870 | EOF |
66ddf178 RL |
871 | } |
872 | } | |
873 | ||
bb26842d RL |
874 | # Should one wonder about the end of the Perl snippet, it's because this |
875 | # second regexp eats up line endings as well, if the removed path is the | |
876 | # last in the line. We may therefore need to put back a line ending. | |
88297284 | 877 | sub src2obj { |
567a9e6f | 878 | my %args = @_; |
88297284 | 879 | my $obj = $args{obj}; |
674d5858 RL |
880 | my @srcs = map { if ($unified_info{generate}->{$_}) { |
881 | (my $x = $_) =~ s/\.S$/.s/; $x | |
882 | } else { | |
883 | $_ | |
884 | } | |
885 | } ( @{$args{srcs}} ); | |
8458f1bf RL |
886 | my $srcs = join(" ", @srcs); |
887 | my $deps = join(" ", @srcs, @{$args{deps}}); | |
45502bfe | 888 | my $incs = join("", map { " -I".$_ } @{$args{incs}}); |
da430a55 RL |
889 | unless ($disabled{zlib}) { |
890 | if ($withargs{zlib_include}) { | |
891 | $incs .= " -I".$withargs{zlib_include}; | |
892 | } | |
893 | } | |
bbd9a50f | 894 | my $ecflags = { lib => '$(LIB_CFLAGS)', |
45502bfe RL |
895 | dso => '$(DSO_CFLAGS)', |
896 | bin => '$(BIN_CFLAGS)' } -> {$args{intent}}; | |
567a9e6f | 897 | my $makedepprog = $config{makedepprog}; |
29eed3dd RL |
898 | my $recipe = ""; |
899 | if (!$disabled{makedepend} && $makedepprog =~ /\/makedepend/) { | |
900 | $recipe .= <<"EOF"; | |
834aae2a | 901 | $obj$depext: $deps |
f3e5948a RL |
902 | -\$(MAKEDEPEND) -f- -o"|$obj$objext" -- \$(CFLAGS) $ecflags$incs -- $srcs \\ |
903 | >\$\@.tmp 2>/dev/null | |
757c416c | 904 | -\$(PERL) -i -pe 's/^.*\\|//; s/ \\/(\\\\.|[^ ])*//; \$\$_ = undef if (/: *\$\$/ || /^(#.*| *)\$\$/); \$\$_.="\\n" unless !defined(\$\$_) or /\\R\$\$/g;' \$\@.tmp |
29b28eee | 905 | \@if cmp \$\@.tmp \$\@ > /dev/null 2> /dev/null; then \\ |
987dbc7f | 906 | rm -f \$\@.tmp; \\ |
29b28eee RL |
907 | else \\ |
908 | mv \$\@.tmp \$\@; \\ | |
987dbc7f | 909 | fi |
29eed3dd RL |
910 | EOF |
911 | $deps = $obj.$depext; | |
912 | } | |
913 | if ($disabled{makedepend} || $makedepprog =~ /\/makedepend/) { | |
914 | $recipe .= <<"EOF"; | |
915 | $obj$objext: $deps | |
45502bfe | 916 | \$(CC) \$(CFLAGS) $ecflags$incs -c -o \$\@ $srcs |
567a9e6f RL |
917 | EOF |
918 | } | |
29eed3dd RL |
919 | if (!$disabled{makedepend} && $makedepprog !~ /\/makedepend/) { |
920 | $recipe .= <<"EOF"; | |
340da949 RL |
921 | $obj$objext: $deps |
922 | \$(CC) \$(CFLAGS) $ecflags$incs -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs | |
923 | \@touch $obj$depext.tmp | |
29b28eee | 924 | \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\ |
987dbc7f | 925 | rm -f $obj$depext.tmp; \\ |
29b28eee RL |
926 | else \\ |
927 | mv $obj$depext.tmp $obj$depext; \\ | |
340da949 | 928 | fi |
567a9e6f | 929 | EOF |
29eed3dd RL |
930 | } |
931 | return $recipe; | |
567a9e6f RL |
932 | } |
933 | # On Unix, we build shlibs from static libs, so we're ignoring the | |
934 | # object file array. We *know* this routine is only called when we've | |
935 | # configure 'shared'. | |
936 | sub libobj2shlib { | |
937 | my %args = @_; | |
938 | my $lib = $args{lib}; | |
939 | my $shlib = $args{shlib}; | |
940 | my $libd = dirname($lib); | |
941 | my $libn = basename($lib); | |
942 | (my $libname = $libn) =~ s/^lib//; | |
cedbb146 RL |
943 | my $linklibs = join("", map { my $d = dirname($_); |
944 | my $f = basename($_); | |
945 | (my $l = $f) =~ s/^lib//; | |
946 | " -L$d -l$l" } @{$args{deps}}); | |
947 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); | |
567a9e6f RL |
948 | my $shlib_target = $target{shared_target}; |
949 | my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : ""; | |
f5c174ff | 950 | my $target = shlib_simple($lib); |
567a9e6f | 951 | return <<"EOF" |
cedbb146 RL |
952 | # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact |
953 | # that two files get produced, {shlibname}.dll and {libname}.dll.a. | |
954 | # With all other Unix platforms, we often build a shared library with the | |
955 | # SO version built into the file name and a symlink without the SO version | |
956 | # It's not necessary to have both as targets. The choice falls on the | |
834aae2a BL |
957 | # simplest, {libname}$shlibextimport for Windows POSIX layers and |
958 | # {libname}$shlibextsimple for the Unix platforms. | |
959 | $target: $lib$libext $deps $ordinalsfile | |
567a9e6f | 960 | \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ |
cedbb146 | 961 | PLATFORM=\$(PLATFORM) \\ |
cbece220 | 962 | PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ |
8a0a3d29 RL |
963 | INSTALLTOP='\$(INSTALLTOP)' LIBDIR='\$(LIBDIR)' \\ |
964 | LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ | |
cedbb146 | 965 | LIBNAME=$libname LIBVERSION=\$(SHLIB_MAJOR).\$(SHLIB_MINOR) \\ |
8a0a3d29 RL |
966 | LIBCOMPATVERSIONS=';\$(SHLIB_VERSION_HISTORY)' \\ |
967 | CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(LIB_CFLAGS)' \\ | |
8f41ff2d | 968 | LDFLAGS='\$(LDFLAGS)' \\ |
8a0a3d29 | 969 | SHARED_LDFLAGS='\$(LIB_LDFLAGS)' SHLIB_EXT=$shlibext \\ |
8f41ff2d | 970 | RC='\$(RC)' SHARED_RCFLAGS='\$(RCFLAGS)' \\ |
e048fd51 | 971 | link_shlib.$shlib_target |
fcf80c46 RL |
972 | EOF |
973 | . (windowsdll() ? <<"EOF" : ""); | |
834aae2a BL |
974 | rm -f apps/$shlib$shlibext |
975 | rm -f test/$shlib$shlibext | |
976 | cp -p $shlib$shlibext apps/ | |
977 | cp -p $shlib$shlibext test/ | |
567a9e6f RL |
978 | EOF |
979 | } | |
5386287c | 980 | sub obj2dso { |
567a9e6f RL |
981 | my %args = @_; |
982 | my $lib = $args{lib}; | |
983 | my $libd = dirname($lib); | |
984 | my $libn = basename($lib); | |
985 | (my $libname = $libn) =~ s/^lib//; | |
986 | my $shlibdeps = join("", map { my $d = dirname($_); | |
987 | my $f = basename($_); | |
988 | (my $l = $f) =~ s/^lib//; | |
989 | " -L$d -l$l" } @{$args{deps}}); | |
cedbb146 | 990 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); |
567a9e6f | 991 | my $shlib_target = $target{shared_target}; |
834aae2a | 992 | my $objs = join(" ", map { $_.$objext } @{$args{objs}}); |
f5c174ff | 993 | my $target = dso($lib); |
567a9e6f | 994 | return <<"EOF"; |
f5c174ff | 995 | $target: $objs $deps |
567a9e6f | 996 | \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ |
cedbb146 | 997 | PLATFORM=\$(PLATFORM) \\ |
cbece220 | 998 | PERL="\$(PERL)" SRCDIR='\$(SRCDIR)' DSTDIR="$libd" \\ |
8a0a3d29 RL |
999 | LIBDEPS='\$(PLIB_LDFLAGS) '"$shlibdeps"' \$(EX_LIBS)' \\ |
1000 | LIBNAME=$libname LDFLAGS='\$(LDFLAGS)' \\ | |
1001 | CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(DSO_CFLAGS)' \\ | |
1002 | SHARED_LDFLAGS='\$(DSO_LDFLAGS)' \\ | |
834aae2a | 1003 | SHLIB_EXT=$dsoext \\ |
567a9e6f | 1004 | LIBEXTRAS="$objs" \\ |
e048fd51 | 1005 | link_dso.$shlib_target |
567a9e6f RL |
1006 | EOF |
1007 | } | |
1008 | sub obj2lib { | |
1009 | my %args = @_; | |
1010 | my $lib = $args{lib}; | |
834aae2a | 1011 | my $objs = join(" ", map { $_.$objext } @{$args{objs}}); |
567a9e6f | 1012 | return <<"EOF"; |
834aae2a | 1013 | $lib$libext: $objs |
68cd4e3f | 1014 | \$(AR) \$\@ \$\? |
567a9e6f RL |
1015 | \$(RANLIB) \$\@ || echo Never mind. |
1016 | EOF | |
1017 | } | |
1018 | sub obj2bin { | |
1019 | my %args = @_; | |
1020 | my $bin = $args{bin}; | |
1021 | my $bind = dirname($bin); | |
1022 | my $binn = basename($bin); | |
834aae2a | 1023 | my $objs = join(" ", map { $_.$objext } @{$args{objs}}); |
cedbb146 RL |
1024 | my $deps = join(" ",compute_lib_depends(@{$args{deps}})); |
1025 | my $linklibs = join("", map { my $d = dirname($_); | |
1026 | my $f = basename($_); | |
1027 | $d = "." if $d eq $f; | |
1028 | (my $l = $f) =~ s/^lib//; | |
1029 | " -L$d -l$l" } @{$args{deps}}); | |
84af1bae | 1030 | my $shlib_target = $disabled{shared} ? "" : $target{shared_target}; |
567a9e6f | 1031 | return <<"EOF"; |
834aae2a BL |
1032 | $bin$exeext: $objs $deps |
1033 | \$(RM) $bin$exeext | |
567a9e6f | 1034 | \$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\ |
cbece220 | 1035 | PERL="\$(PERL)" SRCDIR=\$(SRCDIR) \\ |
834aae2a | 1036 | APPNAME=$bin$exeext OBJECTS="$objs" \\ |
8a0a3d29 RL |
1037 | LIBDEPS='\$(PLIB_LDFLAGS) '"$linklibs"' \$(EX_LIBS)' \\ |
1038 | CC='\$(CC)' CFLAGS='\$(CFLAGS) \$(BIN_CFLAGS)' \\ | |
1039 | LDFLAGS='\$(LDFLAGS)' LIBRPATH='\$(INSTALLTOP)/\$(LIBDIR)' \\ | |
567a9e6f RL |
1040 | link_app.$shlib_target |
1041 | EOF | |
1042 | } | |
1043 | sub in2script { | |
1044 | my %args = @_; | |
1045 | my $script = $args{script}; | |
1046 | my $sources = join(" ", @{$args{sources}}); | |
1047 | my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, | |
1048 | "util", "dofile.pl")), | |
1049 | rel2abs($config{builddir})); | |
1050 | return <<"EOF"; | |
88297284 | 1051 | $script: $sources |
4b799cea | 1052 | \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ |
ba327ade | 1053 | "-o$target{build_file}" $sources > "$script" |
567a9e6f RL |
1054 | chmod a+x $script |
1055 | EOF | |
1056 | } | |
1057 | "" # Important! This becomes part of the template result. | |
1058 | -} |