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