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