📄 makefile
字号:
#****************************************************************************
#* *
#* Makefile for cryptlib 3.1 *
#* Copyright Peter Gutmann 1995-2003 *
#* *
#****************************************************************************
# 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).
#
# 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 = 1
PLV = 0
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 "size of' 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.
#
# 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
# 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.
#
# 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.
# Symbian OS: Usually handled via cross-compilation, which requires custom
# code paths to build using the Symbian SDK rather than the native compiler.
# The following defines are for Symbian OS 7.x as the SDK and ARM as the
# architecture.
# EPOC = /usr/local/symbian/7.0
# CXX = ${EPOC}/bin/arm-epoc-pe-g++
# CC = ${EPOC}/bin/arm-epoc-pe-gcc
# AR = ${EPOC}/bin/arm-epoc-pe-ar
# LD = ${EPOC}/bin/arm-epoc-pe-ld
# CPP = ${EPOC}/bin/arm-epoc-pe-cpp
# RANLIB = ${EPOC}/bin/arm-epoc-pe-ranlib
# STRIP = ${EPOC}/bin/arm-epoc-pe-strip
# INCS = -I$(EPOC)/include/libc
# 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 = -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.
#
# The options for the shared library link should work on most systems that
# handle shared libraries, but may need to be tuned for some systems since
# there's no standard for shared libraries, and different versions of gcc
# also changed the way this was handled. If the current line doesn't work,
# try one of the following ones:
#
# AIX: AIX requires some weird voodoo which is unlike any other
# system's way of doing it (probably done by the MVS team,
# see "AIX Linking and Loading Mechanisms" for a starter).
# In addition to this, the shared lib (during development)
# must be given permissions 750 to avoid loading it
# permanently into the shared memory segment (only root can
# remove it). The production shared library must have a
# 555 (or whatever) permission. The various options are:
# -bnoentry = don't look for a main(), -bE = export the symbols
# in cryptlib.exp, -bM:SRE = make it a shared library.
# $(LD) -ldl -bE:cryptlib.exp -bM:SRE -bnoentry
# BeOS: $(LD) -nostart
# *BSD's: $(LD) -Bshareable -o lib$(PROJ).so.$(MAJ)
# Cygwin: $(LD) -L/usr/local/lib -lcygipc
# HPUX: $(LD) -shared -Wl,-soname,lib$(PROJ).so.$(MAJ)
# IRIX, OSF/1: $(LD) -shared -o lib$(PROJ).so.$(MAJ)
# Linux: $(LD) -Bshareable -ldl -o lib$(PROJ).so.$(MAJ)
# Solaris: $(LD) -G -ldl -o lib$(PROJ).so.$(MAJ)
STATIC_OBJ_PATH = ./static-obj/
STATIC_OBJ_DIR = ./static-obj
SHARED_OBJ_PATH = ./shared-obj/
SHARED_OBJ_DIR = ./shared-obj
CPP = $(CC) -E
LD = $(CC) # Static link
SLD = $(LD) -shared # Shared link
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)
#****************************************************************************
#* *
#* Common Dependencies *
#* *
#****************************************************************************
# The object files that make up the library. When building the Java version,
# $(OBJPATH)cryptjni.o should be added to the OBJS line to replace the
# cryptapi.o used to provide the C interface.
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)certcget.o $(OBJPATH)certchk.o $(OBJPATH)certchn.o \
$(OBJPATH)certcset.o $(OBJPATH)certdn.o $(OBJPATH)certechk.o \
$(OBJPATH)certedef.o $(OBJPATH)certexrd.o $(OBJPATH)certext.o \
$(OBJPATH)certexwr.o $(OBJPATH)certio.o $(OBJPATH)certrd.o \
$(OBJPATH)certrev.o $(OBJPATH)certsig.o $(OBJPATH)certstr.o \
$(OBJPATH)certrust.o $(OBJPATH)certval.o $(OBJPATH)certwr.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
DEVOBJS = $(OBJPATH)dev_fort.o $(OBJPATH)dev_pk11.o $(OBJPATH)dev_sys.o
ENVOBJS = $(OBJPATH)denv_cms.o $(OBJPATH)denv_pgp.o $(OBJPATH)env_cms.o \
$(OBJPATH)env_dec.o $(OBJPATH)env_enc.o $(OBJPATH)env_pgp.o \
$(OBJPATH)pgp_misc.o $(OBJPATH)resource.o
HASHOBJS = $(OBJPATH)md2dgst.o $(OBJPATH)md4dgst.o $(OBJPATH)md5dgst.o \
$(OBJPATH)rmddgst.o $(OBJPATH)sha1dgst.o
KEYSETOBJS = $(OBJPATH)dbxdbms.o $(OBJPATH)dbxdbx.o $(OBJPATH)dbxdca.o \
$(OBJPATH)dbxhttp.o $(OBJPATH)dbxldap.o $(OBJPATH)dbxmysql.o \
$(OBJPATH)dbxoracl.o $(OBJPATH)dbxpgp.o $(OBJPATH)dbxp12.o \
$(OBJPATH)dbxp15.o $(OBJPATH)dbxp15r.o $(OBJPATH)dbxp15w.o \
$(OBJPATH)dbxpostg.o
LIBOBJS = $(OBJPATH)cryptapi.o $(OBJPATH)cryptcfg.o $(OBJPATH)cryptcrt.o \
$(OBJPATH)cryptctx.o $(OBJPATH)cryptdbx.o $(OBJPATH)cryptdev.o \
$(OBJPATH)cryptenv.o $(OBJPATH)cryptkey.o $(OBJPATH)cryptkrn.o \
$(OBJPATH)cryptlib.o $(OBJPATH)cryptmch.o $(OBJPATH)cryptmis.o \
$(OBJPATH)cryptses.o $(OBJPATH)cryptusr.o $(OBJPATH)lib_3des.o \
$(OBJPATH)lib_aes.o $(OBJPATH)lib_bf.o $(OBJPATH)lib_cast.o \
$(OBJPATH)lib_des.o $(OBJPATH)lib_dh.o $(OBJPATH)lib_dsa.o \
$(OBJPATH)lib_elg.o $(OBJPATH)lib_hmd5.o $(OBJPATH)lib_hrmd.o \
$(OBJPATH)lib_hsha.o $(OBJPATH)lib_idea.o $(OBJPATH)lib_kg.o \
$(OBJPATH)lib_md2.o $(OBJPATH)lib_md4.o $(OBJPATH)lib_md5.o \
$(OBJPATH)lib_rc2.o $(OBJPATH)lib_rc4.o $(OBJPATH)lib_rc5.o \
$(OBJPATH)lib_ripe.o $(OBJPATH)lib_rsa.o $(OBJPATH)lib_sha.o \
$(OBJPATH)lib_skip.o
MISCOBJS = $(OBJPATH)asn1_rw.o $(OBJPATH)asn1s_rw.o $(OBJPATH)key_rw.o \
$(OBJPATH)keyex.o $(OBJPATH)keyex_rw.o $(OBJPATH)misc_rw.o \
$(OBJPATH)net_cmp.o $(OBJPATH)net_http.o $(OBJPATH)net_tcp.o \
$(OBJPATH)rndunix.o $(OBJPATH)sign.o $(OBJPATH)sign_rw.o \
$(OBJPATH)str_file.o $(OBJPATH)str_mem.o $(OBJPATH)str_net.o \
$(OBJPATH)stream.o
SESSOBJS = $(OBJPATH)cmp.o $(OBJPATH)cmp_rd.o $(OBJPATH)cmp_wr.o \
$(OBJPATH)ocsp.o $(OBJPATH)pnppki.o $(OBJPATH)rtcs.o \
$(OBJPATH)scep.o $(OBJPATH)ssh.o $(OBJPATH)ssh1.o \
$(OBJPATH)ssh2.o $(OBJPATH)ssh2_cli.o $(OBJPATH)ssh2_svr.o \
$(OBJPATH)ssl.o $(OBJPATH)ssl_cli.o $(OBJPATH)ssl_svr.o \
$(OBJPATH)tsp.o
ZLIBOBJS = $(OBJPATH)adler32.o $(OBJPATH)deflate.o $(OBJPATH)infblock.o \
$(OBJPATH)infcodes.o $(OBJPATH)inffast.o $(OBJPATH)inflate.o \
$(OBJPATH)inftrees.o $(OBJPATH)infutil.o $(OBJPATH)trees.o \
$(OBJPATH)zutil.o
OBJS = $(BNOBJS) $(CERTOBJS) $(CRYPTOBJS) $(DEVOBJS) $(ENVOBJS) \
$(HASHOBJS) $(KEYSETOBJS) $(LIBOBJS) $(MISCOBJS) $(SESSOBJS) \
$(ZLIBOBJS) $(OSOBJS)
# Object files for the self-test code
TESTOBJS = certutil.o testcert.o testdev.o testenv.o testhl.o testkeyd.o \
testkeyf.o testll.o testscrt.o testsess.o testsreq.o testlib.o
# Various functions all make use of certain headers so we define the
# dependencies once here
ASN1_DEP = misc/asn1_rw.h misc/asn1s_rw.h misc/ber.h misc/stream.h
CRYPT_DEP = cryptlib.h cryptini.h crypt.h cryptos.h cryptkrn.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?).
#
# The unnecessary deletion of the '.' by the tr command is to work around a
# problem in the SunOS uname -r, which returns a number with no OS name so
# that tr can't find any alphabetics to delete.
#
# 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. Since
# many people fix this by just installing gcc, we fall back to explicitly
# invoking that if there's no trace of a Sun compiler, meaning that
# /usr/ucb/cc exists but the link at /usr/ccs/bin/ucbcc doesn't.
#
# 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.
#
# The MVS USS c89 compiler has a strict ordering of options. That ordering
# can be relaxed with the _C89_CCMODE environment variable to accept options
# and file names in any order, so we check to make sure that this is set.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -