Missed a couple of spots in the update change
[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 do 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. _REENTERANT 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 TAR= tar
72 TARFLAGS= --no-recursion
73 MAKEDEPPROG=makedepend
74 LIBDIR=lib
75
76 # We let the C compiler driver to take care of .s files. This is done in
77 # order to be excused from maintaining a separate set of architecture
78 # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC
79 # gcc, then the driver will automatically translate it to -xarch=v8plus
80 # and pass it down to assembler.
81 AS=$(CC) -c
82 ASFLAG=$(CFLAG)
83
84 # For x86 assembler: Set PROCESSOR to 386 if you want to support
85 # the 80386.
86 PROCESSOR=
87
88 # CPUID module collects small commonly used assembler snippets
89 CPUID_OBJ= 
90 BN_ASM= bn_asm.o
91 DES_ENC= des_enc.o fcrypt_b.o
92 AES_ENC= aes_core.o aes_cbc.o
93 BF_ENC= bf_enc.o
94 CAST_ENC= c_enc.o
95 RC4_ENC= rc4_enc.o
96 RC5_ENC= rc5_enc.o
97 MD5_ASM_OBJ= 
98 SHA1_ASM_OBJ= 
99 RMD160_ASM_OBJ= 
100 WP_ASM_OBJ=
101 CMLL_ENC=
102 PERLASM_SCHEME=
103
104 # KRB5 stuff
105 KRB5_INCLUDES=
106 LIBKRB5=
107
108 # Zlib stuff
109 ZLIB_INCLUDE=
110 LIBZLIB=
111
112 DIRS=   crypto ssl engines apps test tools
113 ENGDIRS= ccgost
114 SHLIBDIRS= crypto ssl
115
116 # dirs in crypto to build
117 SDIRS=  \
118         objects \
119         md2 md4 md5 sha mdc2 hmac ripemd whrlpool \
120         des aes rc2 rc4 rc5 idea bf cast camellia seed modes \
121         bn ec rsa dsa ecdsa dh ecdh dso engine \
122         buffer bio stack lhash rand err \
123         evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
124         cms pqueue ts jpake store
125 # keep in mind that the above list is adjusted by ./Configure
126 # according to no-xxx arguments...
127
128 # tests to perform.  "alltests" is a special word indicating that all tests
129 # should be performed.
130 TESTS = alltests
131
132 MAKEFILE= Makefile
133
134 MANDIR=$(OPENSSLDIR)/man
135 MAN1=1
136 MAN3=3
137 MANSUFFIX=
138 HTMLSUFFIX=html
139 HTMLDIR=$(OPENSSLDIR)/html
140 SHELL=/bin/sh
141
142 TOP=    .
143 ONEDIRS=out tmp
144 EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
145 WDIRS=  windows
146 LIBS=   libcrypto.a libssl.a
147 SHARED_CRYPTO=libcrypto$(SHLIB_EXT)
148 SHARED_SSL=libssl$(SHLIB_EXT)
149 SHARED_LIBS=
150 SHARED_LIBS_LINK_EXTS=
151 SHARED_LDFLAGS=
152
153 GENERAL=        Makefile
154 BASENAME=       openssl
155 NAME=           $(BASENAME)-$(VERSION)
156 TARFILE=        $(NAME).tar
157 WTARFILE=       $(NAME)-win.tar
158 EXHEADER=       e_os2.h
159 HEADER=         e_os.h
160
161 all: Makefile build_all openssl.pc libssl.pc libcrypto.pc
162
163 # as we stick to -e, CLEARENV ensures that local variables in lower
164 # Makefiles remain local and variable. $${VAR+VAR} is tribute to Korn
165 # shell, which [annoyingly enough] terminates unset with error if VAR
166 # is not present:-( TOP= && unset TOP is tribute to HP-UX /bin/sh,
167 # which terminates unset with error if no variable was present:-(
168 CLEARENV=       TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}     \
169                 $${INCLUDE+INCLUDE} $${INCLUDES+INCLUDES}       \
170                 $${DIR+DIR} $${DIRS+DIRS} $${SRC+SRC}           \
171                 $${LIBSRC+LIBSRC} $${LIBOBJ+LIBOBJ} $${ALL+ALL} \
172                 $${EXHEADER+EXHEADER} $${HEADER+HEADER}         \
173                 $${GENERAL+GENERAL} $${CFLAGS+CFLAGS}           \
174                 $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS}           \
175                 $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \
176                 $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS}     \
177                 $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS}
178
179 BUILDENV=       PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
180                 CC='$(CC)' CFLAG='$(CFLAG)'                     \
181                 AS='$(CC)' ASFLAG='$(CFLAG) -c'                 \
182                 AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'        \
183                 CROSS_COMPILE='$(CROSS_COMPILE)'        \
184                 PERL='$(PERL)' ENGDIRS='$(ENGDIRS)'             \
185                 SDIRS='$(SDIRS)' LIBRPATH='$(INSTALLTOP)/$(LIBDIR)'     \
186                 INSTALL_PREFIX='$(INSTALL_PREFIX)'              \
187                 INSTALLTOP='$(INSTALLTOP)' OPENSSLDIR='$(OPENSSLDIR)'   \
188                 LIBDIR='$(LIBDIR)'                              \
189                 MAKEDEPEND='$$$${TOP}/util/domd $$$${TOP} -MD $(MAKEDEPPROG)' \
190                 DEPFLAG='-DOPENSSL_NO_DEPRECATED $(DEPFLAG)'    \
191                 MAKEDEPPROG='$(MAKEDEPPROG)'                    \
192                 SHARED_LDFLAGS='$(SHARED_LDFLAGS)'              \
193                 KRB5_INCLUDES='$(KRB5_INCLUDES)' LIBKRB5='$(LIBKRB5)'   \
194                 ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'     \
195                 EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'       \
196                 SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)' \
197                 PEX_LIBS='$(PEX_LIBS)' EX_LIBS='$(EX_LIBS)'     \
198                 CPUID_OBJ='$(CPUID_OBJ)'                        \
199                 BN_ASM='$(BN_ASM)' DES_ENC='$(DES_ENC)'         \
200                 AES_ENC='$(AES_ENC)' CMLL_ENC='$(CMLL_ENC)'     \
201                 BF_ENC='$(BF_ENC)' CAST_ENC='$(CAST_ENC)'       \
202                 RC4_ENC='$(RC4_ENC)' RC5_ENC='$(RC5_ENC)'       \
203                 SHA1_ASM_OBJ='$(SHA1_ASM_OBJ)'                  \
204                 MD5_ASM_OBJ='$(MD5_ASM_OBJ)'                    \
205                 RMD160_ASM_OBJ='$(RMD160_ASM_OBJ)'              \
206                 WP_ASM_OBJ='$(WP_ASM_OBJ)'                      \
207                 PERLASM_SCHEME='$(PERLASM_SCHEME)'              \
208                 THIS=$${THIS:-$@} MAKEFILE=Makefile MAKEOVERRIDES=
209 # MAKEOVERRIDES= effectively "equalizes" GNU-ish and SysV-ish make flavors,
210 # which in turn eliminates ambiguities in variable treatment with -e.
211
212 # BUILD_CMD is a generic macro to build a given target in a given
213 # subdirectory.  The target must be given through the shell variable
214 # `target' and the subdirectory to build in must be given through `dir'.
215 # This macro shouldn't be used directly, use RECURSIVE_BUILD_CMD or
216 # BUILD_ONE_CMD instead.
217 #
218 # BUILD_ONE_CMD is a macro to build a given target in a given
219 # subdirectory if that subdirectory is part of $(DIRS).  It requires
220 # exactly the same shell variables as BUILD_CMD.
221 #
222 # RECURSIVE_BUILD_CMD is a macro to build a given target in all
223 # subdirectories defined in $(DIRS).  It requires that the target
224 # is given through the shell variable `target'.
225 BUILD_CMD=  if [ -d "$$dir" ]; then \
226             (   cd $$dir && echo "making $$target in $$dir..." && \
227                 $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. DIR=$$dir $$target \
228             ) || exit 1; \
229             fi
230 RECURSIVE_BUILD_CMD=for dir in $(DIRS); do $(BUILD_CMD); done
231 BUILD_ONE_CMD=\
232         if expr " $(DIRS) " : ".* $$dir " >/dev/null 2>&1; then \
233                 $(BUILD_CMD); \
234         fi
235
236 reflect:
237         @[ -n "$(THIS)" ] && $(CLEARENV) && $(MAKE) $(THIS) -e $(BUILDENV)
238
239 sub_all: build_all
240 build_all: build_libs build_apps build_tests build_tools
241
242 build_libs: build_crypto build_ssl build_engines
243
244 build_crypto:
245         @dir=crypto; target=all; $(BUILD_ONE_CMD)
246 build_ssl:
247         @dir=ssl; target=all; $(BUILD_ONE_CMD)
248 build_engines:
249         @dir=engines; target=all; $(BUILD_ONE_CMD)
250 build_apps:
251         @dir=apps; target=all; $(BUILD_ONE_CMD)
252 build_tests:
253         @dir=test; target=all; $(BUILD_ONE_CMD)
254 build_tools:
255         @dir=tools; target=all; $(BUILD_ONE_CMD)
256
257 all_testapps: build_libs build_testapps
258 build_testapps:
259         @dir=crypto; target=testapps; $(BUILD_ONE_CMD)
260
261 libcrypto$(SHLIB_EXT): libcrypto.a
262         @if [ "$(SHLIB_TARGET)" != "" ]; then \
263                 $(MAKE) SHLIBDIRS=crypto build-shared; \
264         else \
265                 echo "There's no support for shared libraries on this platform" >&2; \
266                 exit 1; \
267         fi
268
269 libssl$(SHLIB_EXT): libcrypto$(SHLIB_EXT) libssl.a
270         @if [ "$(SHLIB_TARGET)" != "" ]; then \
271                 $(MAKE) SHLIBDIRS=ssl SHLIBDEPS='-lcrypto' build-shared; \
272         else \
273                 echo "There's no support for shared libraries on this platform" >&2; \
274                 exit 1; \
275         fi
276
277 clean-shared:
278         @set -e; for i in $(SHLIBDIRS); do \
279                 if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
280                         tmp="$(SHARED_LIBS_LINK_EXTS)"; \
281                         for j in $${tmp:-x}; do \
282                                 ( set -x; rm -f lib$$i$$j ); \
283                         done; \
284                 fi; \
285                 ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
286                 if [ "$(PLATFORM)" = "Cygwin" ]; then \
287                         ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a ); \
288                 fi; \
289         done
290
291 link-shared:
292         @ set -e; for i in $(SHLIBDIRS); do \
293                 $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \
294                         LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
295                         LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
296                         symlink.$(SHLIB_TARGET); \
297                 libs="$$libs -l$$i"; \
298         done
299
300 build-shared: do_$(SHLIB_TARGET) link-shared
301
302 do_$(SHLIB_TARGET):
303         @ set -e; libs='-L. $(SHLIBDEPS)'; for i in $(SHLIBDIRS); do \
304                 if [ "$$i" = "ssl" -a -n "$(LIBKRB5)" ]; then \
305                         libs="$(LIBKRB5) $$libs"; \
306                 fi; \
307                 $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \
308                         LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
309                         LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
310                         LIBDEPS="$$libs $(EX_LIBS)" \
311                         link_a.$(SHLIB_TARGET); \
312                 libs="-l$$i $$libs"; \
313         done
314
315 libcrypto.pc: Makefile
316         @ ( echo 'prefix=$(INSTALLTOP)'; \
317             echo 'exec_prefix=$${prefix}'; \
318             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
319             echo 'includedir=$${prefix}/include'; \
320             echo ''; \
321             echo 'Name: OpenSSL-libcrypto'; \
322             echo 'Description: OpenSSL cryptography library'; \
323             echo 'Version: '$(VERSION); \
324             echo 'Requires: '; \
325             echo 'Libs: -L$${libdir} -lcrypto'; \
326             echo 'Libs.private: $(EX_LIBS)'; \
327             echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libcrypto.pc
328
329 libssl.pc: Makefile
330         @ ( echo 'prefix=$(INSTALLTOP)'; \
331             echo 'exec_prefix=$${prefix}'; \
332             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
333             echo 'includedir=$${prefix}/include'; \
334             echo ''; \
335             echo 'Name: OpenSSL'; \
336             echo 'Description: Secure Sockets Layer and cryptography libraries'; \
337             echo 'Version: '$(VERSION); \
338             echo 'Requires: '; \
339             echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
340             echo 'Libs.private: $(EX_LIBS)'; \
341             echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > libssl.pc
342
343 openssl.pc: Makefile
344         @ ( echo 'prefix=$(INSTALLTOP)'; \
345             echo 'exec_prefix=$${prefix}'; \
346             echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \
347             echo 'includedir=$${prefix}/include'; \
348             echo ''; \
349             echo 'Name: OpenSSL'; \
350             echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \
351             echo 'Version: '$(VERSION); \
352             echo 'Requires: '; \
353             echo 'Libs: -L$${libdir} -lssl -lcrypto'; \
354             echo 'Libs.private: $(EX_LIBS)'; \
355             echo 'Cflags: -I$${includedir} $(KRB5_INCLUDES)' ) > openssl.pc
356
357 Makefile: Makefile.org Configure config
358         @echo "Makefile is older than Makefile.org, Configure or config."
359         @echo "Reconfigure the source tree (via './config' or 'perl Configure'), please."
360         @false
361
362 libclean:
363         rm -f *.map *.so *.so.* *.dll engines/*.so engines/*.dll *.a engines/*.a */lib */*/lib
364
365 clean:  libclean
366         rm -f shlib/*.o *.o core a.out fluff rehash.time testlog make.log cctest cctest.c
367         @set -e; target=clean; $(RECURSIVE_BUILD_CMD)
368         rm -f $(LIBS)
369         rm -f openssl.pc libssl.pc libcrypto.pc
370         rm -f speed.* .pure
371         rm -f $(TARFILE)
372         @set -e; for i in $(ONEDIRS) ;\
373         do \
374         rm -fr $$i/*; \
375         done
376
377 makefile.one: files
378         $(PERL) util/mk1mf.pl >makefile.one; \
379         sh util/do_ms.sh
380
381 files:
382         $(PERL) $(TOP)/util/files.pl Makefile > $(TOP)/MINFO
383         @set -e; target=files; $(RECURSIVE_BUILD_CMD)
384
385 links:
386         @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
387         @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
388         @set -e; target=links; $(RECURSIVE_BUILD_CMD)
389
390 gentests:
391         @(cd test && echo "generating dummy tests (if needed)..." && \
392         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on generate );
393
394 dclean:
395         rm -rf *.bak include/openssl certs/.0
396         @set -e; target=dclean; $(RECURSIVE_BUILD_CMD)
397
398 rehash: rehash.time
399 rehash.time: certs apps
400         @if [ -z "$(CROSS_COMPILE)" ]; then \
401                 (OPENSSL="`pwd`/util/opensslwrap.sh"; \
402                 [ -x "apps/openssl.exe" ] && OPENSSL="apps/openssl.exe" || :; \
403                 OPENSSL_DEBUG_MEMORY=on; \
404                 export OPENSSL OPENSSL_DEBUG_MEMORY; \
405                 $(PERL) tools/c_rehash certs) && \
406                 touch rehash.time; \
407         else :; fi
408
409 test:   tests
410
411 tests: rehash
412         @(cd test && echo "testing..." && \
413         $(CLEARENV) && $(MAKE) -e $(BUILDENV) TOP=.. TESTS='$(TESTS)' OPENSSL_DEBUG_MEMORY=on OPENSSL_CONF=../apps/openssl.cnf tests );
414         OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a
415
416 report:
417         @$(PERL) util/selftest.pl
418
419 update: errors stacks util/libeay.num util/ssleay.num TABLE
420         @set -e; target=update; $(RECURSIVE_BUILD_CMD)
421
422 depend:
423         @set -e; target=depend; $(RECURSIVE_BUILD_CMD)
424
425 lint:
426         @set -e; target=lint; $(RECURSIVE_BUILD_CMD)
427
428 tags:
429         rm -f TAGS
430         find . -name '[^.]*.[ch]' | xargs etags -a
431
432 errors:
433         $(PERL) util/mkerr.pl -recurse -write
434         (cd engines; $(MAKE) PERL=$(PERL) errors)
435         $(PERL) util/ck_errf.pl */*.c */*/*.c
436
437 stacks:
438         $(PERL) util/mkstack.pl -write
439
440 util/libeay.num::
441         $(PERL) util/mkdef.pl crypto update
442
443 util/ssleay.num::
444         $(PERL) util/mkdef.pl ssl update
445
446 TABLE: Configure
447         (echo 'Output of `Configure TABLE'"':"; \
448         $(PERL) Configure TABLE) > TABLE
449
450 # Build distribution tar-file. As the list of files returned by "find" is
451 # pretty long, on several platforms a "too many arguments" error or similar
452 # would occur. Therefore the list of files is temporarily stored into a file
453 # and read directly, requiring GNU-Tar. Call "make TAR=gtar dist" if the normal
454 # tar does not support the --files-from option.
455 tar:
456         find . -type d -print | xargs chmod 755
457         find . -type f -print | xargs chmod a+r
458         find . -type f -perm -0100 -print | xargs chmod a+x
459         find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE | sort > ../$(TARFILE).list; \
460         $(TAR) $(TARFLAGS) --files-from ../$(TARFILE).list -cvf - | \
461         tardy --user_number=0  --user_name=openssl \
462               --group_number=0 --group_name=openssl \
463               --prefix=openssl-$(VERSION) - |\
464         gzip --best >../$(TARFILE).gz; \
465         rm -f ../$(TARFILE).list; \
466         ls -l ../$(TARFILE).gz
467
468 tar-snap:
469         @$(TAR) $(TARFLAGS) -cvf - \
470                 `find * \! -path CVS/\* \! -path \*/CVS/\* \! -name CVS \! -name .cvsignore \! -name STATUS \! -name TABLE \! -name '*.o' \! -name '*.a' \! -name '*.so' \! -name '*.so.*'  \! -name 'openssl' \! -name '*test' \! -name '.#*' \! -name '*~' | sort` |\
471         tardy --user_number=0  --user_name=openssl \
472               --group_number=0 --group_name=openssl \
473               --prefix=openssl-$(VERSION) - > ../$(TARFILE);\
474         ls -l ../$(TARFILE)
475
476 dist:   
477         $(PERL) Configure dist
478         @$(MAKE) dist_pem_h
479         @$(MAKE) SDIRS='$(SDIRS)' clean
480         @$(MAKE) TAR='$(TAR)' TARFLAGS='$(TARFLAGS)' tar
481
482 dist_pem_h:
483         (cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
484
485 install: all install_docs install_sw
486
487 install_sw:
488         @$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
489                 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
490                 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
491                 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig \
492                 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl \
493                 $(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
494                 $(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
495                 $(INSTALL_PREFIX)$(OPENSSLDIR)/private
496         @set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
497         do \
498         (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
499         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
500         done;
501         @set -e; target=install; $(RECURSIVE_BUILD_CMD)
502         @set -e; for i in $(LIBS) ;\
503         do \
504                 if [ -f "$$i" ]; then \
505                 (       echo installing $$i; \
506                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
507                         $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
508                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
509                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i ); \
510                 fi; \
511         done;
512         @set -e; if [ -n "$(SHARED_LIBS)" ]; then \
513                 tmp="$(SHARED_LIBS)"; \
514                 for i in $${tmp:-x}; \
515                 do \
516                         if [ -f "$$i" -o -f "$$i.a" ]; then \
517                         (       echo installing $$i; \
518                                 if [ "$(PLATFORM)" != "Cygwin" ]; then \
519                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
520                                         chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
521                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
522                                 else \
523                                         c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
524                                         cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
525                                         chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
526                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
527                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
528                                         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
529                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/$$i; \
530                                 fi ); \
531                                 if expr $(PLATFORM) : 'mingw' > /dev/null; then \
532                                 (       case $$i in \
533                                                 *crypto*) i=libeay32.dll;; \
534                                                 *ssl*)    i=ssleay32.dll;; \
535                                         esac; \
536                                         echo installing $$i; \
537                                         cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
538                                         chmod 755 $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new; \
539                                         mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i.new $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$i ); \
540                                 fi; \
541                         fi; \
542                 done; \
543                 (       here="`pwd`"; \
544                         cd $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR); \
545                         $(MAKE) -f $$here/Makefile HERE="$$here" link-shared ); \
546                 if [ "$(INSTALLTOP)" != "/usr" ]; then \
547                         echo 'OpenSSL shared libraries have been installed in:'; \
548                         echo '  $(INSTALLTOP)'; \
549                         echo ''; \
550                         sed -e '1,/^$$/d' doc/openssl-shared.txt; \
551                 fi; \
552         fi
553         cp libcrypto.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
554         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
555         cp libssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
556         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
557         cp openssl.pc $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
558         chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
559
560 install_html_docs:
561         here="`pwd`"; \
562         for subdir in apps crypto ssl; do \
563                 mkdir -p $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
564                 for i in doc/$$subdir/*.pod; do \
565                         fn=`basename $$i .pod`; \
566                         echo "installing html/$$fn.$(HTMLSUFFIX)"; \
567                         cat $$i \
568                         | sed -r 's/L<([^)]*)(\([0-9]\))?\|([^)]*)(\([0-9]\))?>/L<\1|\3>/g' \
569                         | pod2html --podroot=doc --htmlroot=.. --podpath=apps:crypto:ssl \
570                         | sed -r 's/<!DOCTYPE.*//g' \
571                         > $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir/$$fn.$(HTMLSUFFIX); \
572                         $(PERL) util/extract-names.pl < $$i | \
573                                 grep -v $$filecase "^$$fn\$$" | \
574                                 (cd $(INSTALL_PREFIX)$(HTMLDIR)/$$subdir; \
575                                  while read n; do \
576                                         PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$(HTMLSUFFIX) "$$n".$(HTMLSUFFIX); \
577                                  done); \
578                 done; \
579         done
580
581 install_docs:
582         @$(PERL) $(TOP)/util/mkdir-p.pl \
583                 $(INSTALL_PREFIX)$(MANDIR)/man1 \
584                 $(INSTALL_PREFIX)$(MANDIR)/man3 \
585                 $(INSTALL_PREFIX)$(MANDIR)/man5 \
586                 $(INSTALL_PREFIX)$(MANDIR)/man7
587         @pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
588         here="`pwd`"; \
589         filecase=; \
590         if [ "$(PLATFORM)" = "DJGPP" -o "$(PLATFORM)" = "Cygwin" -o "$(PLATFORM)" = "mingw" ]; then \
591                 filecase=-i; \
592         fi; \
593         set -e; for i in doc/apps/*.pod; do \
594                 fn=`basename $$i .pod`; \
595                 sec=`$(PERL) util/extract-section.pl 1 < $$i`; \
596                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
597                 (cd `$(PERL) util/dirname.pl $$i`; \
598                 sh -c "$$pod2man \
599                         --section=$$sec --center=OpenSSL \
600                         --release=$(VERSION) `basename $$i`") \
601                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
602                 $(PERL) util/extract-names.pl < $$i | \
603                         (grep -v $$filecase "^$$fn\$$"; true) | \
604                         (grep -v "[     ]"; true) | \
605                         (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
606                          while read n; do \
607                                 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
608                          done); \
609         done; \
610         set -e; for i in doc/crypto/*.pod doc/ssl/*.pod; do \
611                 fn=`basename $$i .pod`; \
612                 sec=`$(PERL) util/extract-section.pl 3 < $$i`; \
613                 echo "installing man$$sec/$$fn.$${sec}$(MANSUFFIX)"; \
614                 (cd `$(PERL) util/dirname.pl $$i`; \
615                 sh -c "$$pod2man \
616                         --section=$$sec --center=OpenSSL \
617                         --release=$(VERSION) `basename $$i`") \
618                         >  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/$$fn.$${sec}$(MANSUFFIX); \
619                 $(PERL) util/extract-names.pl < $$i | \
620                         (grep -v $$filecase "^$$fn\$$"; true) | \
621                         (grep -v "[     ]"; true) | \
622                         (cd $(INSTALL_PREFIX)$(MANDIR)/man$$sec/; \
623                          while read n; do \
624                                 PLATFORM=$(PLATFORM) $$here/util/point.sh $$fn.$${sec}$(MANSUFFIX) "$$n".$${sec}$(MANSUFFIX); \
625                          done); \
626         done
627
628 # DO NOT DELETE THIS LINE -- make depend depends on it.