📄 makefile
字号:
#****************************************************************************
# The test code
utils.o: cryptlib.h crypt.h test/test.h test/utils.c
$(CC) $(CFLAGS) test/utils.c
certimp.o: cryptlib.h crypt.h test/test.h test/certimp.c
$(CC) $(CFLAGS) test/certimp.c
certproc.o: cryptlib.h crypt.h test/test.h test/certproc.c
$(CC) $(CFLAGS) test/certproc.c
certs.o: cryptlib.h crypt.h test/test.h test/certs.c
$(CC) $(CFLAGS) test/certs.c
devices.o: cryptlib.h crypt.h test/test.h test/devices.c
$(CC) $(CFLAGS) test/devices.c
envelope.o: cryptlib.h crypt.h test/test.h test/envelope.c
$(CC) $(CFLAGS) test/envelope.c
highlvl.o: cryptlib.h crypt.h test/test.h test/highlvl.c
$(CC) $(CFLAGS) test/highlvl.c
keydbx.o: cryptlib.h crypt.h test/test.h test/keydbx.c
$(CC) $(CFLAGS) test/keydbx.c
keyfile.o: cryptlib.h crypt.h test/test.h test/keyfile.c
$(CC) $(CFLAGS) test/keyfile.c
loadkey.o: cryptlib.h crypt.h test/test.h test/loadkey.c
$(CC) $(CFLAGS) test/loadkey.c
lowlvl.o: cryptlib.h crypt.h test/test.h test/lowlvl.c
$(CC) $(CFLAGS) test/lowlvl.c
s_cmp.o: cryptlib.h crypt.h test/test.h test/s_cmp.c
$(CC) $(CFLAGS) test/s_cmp.c
s_scep.o: cryptlib.h crypt.h test/test.h test/s_scep.c
$(CC) $(CFLAGS) test/s_scep.c
sreqresp.o: cryptlib.h crypt.h test/test.h test/sreqresp.c
$(CC) $(CFLAGS) test/sreqresp.c
ssh.o: cryptlib.h crypt.h test/test.h test/ssh.c
$(CC) $(CFLAGS) test/ssh.c
ssl.o: cryptlib.h crypt.h test/test.h test/ssl.c
$(CC) $(CFLAGS) test/ssl.c
stress.o: cryptlib.h crypt.h test/test.h test/stress.c
$(CC) $(CFLAGS) test/stress.c
testlib.o: cryptlib.h crypt.h test/test.h test/testlib.c
$(CC) $(CFLAGS) test/testlib.c
#****************************************************************************
#* *
#* Link Targets *
#* *
#****************************************************************************
# Create the static and shared libraries. The main test program is also
# listed as a dependency since we need to use OS-specific compiler options
# for it that a simple 'make testlib' won't give us (the test program checks
# whether the compiler options were set correctly when building the library,
# so it needs to include a few library-specific files that wouldn't be used
# in a normal program).
#
# When cross-compiling, we have to use the hosted tools and libraries rather
# than the system tools and libraries for the build, so we special-case this
# step based on the $(OSNAME) setting supplied to the build script.
$(LIBNAME): $(OBJS) $(EXTRAOBJS) $(TESTOBJS)
@./tools/buildlib.sh $(OSNAME) $(LIBNAME) $(OBJS) $(EXTRAOBJS)
$(SLIBNAME): $(OBJS) $(EXTRAOBJS) $(TESTOBJS)
@./tools/buildsharedlib.sh $(OSNAME) $(SLIBNAME) $(LD) $(OBJS) \
$(EXTRAOBJS)
$(DYLIBNAME): $(OBJS) $(EXTRAOBJS) $(TESTOBJS)
@$(LD) -dynamiclib -compatibility_version $(MAJ).$(MIN) \
-current_version $(MAJ).$(MIN).$(PLV) \
-o $(DYLIBNAME) $(OBJS) $(EXTRAOBJS)
# If installing cryptlib as a systemwide lib, run ldconfig (which normally
# reads /etc/ld.so.conf, sets up the appropriate symbolic links in the
# shared lib directory, and writes a cache file /etc/ld.so.cache for use by
# other programs). The loader the consults /etc/ld.so.cache to find the
# libraries it needs. This is why ldconfig has to be run when a new lib is
# added or removed.
#
# ldconfig -n <cryptlib .so directory path>
#
# A temporary workaround for testing is to set LD_LIBRARY_PATH to the
# directory containing the cryptlib shared lib. This (colon-separated) list
# of directories is searched before the standard library directories. This
# may have system-specific variations, e.g. under PHUX it's called
# SHLIB_PATH and under Aches it's LIBPATH. BeOS uses LIBRARY_PATH, and
# needs to have it pointed to . to find the shared lib, otherwise it fails
# with a "Missing library" error without indicating which library is missing.## To run stestlib with a one-off lib path change, use either the universal:
#
# env LD_LIBRARY_PATH=. ./testlib
#
# or the shell-specific (csh):
#
# setenv LD_LIBRARY_PATH .:$LD_LIBRARY_PATH
# ./testlib
#
# or (sh):
#
# LD_LIBRARY_PATH=. ; export LD_LIBRARY_PATH
# ./testlib
#
# Finally, ldd <filename> will print out shared lib dependencies.
#
# We don't give the library as a dependency since the user has to make this
# explicitly rather than implicitly via testlib in order to go via the
# auto-config mechanism. Since OS X uses special dylibs instead of normal
# shared libs, we detect this and build the appropriate lib type.
#
# To test the code with extended malloc diagnostics on systems with
# phkmalloc, use:
#
# env MALLOC_OPTIONS="AJVX" ./testlib
testlib: $(TESTOBJS)
@rm -f $(LINKFILE)
@echo $(TESTOBJS) > $(LINKFILE)
@if [ $(OSNAME) = 'SunOS' ] ; then \
if [ `/usr/ucb/cc 2>&1 | grep -c installed` = '1' ] ; then \
gcc -o testlib $(LDFLAGS) `cat $(LINKFILE)` -L. -l$(PROJ) \
`./tools/getlibs.sh autodetect` ; \
else \
$(LD) -o testlib $(LDFLAGS) `cat $(LINKFILE)` -L. -l$(PROJ) \
`./tools/getlibs.sh autodetect` ; \
fi ; \
elif [ $(OSNAME) = 'HP-UX' ] ; then \
if gcc -v > /dev/null 2>&1 ; then \
gcc -o testlib $(LDFLAGS) `cat $(LINKFILE)` -L. -l$(PROJ) \
`./tools/getlibs.sh autodetect` ; \
else \
$(LD) -o testlib $(LDFLAGS) `cat $(LINKFILE)` -L. -l$(PROJ) \
`./tools/getlibs.sh autodetect` ; \
fi ; \
else \
$(LD) -o testlib $(LDFLAGS) `cat $(LINKFILE)` -L. -l$(PROJ) \
`./tools/getlibs.sh autodetect` ; \
fi
@rm -f $(LINKFILE)
stestlib: $(TESTOBJS)
@rm -f $(LINKFILE)
@echo $(TESTOBJS) > $(LINKFILE)
@if [ $(OSNAME) = 'AIX' ] ; then \
$(LD) -o testlib $(LDFLAGS) `cat $(LINKFILE)` -L. $(SLIBNAME).a \
`./tools/getlibs.sh AIX` ; \
elif [ $(OSNAME) = 'Darwin' ] ; then \
$(LD) -o testlib $(LDFLAGS) `cat $(LINKFILE)` -L. $(DYLIBNAME) \
`./tools/getlibs.sh Darwin` ; \
elif [ $(OSNAME) = 'HP-UX' ] ; then \
$(LD) -o testlib $(LDFLAGS) `cat $(LINKFILE)` -L. lib$(PROJ).sl \
`./tools/getlibs.sh HP-UX` ; \
else \
$(LD) -o testlib $(LDFLAGS) `cat $(LINKFILE)` -L. $(SLIBNAME) \
`./tools/getlibs.sh autodetect` ; \
fi
@rm -f $(LINKFILE)
#****************************************************************************
#* *
#* Unix OS Targets *
#* *
#****************************************************************************
# Aches: A vaguely Unix-compatible OS designed by IBM. The maxmem option
# is to give the optimizer more headroom, it's not really needed
# but avoids millions of informational messages telling you to
# increase it from the default 2048. The roconst puts const data
# into read-only memory (this may happen anyway on some versions of
# the compiler).
AIX:
@./tools/buildasm.sh $(AS) $(OBJPATH)
@if [ $(CC) = "gcc" ] ; then \
make $(DEFINES) CFLAGS=3D"$(CFLAGS) -O3 -D_REENTRANT" ; \
else \
make $(DEFINES) CFLAGS="$(CFLAGS) -O2 -qmaxmem=-1 -qroconst -D_REENTRANT" ; \
fi
# Apollo: Yeah, this makefile has been around for awhile. Why do you ask?
Apollo:
@make $(DEFINES) CFLAGS="$(CFLAGS) -O4"
# AUX: su root; rm -rf /; echo "Now install MkLinux"
A/UX:
@make $(DEFINES) CFLAGS="$(CFLAGS) -O4"
# Millions of Intel BSD's (many are really BSE's, with incredibly archaic
# development tools and libs, although it's slowly getting better):
# cc is gcc except when it isn't. Most are still using a.out,
# although some are slowly going to ELF, which we can autodetect by
# checking whether the compiler defines __ELF__. If the compiler
# check doesn't work then [ `uname -r | cut -f 1 -d '.'` -ge 4 ]
# (for FreeBSD) and -ge 2 (for OpenBSD) should usually work.
#
# NetBSD for many years (up until around 1999-2000) used an
# incredibly old version of as that didn't handle 486 opcodes (!!),
# so the asm code was disabled by default. In addition it used an
# equally archaic version of gcc, requiring manual fiddling with
# the compiler type and options. If you're still using one of
# these ancient versions, you'll have to change the entry below to
# handle it. In addition the rule is currently hardwired to assume
# x86 due to lack of access to a non-x86 box, if you're building on
# a different architecture you'll have to change the entry slightly
# to detect x86 vs. whatever you're currently using, see the Linux
# entry for an example.
#
# For the newer BSDs, the optimisation level is set via the
# ccopts.sh script.
BSD386:
@./tools/buildasm.sh $(AS) $(OBJPATH)
@make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) -DUSE_ASM \
-fomit-frame-pointer -O3"
iBSD:
@./tools/buildasm.sh $(AS) $(OBJPATH)
@make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) -DUSE_ASM \
-fomit-frame-pointer -O3"
BSD/OS:
@./tools/buildasm.sh $(AS) $(OBJPATH)
@make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) -DUSE_ASM \
-fomit-frame-pointer -O3"
FreeBSD:
@if uname -m | grep "i[3,4,5,6]86" > /dev/null; then \
./tools/buildasm.sh $(AS) $(OBJPATH) ; \
make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) -DUSE_ASM \
-fomit-frame-pointer -pthread" ; \
else \
make $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer -pthread" ; \
fi
NetBSD:
@if uname -m | grep "i[3,4,5,6]86" > /dev/null; then \
./tools/buildasm.sh $(AS) $(OBJPATH) ; \
make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) -DUSE_ASM \
-fomit-frame-pointer -pthread" ; \
else \
make $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer -pthread" ; \
fi
OpenBSD:
@if uname -m | grep "i[3,4,5,6]86" > /dev/null; then \
./tools/buildasm.sh $(AS) $(OBJPATH) ; \
make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) -DUSE_ASM \
-fomit-frame-pointer" ; \
else \
make $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer" ; \
fi
# Convex:
Convex:
@make $(DEFINES) CFLAGS="$(CFLAGS) -O4"
# Cray Unicos: The Cray compiler complains about char * vs. unsigned char
# passed to functions, there's no way to disable this directly
# so the best that we can do is disable warnings:
# cc-256 Function call argument or assignment has incompatible type
# cc-265 Function call argument has incompatible type
CRAY:
@make $(DEFINES) CFLAGS="$(CFLAGS) -h nomessage=256:265 -O2"
# Cygwin: cc is gcc.
CYGWIN_NT-5.0:
@./tools/buildasm.sh $(AS) $(OBJPATH)
@make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) -DUSE_ASM \
-fomit-frame-pointer -O3 -D__CYGWIN__ -I/usr/local/include"
CYGWIN_NT-5.1:
@./tools/buildasm.sh $(AS) $(OBJPATH)
@make $(DEFINES) EXTRAOBJS="$(ASMOBJS)" CFLAGS="$(CFLAGS) -DUSE_ASM \
-fomit-frame-pointer -O3 -D__CYGWIN__ -I/usr/local/include"
# DGUX: cc is a modified gcc.
dgux:
@make $(DEFINES) CFLAGS="$(CFLAGS) -ansi -fomit-frame-pointer -O3"
# PHUX: A SYSVR2 layer with a SYSVR3 glaze on top of an adapted BSD 4.2
# kernel. Use cc, the exact incantation varies somewhat depending on
# which version of PHUX you're running. For 9.x you need to use
# '-Aa -D_HPUX_SOURCE' to get the
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -