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