Cleanup libcrypto.num and make update
[openssl.git] / Makefile.in
1 ##
2 ## Makefile for OpenSSL
3 ##
4 ## {- join("\n## ", @autowarntext) -}
5
6 VERSION={- $config{version} -}
7 MAJOR={- $config{major} -}
8 MINOR={- $config{minor} -}
9 SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
10 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
11 SHLIB_MAJOR={- $config{shlib_major} -}
12 SHLIB_MINOR={- $config{shlib_minor} -}
13 SHLIB_EXT={- $target{shared_extension} || ".so" -}
14 SHLIB_EXT_SIMPLE={- $target{shared_extension_simple} || ".so" -}
15 SHLIB_EXT_IMPORT={- $target{shared_import_extension} || "" -}
16 DSO_EXT={- $target{dso_extension} || ".so" -}
17 PLATFORM={- $config{target} -}
18 OPTIONS={- $config{options} -}
19 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
20 SHLIB_TARGET={- $target{shared_target} -}
21
22 # HERE indicates where this Makefile lives.  This can be used to indicate
23 # where sub-Makefiles are expected to be.  Currently has very limited usage,
24 # and should probably not be bothered with at all.
25 HERE=.
26
27 # DESTDIR is for package builders so that they can configure
28 # for, say, /usr/ and yet have everything installed to /tmp/somedir/usr/.
29 # Normally it is left empty.
30 DESTDIR=
31
32 # Do not edit these manually. Use Configure with --prefix or --openssldir
33 # to change this!  Short explanation in the top comment in Configure
34 INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet
35               #
36               our $prefix = $config{prefix} || "/usr/local";
37               $prefix -}
38 OPENSSLDIR={- #
39               # The logic here is that if no --openssldir was given,
40               # OPENSSLDIR will get the value from $prefix plus "/ssl".
41               # If --openssldir was given and the value is an absolute
42               # path, OPENSSLDIR will get its value without change.
43               # If the value from --openssldir is a relative path,
44               # OPENSSLDIR will get $prefix with the --openssldir
45               # value appended as a subdirectory.
46               #
47               use File::Spec::Functions;
48               our $openssldir =
49                   $config{openssldir} ?
50                       (file_name_is_absolute($config{openssldir}) ?
51                            $config{openssldir}
52                            : catdir($prefix, $config{openssldir}))
53                       : catdir($prefix, "ssl");
54               $openssldir -}
55 LIBDIR={- #
56           # if $prefix/lib$target{multilib} is not an existing
57           # directory, then assume that it's not searched by linker
58           # automatically, in which case adding $target{multilib} suffix
59           # causes more grief than we're ready to tolerate, so don't...
60           our $multilib =
61               -d "$prefix/lib$target{multilib}" ? $target{multilib} : "";
62           our $libdir = $config{libdir} || "lib$multilib";
63           $libdir -}
64 ENGINESDIR={- use File::Spec::Functions;
65               catdir($prefix,$libdir,"engines") -}
66
67 # NO_IDEA - Define to build without the IDEA algorithm
68 # NO_RC4  - Define to build without the RC4 algorithm
69 # NO_RC2  - Define to build without the RC2 algorithm
70 # THREADS - Define when building with threads, you will probably also need any
71 #           system defines as well, i.e. _REENTRANT for Solaris 2.[34]
72 # TERMIO  - Define the termio terminal subsystem, needed if sgtty is missing.
73 # TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
74 # LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
75 # DEVRANDOM - Give this the value of the 'random device' if your OS supports
76 #           one.  32 bytes will be read from this when the random
77 #           number generator is initalised.
78 # SSL_FORBID_ENULL - define if you want the server to be not able to use the
79 #           NULL encryption ciphers.
80 #
81 # LOCK_DEBUG - turns on lots of lock debug output :-)
82 # REF_DEBUG - turn on some xyz_free() assertions.
83 # REF_PRINT - prints some stuff on structure free.
84 # MFUNC - Make all Malloc/Free/Realloc calls call
85 #       CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
86 #       call application defined callbacks via CRYPTO_set_mem_functions()
87 # MD5_ASM needs to be defined to use the x86 assembler for MD5
88 # SHA1_ASM needs to be defined to use the x86 assembler for SHA1
89 # RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
90 # Do not define B_ENDIAN or L_ENDIAN if 'unsigned long' == 8.  It must
91 # equal 4.
92 # PKCS1_CHECK - pkcs1 tests.
93
94 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
95 CC= $(CROSS_COMPILE){- $target{cc} -}
96 CFLAG={- our $cflags2 = join(" ",(map { "-D".$_} @{$target{defines}}, @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $target{cflags} -} {- $config{cflags} -}
97 CFLAG_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
98 LDFLAG= {- $target{lflags} -} {- $config{lflags} -}
99 PLIB_LDFLAG= {- $target{plib_lflags} -} {- $config{plib_lflags} -}
100 EX_LIBS= {- $target{ex_libs} -} {- $config{ex_libs} -}
101 EXE_EXT= {- $target{exe_extension} -}
102 ARFLAGS= {- $target{arflags} -}
103 AR=$(CROSS_COMPILE){- $target{ar} -} $(ARFLAGS) r
104 RANLIB= {- $target{ranlib} -}
105 NM= $(CROSS_COMPILE){- $target{nm} -}
106 PERL= {- $config{perl} -}
107 #RM= echo --
108 RM= rm -f
109 TAR= tar
110 TARFLAGS= --no-recursion
111 MAKEDEPPROG=$(CROSS_COMPILE){- $config{makedepprog} -}
112
113 # We let the C compiler driver to take care of .s files. This is done in
114 # order to be excused from maintaining a separate set of architecture
115 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
116 # gcc, then the driver will automatically translate it to -xarch=v8plus
117 # and pass it down to assembler.
118 AS=$(CC) -c
119 ASFLAG=$(CFLAG)
120
121 # For x86 assembler: Set PROCESSOR to 386 if you want to support
122 # the 80386.
123 PROCESSOR= {- $config{processor} -}
124
125 # CPUID module collects small commonly used assembler snippets
126 APPS_OBJ={- $target{apps_obj} -}
127 CPUID_OBJ= {- $target{cpuid_obj} -}
128 UPLINK_OBJ= {- $target{uplink_obj} -}
129 BN_ASM= {- $target{bn_obj} -}
130 EC_ASM= {- $target{ec_obj} -}
131 DES_ENC= {- $target{des_obj} -}
132 AES_ENC= {- $target{aes_obj} -}
133 BF_ENC= {- $target{bf_obj} -}
134 CAST_ENC= {- $target{cast_obj} -}
135 RC4_ENC= {- $target{rc4_obj} -}
136 RC5_ENC= {- $target{rc5_obj} -}
137 MD5_ASM_OBJ= {- $target{md5_obj} -}
138 SHA1_ASM_OBJ= {- $target{sha1_obj} -}
139 RMD160_ASM_OBJ= {- $target{rmd160_obj} -}
140 BLAKE2_OBJ= {- $target{blake2_obj} -}
141 WP_ASM_OBJ= {- $target{wp_obj} -}
142 CMLL_ENC= {- $target{cmll_obj} -}
143 MODES_ASM_OBJ= {- $target{modes_obj} -}
144 PADLOCK_ASM_OBJ= {- $target{padlock_obj} -}
145 CHACHA_ENC= {- $target{chacha_obj} -}
146 POLY1305_ASM_OBJ= {- $target{poly1305_obj} -}
147 PERLASM_SCHEME= {- $target{perlasm_scheme} -}
148
149 # Zlib stuff
150 ZLIB_INCLUDE={- $withargs{zlib_include} -}
151 LIBZLIB={- $withargs{zlib_lib} -}
152
153 # This is the location of fipscanister.o and friends.
154 # The FIPS module build will place it $(INSTALLTOP)/lib
155 # but since $(INSTALLTOP) can only take the default value
156 # when the module is built it will be in /usr/local/ssl/lib
157 # $(INSTALLTOP) for this build may be different so hard
158 # code the path.
159
160 FIPSLIBDIR={- $config{fipslibdir} -}
161
162 # The location of the library which contains fipscanister.o
163 # normally it will be libcrypto. If not compiling in FIPS mode
164 # at all this is empty making it a useful test for a FIPS compile.
165
166 FIPSCANLIB={- $config{fips} ? "libcrypto" : "" -}
167
168 # Shared library base address. Currently only used on Windows.
169 #
170
171 BASEADDR={- $config{baseaddr} -}
172
173 DIRS=   {- join(" ", @{$config{dirs}}) -}
174 SHLIBDIRS= crypto ssl
175 INSTALL_SUBS= engines apps tools
176
177 # dirs in crypto to build
178 SDIRS=  {- join(" ", @{$config{sdirs}}) -}
179
180 # tests to perform.  "alltests" is a special word indicating that all tests
181 # should be performed.
182 TESTS = alltests
183
184 MAKEFILE= Makefile
185
186 MANDIR=$(INSTALLTOP)/share/man
187 MAN1=1
188 MAN3=3
189 MANSUFFIX=
190 HTMLSUFFIX=html
191 HTMLDIR=$(INSTALLTOP)/share/doc/$(BASENAME)/html
192 SHELL=/bin/sh
193
194 TOP=    .
195 LIBS=   libcrypto.a libssl.a
196 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
197 SHARED_SSL=libssl$(SHLIB_EXT)
198 SHARED_LIBS={- $disabled{shared} ? '' : '$(SHARED_CRYPTO) $(SHARED_SSL)'  -}
199 SHARED_CFLAG={- $target{shared_cflag} -}
200 SHARED_LDFLAG={- $target{shared_ldflag}." ".$config{shared_ldflag}
201                  # Unlike other OSes (like Solaris, Linux, Tru64,
202                  # IRIX) BSD run-time linkers (tested OpenBSD, NetBSD
203                  # and FreeBSD) "demand" RPATH set on .so objects.
204                  # Apparently application RPATH is not global and
205                  # does not apply to .so linked with other .so.
206                  # Problem manifests itself when libssl.so fails to
207                  # load libcrypto.so. One can argue that we should
208                  # engrave this into Makefile.shared rules or into
209                  # BSD-* config lines above. Meanwhile let's try to
210                  # be cautious and pass -rpath to linker only when
211                  # $prefix is not /usr.
212                  . ($config{target} =~ m|^BSD-| && $prefix !~ m|^/usr/.*$|
213                     ? " -Wl,-rpath,\$\$(LIBRPATH)" : "") -}
214 SHARED_RCFLAG={- $target{shared_rcflag} -}
215 DYNAMIC_ENGINES={- $config{dynamic_engines} -}
216
217 GENERAL=        Makefile
218 BASENAME=       openssl
219 NAME=           $(BASENAME)-$(VERSION)
220 TARFILE=        ../$(NAME).tar
221 HEADER=         e_os.h
222
223 # Directories created on install if they don't exist.
224 INSTALLDIRS=    \
225                 $(DESTDIR)$(INSTALLTOP)/bin \
226                 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR) \
227                 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines \
228                 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
229                 $(DESTDIR)$(INSTALLTOP)/include/openssl \
230                 $(DESTDIR)$(OPENSSLDIR)/misc \
231                 $(DESTDIR)$(OPENSSLDIR)/certs \
232                 $(DESTDIR)$(OPENSSLDIR)/private
233
234 ENGDIRS={- join(" ", @{$config{engdirs}}) -}
235
236 all: Makefile build_all_but_tests
237
238 # as we stick to -e, CLEARENV ensures that local variables in lower
239 # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
240 # shell, which [annoyingly enough] terminates unset with error if VAR
241 # is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
242 # which terminates unset with error if no variable was present:-(
243 CLEARENV=       TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}     \
244                 $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES}       \
245                 $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC}           \
246                 $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \
247                 $${HEADER+HEADER}                               \
248                 $${GENERAL+GENERAL} $${CFLAGS+CFLAGS}           \
249                 $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}           \
250                 $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
251                 $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}     \
252                 $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
253
254 # LC_ALL=C ensures that error [and other] messages are delivered in
255 # same language for uniform treatment.
256 BUILDENV=       LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
257                 CC='$(CC)' CFLAG='$(CFLAG)' CFLAG_Q='$(CFLAG_Q)'        \
258                 SHARED_CFLAG='$(SHARED_CFLAG)'                          \
259                 AS='$(CC)' ASFLAG='$(CFLAG) -c'                 \
260                 AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'        \
261                 CROSS_COMPILE='$(CROSS_COMPILE)'                \
262                 PERL='$(PERL)' DYNAMIC_ENGINES='$(DYNAMIC_ENGINES)'     \
263                 SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)'     \
264                 DESTDIR='$(DESTDIR)'            \
265                 INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)'   \
266                 LIBDIR='$(LIBDIR)'                              \
267                 SHARED_LDFLAG='$(SHARED_LDFLAG)'                \
268                 SHARED_RCFLAG='$(SHARED_RCFLAG)'                \
269                 ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'     \
270                 EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'       \
271                 SHLIB_EXT='$(SHLIB_EXT)' DSO_EXT='$(DSO_EXT)'   \
272                 SHLIB_TARGET='$(SHLIB_TARGET)'  \
273                 LDFLAG='$(LDFLAG)'                              \
274                 PLIB_LDFLAG='$(PLIB_LDFLAG)' EX_LIBS='$(EX_LIBS)'       \
275                 APPS_OBJ='$(APPS_OBJ)' UPLINK_OBJ='$(UPLINK_OBJ)'       \
276                 CPUID_OBJ='$(CPUID_OBJ)' BN_ASM='$(BN_ASM)'     \
277                 EC_ASM='$(EC_ASM)' DES_ENC='$(DES_ENC)'         \
278                 AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)'     \
279                 BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)'       \
280                 RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)'       \
281                 ENGDIRS='$(ENGDIRS)'    \
282                 SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)'                  \
283                 MD5_ASM_OBJ='$(MD5_ASM_OBJ)'                    \
284                 RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)'              \
285                 BLAKE2_OBJ='$(BLAKE2_OBJ)'                      \
286                 WP_ASM_OBJ='$(WP_ASM_OBJ)'                      \
287                 MODES_ASM_OBJ='$(MODES_ASM_OBJ)'                \
288                 PADLOCK_ASM_OBJ='$(PADLOCK_ASM_OBJ)'            \
289                 CHACHA_ENC='$(CHACHA_ENC)'                      \
290                 POLY1305_ASM_OBJ='$(POLY1305_ASM_OBJ)'          \
291                 PERLASM_SCHEME='$(PERLASM_SCHEME)'              \
292                 FIPSLIBDIR='${FIPSLIBDIR}'                      \
293                 FIPSCANLIB="$${FIPSCANLIB:-$(FIPSCANLIB)}"      \
294                 THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
295 # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
296 # which in turn eliminates ambiguities in variable treatment with -e.
297
298 # BUILD_CMD is a generic macro to build a given target in a given
299 # subdirectory.  The target must be given through the shell variable
300 # `target' and the subdirectory to build in must be given through `dir'.
301 # This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
302 # BUILD_ONE_CMD instead.
303 #
304 # RECURSIVE_BUILD_CMD is a macro to build a given target in all
305 # subdirectories defined in $(DIRS).  It requires that the target
306 # is given through the shell variable `target'.
307 #
308 # BUILD_ONE_CMD is a macro to build a given target in a given
309 # subdirectory if that subdirectory is part of $(DIRS).  It requires
310 # exactly the same shell variables as BUILD_CMD.
311 BUILD_CMD=  if [ -d "$$dir" ]; then \
312             (   cd $$dir && echo "making $$target in $$dir..." && \
313                 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
314             ) || exit 1; \
315             fi
316 RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
317 BUILD_ONE_CMD=\
318         if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
319                 $(BUILD_CMD); \
320         fi
321
322 reflect:
323         @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
324
325 sub_all: build_all
326
327 build_all_but_tests: build_libs build_apps build_tools
328 build_all: build_all_but_tests build_tests
329
330 build_libs: build_libcrypto build_libssl openssl.pc
331
332 build_libcrypto: build_crypto build_engines libcrypto.pc
333 build_libssl: build_ssl libssl.pc
334
335 build_crypto:
336         @dir=crypto; target=all; $(BUILD_ONE_CMD)
337 build_ssl: build_crypto
338         @dir=ssl; target=all; $(BUILD_ONE_CMD)
339 build_engines: build_crypto
340         @dir=engines; target=all; AS='$(CC) -c'; export AS; $(BUILD_ONE_CMD)
341
342 build_apps: build_libs
343         @dir=apps; target=all; $(BUILD_ONE_CMD)
344 build_tests: build_libs
345         @dir=test; target=all; $(BUILD_ONE_CMD)
346 build_tools: build_libs
347         @dir=tools; target=all; $(BUILD_ONE_CMD)
348
349 all_testapps: build_libs build_testapps
350 build_testapps:
351         @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
352
353 libcrypto$(SHLIB_EXT): libcrypto.a
354         @if [ "$(SHLIB_TARGET)" != "" ]; then \
355                 if [ "$(FIPSCANLIB)" = "libcrypto" ]; then \
356                         FIPSLD_CC="$(CC)"; CC=fips/fipsld; \
357                         export CC FIPSLD_CC; \
358                 fi; \
359                 $(MAKE) -e SHLIBDIRS=crypto CC="$${CC:-$(CC)}" build-shared; \
360         else \
361                 echo "There's no support for shared libraries on this platform" >&2; \
362                 exit 1; \
363         fi
364
365 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
366         @if [ "$(SHLIB_TARGET)" != "" ]; then \
367                 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
368         else \
369                 echo "There's no support for shared libraries on this platform" >&2; \
370                 exit 1; \
371         fi
372
373 link-shared:
374         @ set -e; for i in $(SHLIBDIRS); do \
375                 $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
376                         LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
377                         LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
378                         symlink.$(SHLIB_TARGET); \
379                 libs="$$libs -l$$i"; \
380         done
381
382 build-shared: do_$(SHLIB_TARGET) link-shared
383
384 do_$(SHLIB_TARGET):
385         @ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
386                 $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
387                         LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
388                         LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
389                         LIBDEPS="$$libs $(EX_LIBS)" \
390                         link_shlib.$(SHLIB_TARGET); \
391                 libs="-l$$i $$libs"; \
392                 case "$(PLATFORM)" in \
393                 Cygwin*) \
394                         rm -f apps/cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll; \
395                         rm -f test/cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll; \
396                         cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll apps/; \
397                         cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll test/; \
398                         ;; \
399                 mingw*) \
400                         arch=; \
401                         if expr $(PLATFORM) : mingw64 > /dev/null; then \
402                                 arch=-x64; \
403                         fi; \
404                         rm -f apps/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \
405                         rm -f test/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \
406                         cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll apps/; \
407                         cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll test/; \
408                         ;; \
409                 esac; \
410         done
411
412 libcrypto.pc: Makefile
413         @ ( echo 'prefix=$(INSTALLTOP)'; \
414             echo 'exec_prefix=$${prefix}'; \
415             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
416             echo 'includedir=$${prefix}/include'; \
417             echo ''; \
418             echo 'Name: OpenSSL-libcrypto'; \
419             echo 'Description: OpenSSL cryptography library'; \
420             echo 'Version: '$(VERSION); \
421             echo 'Requires: '; \
422             echo 'Libs: -L$${libdir} -lcrypto'; \
423             echo 'Libs.private: $(EX_LIBS)'; \
424             echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
425
426 libssl.pc: Makefile
427         @ ( echo 'prefix=$(INSTALLTOP)'; \
428             echo 'exec_prefix=$${prefix}'; \
429             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
430             echo 'includedir=$${prefix}/include'; \
431             echo ''; \
432             echo 'Name: OpenSSL-libssl'; \
433             echo 'Description: Secure Sockets Layer and cryptography libraries'; \
434             echo 'Version: '$(VERSION); \
435             echo 'Requires.private: libcrypto'; \
436             echo 'Libs: -L$${libdir} -lssl'; \
437             echo 'Libs.private: $(EX_LIBS)'; \
438             echo 'Cflags: -I$${includedir}' ) > libssl.pc
439
440 openssl.pc: Makefile
441         @ ( echo 'prefix=$(INSTALLTOP)'; \
442             echo 'exec_prefix=$${prefix}'; \
443             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
444             echo 'includedir=$${prefix}/include'; \
445             echo ''; \
446             echo 'Name: OpenSSL'; \
447             echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
448             echo 'Version: '$(VERSION); \
449             echo 'Requires: libssl libcrypto' ) > openssl.pc
450
451 Makefile: Makefile.in Configure config
452         @echo "Makefile is older than Makefile.in, Configure or config."
453         @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
454         @false
455
456 libclean:
457         rm -f *.map *.so *.so.* *.dylib *.dll engines/*.so engines/*.dll engines/*.dylib *.a engines/*.a */lib */*/lib
458
459 clean:  libclean
460         rm -f */*/*.o */*.o *.o core a.out fluff testlog make.log cctest cctest.c
461         rm -rf *.bak certs/.0
462         @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
463         rm -f $(LIBS) tags TAGS
464         rm -f openssl.pc libssl.pc libcrypto.pc
465         rm -f speed.* .pure
466         rm -f $(TARFILE)
467
468 gentests:
469         @(cd test && echo "generating dummy tests (if needed)..." && \
470         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
471
472 test:   tests
473
474 tests:  build_tests 
475         @(cd test && echo "testing..." && \
476         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
477         @if [ -z "$(CROSS_COMPILE)" ]; then \
478                 OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a; \
479         fi
480
481 list-tests:
482         @(cd test && \
483                 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. list-tests)
484
485 report:
486         @$(PERL) util/selftest.pl
487
488 tags TAGS: FORCE
489         rm -f TAGS tags
490         -ctags -R .
491         -etags `find . -name '*.[ch]' -o -name '*.pm'`
492
493 FORCE:
494
495 depend:
496         @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
497
498 update: generate errors ordinals depend
499
500 generate:
501         (cd apps && PERL='${PERL}' $(MAKE) generate)
502         (cd crypto/bn && PERL='${PERL}' $(MAKE) generate)
503         (cd crypto/objects && PERL='${PERL}' $(MAKE) generate)
504
505 errors:
506         $(PERL) util/ck_errf.pl -strict */*.c */*/*.c
507         $(PERL) util/mkerr.pl -recurse -write
508         (cd engines; $(MAKE) PERL=$(PERL) errors)
509
510 ordinals: util/libcrypto.num util/libssl.num test_ordinals TABLE
511 util/libcrypto.num::
512         $(PERL) util/mkdef.pl crypto update
513 util/libssl.num::
514         $(PERL) util/mkdef.pl ssl update
515 test_ordinals:
516         TOP=$(TOP) PERL=$(PERL) $(PERL) test/run_tests.pl test_ordinals
517
518 TABLE: Configure Configurations/*.conf
519         (echo 'Output of `Configure TABLE'"':"; \
520         $(PERL) Configure TABLE) > TABLE
521
522 # Build distribution tar-file. As the list of files returned by "find" is
523 # pretty long, on several platforms a "too many arguments" error or similar
524 # would occur. Therefore the list of files is temporarily stored into a file
525 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
526 # tar does not support the --files-from option.
527 TAR_COMMAND=$(TAR) $(TARFLAGS) --files-from $(TARFILE).list \
528                                --owner 0 --group 0 \
529                                --transform 's|^|$(NAME)/|' \
530                                -cvf -
531
532 $(TARFILE).list:
533         git diff --quiet HEAD
534         git ls-files | sort > $(TARFILE).list
535
536 tar: $(TARFILE).list
537         find . -type d -print | xargs chmod 755
538         find . -type f -print | xargs chmod a+r
539         find . -type f -perm -0100 -print | xargs chmod a+x
540         $(TAR_COMMAND) | gzip --best > $(TARFILE).gz
541         rm -f $(TARFILE).list
542         ls -l $(TARFILE).gz
543
544 tar-snap: $(TARFILE).list
545         $(TAR_COMMAND) > $(TARFILE)
546         rm -f $(TARFILE).list
547         ls -l $(TARFILE)
548
549 dist:
550         $(PERL) Configure dist
551         @$(MAKE) SDIRS='$(SDIRS)' clean
552         @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' $(DISTTARVARS) tar
553
554 install: all install_docs install_sw
555
556 uninstall: uninstall_sw uninstall_docs
557
558 install_sw:
559         @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALLDIRS)
560         @set -e; for i in include/openssl/*.h; do \
561         (cp $$i $(DESTDIR)$(INSTALLTOP)/$$i; \
562         chmod 644 $(DESTDIR)$(INSTALLTOP)/$$i ); \
563         done;
564         @set -e; target=install; for dir in $(INSTALL_SUBS); do $(BUILD_CMD); done
565         @set -e; liblist="$(LIBS)"; for i in $$liblist ;\
566         do \
567                 if [ -f "$$i" ]; then \
568                 (       echo installing $$i; \
569                         cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
570                         $(RANLIB) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
571                         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
572                         mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
573                 fi; \
574         done;
575         @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
576                 tmp="$(SHARED_LIBS)"; \
577                 for i in $${tmp:-x}; \
578                 do \
579                         if [ -f "$$i" -o -f "$$i.a" ]; then \
580                                 case "$(PLATFORM)" in \
581                                 Cygwin*) \
582                                         c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
583                                         echo installing $$c; \
584                                         cp $$c $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
585                                         chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
586                                         mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$c.new $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
587                                         echo installing $$i.a; \
588                                         cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
589                                         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
590                                         mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
591                                         ;; \
592                                 mingw*) \
593                                         arch=; \
594                                         if expr $(PLATFORM) : mingw64 > /dev/null; then \
595                                                 arch=-x64; \
596                                         fi; \
597                                         m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \
598                                         echo installing $$m; \
599                                         cp $$m $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \
600                                         chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \
601                                         mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$m.new $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
602                                         echo installing $$i.a; \
603                                         cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
604                                         chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
605                                         mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
606                                         ;; \
607                                 *) \
608                                         echo installing $$i; \
609                                         cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
610                                         chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
611                                         mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
612                                         ;; \
613                                 esac; \
614                         fi; \
615                 done; \
616                 (       here="`pwd`"; \
617                         cd $(DESTDIR)$(INSTALLTOP)/$(LIBDIR); \
618                         $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
619                 if [ "$(INSTALLTOP)" != "/usr" ]; then \
620                         echo 'OpenSSL shared libraries have been installed in:'; \
621                         echo '  $(INSTALLTOP)'; \
622                 fi; \
623         fi
624         cp libcrypto.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
625         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
626         cp libssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
627         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
628         cp openssl.pc $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
629         chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
630
631 uninstall_sw:
632         cd include/openssl && files=* && cd $(DESTDIR)$(INSTALLTOP)/include/openssl && $(RM) $$files
633         @for i in $(LIBS) ;\
634         do \
635                 test -f "$$i" && \
636                 echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i && \
637                 $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
638         done;
639         @if [ -n "$(SHARED_LIBS)" ]; then \
640                 tmp="$(SHARED_LIBS)"; \
641                 for i in $${tmp:-x}; \
642                 do \
643                         if [ -f "$$i" -o -f "$$i.a" ]; then \
644                                 case "$(PLATFORM)" in \
645                                 Cygwin*) \
646                                         c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
647                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
648                                         $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
649                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
650                                         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
651                                         ;; \
652                                 mingw*) \
653                                         arch=; \
654                                         if expr $(PLATFORM) : mingw64 > /dev/null; then \
655                                                 arch=-x64; \
656                                         fi; \
657                                         m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \
658                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
659                                         $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
660                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
661                                         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
662                                         ;; \
663                                 *) \
664                                         echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
665                                         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
666                                         ;; \
667                                 esac; \
668                         fi; \
669                 done; \
670         fi
671         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
672         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
673         $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
674         @target=uninstall; for dir in $(INSTALL_SUBS); do $(BUILD_CMD); done
675
676 install_html_docs:
677         here="`pwd`"; \
678         filecase=; \
679         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
680                 filecase=-i; \
681         esac; \
682         for subdir in apps crypto ssl; do \
683                 $(PERL) $(TOP)/util/mkdir-p $(DESTDIR)$(HTMLDIR)/$$subdir; \
684                 for i in doc/$$subdir/*.pod; do \
685                         fn=`basename $$i .pod`; \
686                         echo "installing html/$$fn.$(HTMLSUFFIX)"; \
687                         cat $$i \
688                         | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
689                         | pod2html --podroot=doc --htmlroot=.. --podpath=$$subdir:apps:crypto:ssl \
690                         | sed -r 's/<!DOCTYPE.*//g' \
691                         > $(DESTDIR)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
692                         $(PERL) util/extract-names.pl < $$i | \
693                                 grep -v $$filecase "^$$fn\$$" | \
694                                 (cd $(DESTDIR)$(HTMLDIR)/$$subdir; \
695                                  while read n; do \
696                                         PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
697                                  done); \
698                 done; \
699         done
700
701 uninstall_html_docs:
702         here="`pwd`"; \
703         filecase=; \
704         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
705                 filecase=-i; \
706         esac; \
707         for subdir in apps crypto ssl; do \
708                 for i in doc/$$subdir/*.pod; do \
709                         fn=`basename $$i .pod`; \
710                         $(RM) $(DESTDIR)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
711                         $(PERL) util/extract-names.pl < $$i | \
712                                 grep -v $$filecase "^$$fn\$$" | \
713                                 while read n; do \
714                                         $(RM) $(DESTDIR)$(HTMLDIR)/$$subdir/"$$n".$(HTMLSUFFIX); \
715                                 done; \
716                 done; \
717         done
718
719 install_docs:
720         @$(PERL) $(TOP)/util/mkdir-p.pl \
721                 $(DESTDIR)$(MANDIR)/man1 \
722                 $(DESTDIR)$(MANDIR)/man3 \
723                 $(DESTDIR)$(MANDIR)/man5 \
724                 $(DESTDIR)$(MANDIR)/man7
725         here="`pwd`"; \
726         filecase=; \
727         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*|darwin*-*-cc) \
728                 filecase=-i; \
729         esac; \
730         set -e; for i in doc/apps/*.pod; do \
731                 fn=`basename $$i .pod`; \
732                 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
733                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
734                 (cd `$(PERL) util/dirname.pl $$i`; \
735                 pod2man \
736                         --section=$$sec --center=OpenSSL \
737                         --release=$(VERSION) `basename $$i`) \
738                         >  $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
739                 $(PERL) util/extract-names.pl < $$i | \
740                         (grep -v $$filecase "^$$fn\$$"; true) | \
741                         (grep -v "[     ]"; true) | \
742                         (cd $(DESTDIR)$(MANDIR)/man$$sec/; \
743                          while read n; do \
744                                 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
745                          done); \
746         done; \
747         set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
748                 fn=`basename $$i .pod`; \
749                 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
750                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
751                 (cd `$(PERL) util/dirname.pl $$i`; \
752                 pod2man \
753                         --section=$$sec --center=OpenSSL \
754                         --release=$(VERSION) `basename $$i`) \
755                         >  $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
756                 $(PERL) util/extract-names.pl < $$i | \
757                         (grep -v $$filecase "^$$fn\$$"; true) | \
758                         (grep -v "[     ]"; true) | \
759                         (cd $(DESTDIR)$(MANDIR)/man$$sec/; \
760                          while read n; do \
761                                 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
762                          done); \
763         done
764
765 uninstall_docs:
766         @here="`pwd`"; \
767         filecase=; \
768         case "$(PLATFORM)" in DJGPP|Cygwin*|mingw*) \
769                 filecase=-i; \
770         esac; \
771         for i in doc/apps/*.pod; do \
772                 fn=`basename $$i .pod`; \
773                 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
774                 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
775                 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
776                 $(PERL) util/extract-names.pl < $$i | \
777                         (grep -v $$filecase "^$$fn\$$"; true) | \
778                         (grep -v "[     ]"; true) | \
779                         while read n; do \
780                                 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
781                                 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
782                         done; \
783         done; \
784         for i in doc/crypto/*.pod doc/ssl/*.pod; do \
785                 fn=`basename $$i .pod`; \
786                 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
787                 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
788                 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
789                 $(PERL) util/extract-names.pl < $$i | \
790                         (grep -v $$filecase "^$$fn\$$"; true) | \
791                         (grep -v "[     ]"; true) | \
792                         while read n; do \
793                                 echo $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
794                                 $(RM) $(DESTDIR)$(MANDIR)/man$$sec/"$$n".$${sec}$(MANSUFFIX); \
795                         done; \
796         done
797
798 # DO NOT DELETE THIS LINE -- make depend depends on it.