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