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