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