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