📄 makefile
字号:
#****************************************************************************
#* *
#* Makefile for cryptlib 3.2.1 *
#* Copyright Peter Gutmann 1995-2005 *
#* *
#****************************************************************************
# This makefile contains extensive amounts of, uhh, business logic which,
# alongside further logic in the cryptlib OS-specific header files, ensures
# that cryptlib auto-configures itself and builds out of the box on most
# systems. Before you ask about redoing the makefile using autoconf, have a
# look at what it would take to move all of this logic across to another
# build mechanism.
#
# "The makefile is looking really perverse. You're getting the hang of it"
# - Chris Wedgwood.
# At least it doesn't pipe itself through sed yet.
#
# (Note that as of 3.1 beta 3, it does pipe itself through sed on non-Unix
# systems to retarget Unix-specific files to OS-specific ones and perform
# various other operations that aren't easily possible by adding another
# level of recursion).
#
# The self-test program pulls in parts of cryptlib to ensure that the self-
# configuration works. Because this is handled by the makefile, you can't
# just 'make testlib' after making changes, you need to use 'make; make
# testlib'.
# Naming information: Major and minor version numbers and project and library
# names (static lib, shared lib, and OS X dylib). The patch level is always
# zero because patches imply bugs and my code is perfect.
MAJ = 3
MIN = 2
PLV = 2
PROJ = cl
LIBNAME = lib$(PROJ).a
SLIBNAME = lib$(PROJ).so.$(MAJ).$(MIN).$(PLV)
DYLIBNAME = lib$(PROJ).$(MAJ).$(MIN).dylib
# Extra compiler options for debugging. Add this to the CFLAGS to provide an
# extra level of warnings about potential problems when using gcc. The
# -Wno-switch is necessary because all cryptlib attributes are declared from
# a single pool of enums, but only the values for a particular object class
# are used in the object-specific code, leading to huge numbers of warnings
# about unhandled enum values in case statements. The additional warning
# types are:
#
# -Wshadow: Warn whenever a local variable shadows another local variable,
# parameter or global variable (that is, a local of the same name as
# an existing variable is declared in a nested scope). Note that this
# leads to some false positives as gcc treats forward declarations of
# functions within earlier functions that have the same parameters as
# the function they're declared within as shadowing. This can be
# usually detected in the output by noting that a pile of supposedly
# shadow declarations occur within a few lines of one another.
#
# -Wpointer-arith: Warn about anything that depends on the sizeof a
# function type or of void.
#
# -Wcast-align: Warn whenever a pointer is cast such that the required
# alignment of the target is increased, for example if a "char *" is
# cast to an "int *".
#
# -Wstrict-prototypes: Warn if a function is declared or defined K&R-style.
#
# -Wredundant-decls: Warn if anything is declared more than once in the same
# scope.
#
# -Wformat: Check calls to "printf" etc to make sure that the args supplied
# have types appropriate to the format string.
#
# Note that some of these require the use of at least -O2 in order to be
# detected because they require the use of various levels of data flow
# analysis by the compiler. However, when this is used the optimiser
# interacts badly with -Wunreachable-code due to statements rearranged by
# the optimiser being declared unreachable, so we don't enable this warning.
DEBUG_FLAGS = -Wall -Wno-switch -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wredundant-decls -Wformat
# Compiler options. The IRIX cc doesn't recognise -fPIC, but generates PIC
# by default anyway, so to make this work under IRIX just remove the -fPIC.
# The PHUX compiler requires +z for PIC. OS X generates PIC by default, but
# doesn't mind having -fPIC specified anyway. gcc under Cygwin (and
# specifically Cygwin-native, not a cross-development toolchain hosted under
# Cygwin) generates PIC by default but also doesn't allow -fPIC to be
# explicitly specified, so you need to remove the -fPIC to compile under
# Cygwin native.
#
# For the PIC options, the only difference between -fpic and -fPIC is that
# the latter generates large-displacement jumps while the former doesn't,
# bailing out with an error if a large-displacement jump would be required.
# As a side-effect, -fPIC code is slightly less efficient because of the use
# of large-displacement jumps, so if you're tuning the code for size/speed
# you can try -fpic to see if you get any improvement.
#
# By default this builds the release version of the code, to build the debug
# version (which is useful for finding compiler bugs and system-specific
# peculiarities) remove the NDEBUG define. Many problems will now trigger an
# assertion at the point of failure rather than returning an error status
# from 100 levels down in the code.
#
# Note that the gcc build uses -fomit-frame-pointer to free up an extra
# register on x86 (which desperately needs it), this will screw up gdb if
# you try and debug a version compiled with this option.
#
# If the OS supports it, the multithreaded version of cryptlib will be built.
# To specifically disable this, add -DNO_THREADS.
CFLAGS = -c -D__UNIX__ -DNDEBUG -I.
SCFLAGS = -fPIC -c -D__UNIX__ -DNDEBUG -I.
# To link the self-test code with a key database, uncomment the following
# and substitute the name or names of the database libraries you'll be using.
# TESTLIB = -lodbc
# TESTLIB = -lmysql
# TESTLIB = -L/oracle/product/server/9i/lib -lclient9
# Paths and command names. We have to be careful with comments attached to
# path defines because some makes don't strip trailing spaces.
#
# The reason for the almost-identical defines for path and dir is because of
# the braindamaged BSDI mkdir (and rmdir) that break if the path ends in a
# '/', it's easier to have separate defines than to drop a '/' into every
# path.
STATIC_OBJ_PATH = ./static-obj/
STATIC_OBJ_DIR = ./static-obj
SHARED_OBJ_PATH = ./shared-obj/
SHARED_OBJ_DIR = ./shared-obj
LINKFILE = link.tmp
CPP = $(CC) -E
LD = $(CC)
AR = ar
SHELL = /bin/sh
OSNAME = `uname`
# Default target and obj file path. This is changed depending on whether
# we're building the static or shared library, the default is to build the
# static library.
TARGET = $(LIBNAME)
OBJPATH = $(STATIC_OBJ_PATH)
# Some makes don't pass defines down when they recursively invoke make, so we
# need to manually pass them along. The following macro contains all defines
# that we want to pass to recursive calls to make.
DEFINES = $(TARGET) OBJPATH=$(OBJPATH) OSNAME=$(OSNAME)
# Cross-compilation/non-Unix options, which are just the standard ones with
# Unix-specific entries (-D__UNIX__, use of uname to identify the system)
# removed. The actual values are explicitly given in the rules for each non-
# Unix target.
XCFLAGS = -c -DNDEBUG -I.
XDEFINES = $(TARGET) OBJPATH=$(OBJPATH)
# Cross-compilation paths. The Palm SDK under Cygwin only understands
# heavily-escaped absolute MSDOS pathnames, so it's necessary to specify
# (for example)
# -I"c:/Program\\\ Files/PalmSource/Palm\\\ OS\\\ Developer\\\ Suite/sdk-6/"
# as the SDK path. In practice it's easier to dump all the files in their
# own partition, which is what the Palm SDK target below assumes.
PALMSDK_PATH = "d:/Palm\\\ SDK/sdk-6"
#****************************************************************************
#* *
#* Common Dependencies *
#* *
#****************************************************************************
# The object files that make up cryptlib.
ASMOBJS = $(OBJPATH)md5asm.o $(OBJPATH)rmdasm.o $(OBJPATH)sha1asm.o
BNOBJS = $(OBJPATH)bn_add.o $(OBJPATH)bn_asm.o $(OBJPATH)bn_ctx.o \
$(OBJPATH)bn_div.o $(OBJPATH)bn_exp.o $(OBJPATH)bn_exp2.o \
$(OBJPATH)bn_gcd.o $(OBJPATH)bn_lib.o $(OBJPATH)bn_mod.o \
$(OBJPATH)bn_mont.o $(OBJPATH)bn_mul.o $(OBJPATH)bn_recp.o \
$(OBJPATH)bn_shift.o $(OBJPATH)bn_sqr.o $(OBJPATH)bn_word.o
CERTOBJS = $(OBJPATH)certrev.o $(OBJPATH)certsign.o $(OBJPATH)certval.o \
$(OBJPATH)chain.o $(OBJPATH)chk_cert.o $(OBJPATH)chk_chn.o \
$(OBJPATH)chk_use.o $(OBJPATH)comp_get.o $(OBJPATH)comp_set.o \
$(OBJPATH)dn.o $(OBJPATH)dnstring.o $(OBJPATH)ext.o \
$(OBJPATH)ext_add.o $(OBJPATH)ext_chk.o $(OBJPATH)ext_copy.o \
$(OBJPATH)ext_def.o $(OBJPATH)ext_rd.o $(OBJPATH)ext_wr.o \
$(OBJPATH)imp_exp.o $(OBJPATH)read.o $(OBJPATH)trustmgr.o \
$(OBJPATH)write.o
CRYPTOBJS = $(OBJPATH)aescrypt.o $(OBJPATH)aeskey.o $(OBJPATH)aestab.o \
$(OBJPATH)bfecb.o $(OBJPATH)bfenc.o $(OBJPATH)bfskey.o \
$(OBJPATH)castecb.o $(OBJPATH)castenc.o $(OBJPATH)castskey.o \
$(OBJPATH)descbc.o $(OBJPATH)desecb.o $(OBJPATH)desecb3.o \
$(OBJPATH)desenc.o $(OBJPATH)desskey.o $(OBJPATH)icbc.o \
$(OBJPATH)iecb.o $(OBJPATH)iskey.o $(OBJPATH)rc2cbc.o \
$(OBJPATH)rc2ecb.o $(OBJPATH)rc2skey.o $(OBJPATH)rc4enc.o \
$(OBJPATH)rc4skey.o $(OBJPATH)rc5ecb.o $(OBJPATH)rc5enc.o \
$(OBJPATH)rc5skey.o $(OBJPATH)skipjack.o
CTXOBJS = $(OBJPATH)kg_dlp.o $(OBJPATH)kg_prime.o $(OBJPATH)kg_rsa.o \
$(OBJPATH)keyload.o $(OBJPATH)key_rd.o $(OBJPATH)key_wr.o \
$(OBJPATH)ctx_3des.o $(OBJPATH)ctx_aes.o $(OBJPATH)ctx_bf.o \
$(OBJPATH)ctx_cast.o $(OBJPATH)ctx_des.o $(OBJPATH)ctx_dh.o \
$(OBJPATH)ctx_dsa.o $(OBJPATH)ctx_elg.o $(OBJPATH)ctx_hmd5.o \
$(OBJPATH)ctx_hrmd.o $(OBJPATH)ctx_hsha.o $(OBJPATH)ctx_idea.o \
$(OBJPATH)ctx_md2.o $(OBJPATH)ctx_md4.o $(OBJPATH)ctx_md5.o \
$(OBJPATH)ctx_misc.o $(OBJPATH)ctx_rc2.o $(OBJPATH)ctx_rc4.o \
$(OBJPATH)ctx_rc5.o $(OBJPATH)ctx_ripe.o $(OBJPATH)ctx_rsa.o \
$(OBJPATH)ctx_sha.o $(OBJPATH)ctx_sha2.o $(OBJPATH)ctx_skip.o
DEVOBJS = $(OBJPATH)fortezza.o $(OBJPATH)pkcs11.o $(OBJPATH)system.o
ENVOBJS = $(OBJPATH)cms_denv.o $(OBJPATH)cms_env.o $(OBJPATH)decode.o \
$(OBJPATH)encode.o $(OBJPATH)pgp_denv.o $(OBJPATH)pgp_env.o \
$(OBJPATH)pgp_misc.o $(OBJPATH)res_denv.o $(OBJPATH)res_env.o
HASHOBJS = $(OBJPATH)md2dgst.o $(OBJPATH)md4dgst.o $(OBJPATH)md5dgst.o \
$(OBJPATH)rmddgst.o $(OBJPATH)sha1dgst.o $(OBJPATH)sha2.o
IOOBJS = $(OBJPATH)cmp_tcp.o $(OBJPATH)dns.o $(OBJPATH)file.o \
$(OBJPATH)http.o $(OBJPATH)memory.o $(OBJPATH)net.o \
$(OBJPATH)stream.o $(OBJPATH)tcp.o
KEYSETOBJS = $(OBJPATH)dbms.o $(OBJPATH)ca_add.o $(OBJPATH)ca_issue.o \
$(OBJPATH)ca_misc.o $(OBJPATH)ca_rev.o $(OBJPATH)dbx_misc.o \
$(OBJPATH)dbx_rd.o $(OBJPATH)dbx_wr.o $(OBJPATH)http_crt.o \
$(OBJPATH)ldap.o $(OBJPATH)odbc.o $(OBJPATH)pgp.o \
$(OBJPATH)pkcs12.o $(OBJPATH)pkcs15.o $(OBJPATH)pkcs15_rd.o \
$(OBJPATH)pkcs15_wr.o
KRNLOBJS = $(OBJPATH)attr_acl.o $(OBJPATH)certm_acl.o $(OBJPATH)init.o \
$(OBJPATH)int_msg.o $(OBJPATH)key_acl.o $(OBJPATH)mech_acl.o \
$(OBJPATH)msg_acl.o $(OBJPATH)obj_acc.o $(OBJPATH)objects.o \
$(OBJPATH)sec_mem.o $(OBJPATH)semaphore.o $(OBJPATH)sendmsg.o
LIBOBJS = $(OBJPATH)cryptapi.o $(OBJPATH)cryptcfg.o $(OBJPATH)cryptcrt.o \
$(OBJPATH)cryptctx.o $(OBJPATH)cryptdev.o $(OBJPATH)cryptenv.o \
$(OBJPATH)cryptkey.o $(OBJPATH)cryptlib.o $(OBJPATH)cryptses.o \
$(OBJPATH)cryptusr.o
MECHOBJS = $(OBJPATH)keyex.o $(OBJPATH)keyex_rw.o $(OBJPATH)mech_drv.o \
$(OBJPATH)mech_enc.o $(OBJPATH)mech_sig.o $(OBJPATH)mech_wrp.o \
$(OBJPATH)obj_qry.o $(OBJPATH)sign.o $(OBJPATH)sign_rw.o
MISCOBJS = $(OBJPATH)asn1_chk.o $(OBJPATH)asn1_rd.o $(OBJPATH)asn1_wr.o \
$(OBJPATH)asn1_ext.o $(OBJPATH)base64.o $(OBJPATH)int_api.o \
$(OBJPATH)java_jni.o $(OBJPATH)misc_rw.o $(OBJPATH)os_spec.o \
$(OBJPATH)random.o $(OBJPATH)unix.o
SESSOBJS = $(OBJPATH)certstore.o $(OBJPATH)cmp.o $(OBJPATH)cmp_rd.o \
$(OBJPATH)cmp_wr.o $(OBJPATH)ocsp.o $(OBJPATH)pnppki.o \
$(OBJPATH)rtcs.o $(OBJPATH)scep.o $(OBJPATH)sess_rw.o \
$(OBJPATH)session.o $(OBJPATH)ssh.o $(OBJPATH)ssh1.o \
$(OBJPATH)ssh2.o $(OBJPATH)ssh2_chn.o $(OBJPATH)ssh2_cli.o \
$(OBJPATH)ssh2_cry.o $(OBJPATH)ssh2_msg.o $(OBJPATH)ssh2_rw.o \
$(OBJPATH)ssh2_svr.o $(OBJPATH)ssl.o $(OBJPATH)ssl_cli.o \
$(OBJPATH)ssl_cry.o $(OBJPATH)ssl_rw.o $(OBJPATH)ssl_svr.o \
$(OBJPATH)tsp.o
ZLIBOBJS = $(OBJPATH)adler32.o $(OBJPATH)deflate.o $(OBJPATH)inffast.o \
$(OBJPATH)inflate.o $(OBJPATH)inftrees.o $(OBJPATH)trees.o \
$(OBJPATH)zutil.o
OBJS = $(BNOBJS) $(CERTOBJS) $(CRYPTOBJS) $(CTXOBJS) $(DEVOBJS) \
$(ENVOBJS) $(HASHOBJS) $(IOOBJS) $(KEYSETOBJS) $(KRNLOBJS) \
$(LIBOBJS) $(MECHOBJS) $(MISCOBJS) $(SESSOBJS) $(ZLIBOBJS) \
$(OSOBJS)
# Object files for the self-test code
TESTOBJS = certs.o devices.o envelope.o highlvl.o keydbx.o keyfile.o \
keyload.o lowlvl.o scert.o sreqresp.o ssh.o ssl.o stress.o \
testlib.o utils.o
# Various functions all make use of certain headers so we define the
# dependencies once here
IO_DEP = io/stream.h misc/misc_rw.h
ASN1_DEP = $(IO_DEP) misc/asn1.h misc/asn1_ext.h misc/ber.h
CRYPT_DEP = cryptlib.h crypt.h cryptkrn.h misc/config.h misc/consts.h \
misc/int_api.h misc/os_spec.h
KERNEL_DEP = kernel/acl.h kernel/kernel.h kernel/thread.h
ZLIB_DEP = zlib/zconf.h zlib/zlib.h zlib/zutil.h
#****************************************************************************
#* *
#* Default and High-level Targets *
#* *
#****************************************************************************
# Find the system type and use a conditional make depending on that and the
# endianness, which is piped in from the endianness-detection program (who
# needs autoconf in order to be ugly?).
#
# Slowaris doesn't ship with a compiler by default, so Sun had to provide
# something that pretends to be one for things that look for a cc. This
# makes it really hard to figure out what's really going on. The default cc,
# /usr/ucb/cc, is a script that looks for a real compiler elsewhere. If the
# Sun compiler is installed, this will be via a link /usr/ccs/bin/ucbcc,
# which in turn points to /opt/SUNWspro. If it's not installed, or installed
# incorrectly, it will bail out with a "package not installed" error. We
# check for this bogus compiler and if we get the error message fall back to
# gcc, which is how most people just fix this mess.
#
# Aches has a broken uname, which reports the OS minor version with uname -r
# instead of the major version. The alternative command oslevel reports the
# full version number, which we can extract in the standard manner.
# Similarly, QNX uses -v instead of -r for the version, and also has a broken
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -