📄 makefile
字号:
# 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): cc is gcc except when
# it isn't.
BSD386:
@make asm_targets ASMFLAGS=BSDI
@make $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3 -DASM_X86"
iBSD:
@make asm_targets ASMFLAGS=BSDI
@make $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3 -DASM_X86"
BSD/OS:
@echo "The most common version of this OS uses an incredibly old version of as"
@echo "which doesn't handle 486 opcodes, so the asm code is disabled by default."
@echo "If you've upgraded to a newer as, uncomment the 'make asm_targets' line"
@echo "in the BSD/OS section of the makefile to use the much faster asm code."
@echo "You may also need to play with the compiler type, since the default is an "
@echo "equally archaic version of gcc."
# @make asm_targets CPP="gcc -E" ASMFLAGS=BSDI
@make $(DEFINES) CC=gcc CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3 -DASM_X86"
FreeBSD:
@echo "The most common version of this OS uses an incredibly old version of as"
@echo "which doesn't handle 486 opcodes, so the asm code is disabled by default."
@echo "If you've upgraded to a newer as, uncomment the 'make asm_targets' line"
@echo "in the FreeBSD section of the makefile to use the much faster asm code."
# @make asm_targets CPP="gcc -E" ASMFLAGS=BSDI
@make $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3 -DASM_X86"
OpenBSD:
@make $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3"
# Convex:
Convex:
@make $(DEFINES) CFLAGS="$(CFLAGS) -O4"
# 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 compiler into ANSI mode, in 10.x this
# changed to just '-Ae', and after 10.30 -Ae was the default mode.
# With PA-RISC 2 you should probably also define +DD64 to compile in
# 64-bit mode under PHUX 11.x, under even newer versions this becomes
# +DA2.0w (note that building 64-bit versions of anything will probably
# cause various build problems arising from the compiler and linker
# because although the CPU may be 64 bit the software development tools
# really, really want to give you 32-bit versions of everything and it
# takes quite some cajoling to actually get them to spit out a 64-bit
# result). In addition the PHUX compilers don't recognise -On like the
# rest of the universe but use +On instead so if you're using gcc
# instead of cc/c89 you'll need to change things to use the standard gcc
# options.
#
# Newer compilers can use +Oall to apply all optimisations (even the
# dodgy ones). Typically going from +O2 -> +O3 -> +O4 gives a ~10-15%
# improvement at each step. Finally, when making the shared lib you
# can only use +O2, not +O3, because it gives the compiler the speed
# wobbles. In theory we could also use +ESlit to force const data
# into a read-only segment, but this is defeated by a compiler bug
# which doesn't initialise non-explicitly-initialised struct elements
# to zero any more when this option is enabled (this is a double-bug
# which violates two C rules because if there are insufficient
# initialisers the remaining elements should be set to zero, and for
# static objects they should be set to zero even if there are no
# initialisers).
#
# Note that the PHUX compilers (especially the earlier ones) are
# horribly broken and will produce all sorts of of bogus warnings of
# non-problems, eg:
#
# /usr/ccs/bin/ld: (Warning) Quadrant change in relocatable
# expression in subspace $CODE$
#
# (translation: Klingons off the starboard bow!). The code contains
# workarounds for non-errors (for example applying a cast to anything
# magically turns it into an rvalue), but it's not worth fixing the
# warnings for an OS as broken as this.
#
# This PHUX compiler bugs comment is really starting to give the SCO
# one a run for its money.
HP-UX:
# @make asm_phux
@if [ `uname -r | tr -d '[A-Z].' | cut -c 2` = '11' ] ; \
then \
make $(DEFINES) CFLAGS="$(CFLAGS) +O3 -D_REENTRANT" ; \
elif [ `uname -r | tr -d '[A-Z].' | cut -c 2` = '10' ] ; \
then \
make $(DEFINES) CFLAGS="$(CFLAGS) -Ae +O3" ; \
else \
make $(DEFINES) CFLAGS="$(CFLAGS) -Aa -D_HPUX_SOURCE +O3" ; \
fi
# Irix: There's some sort of problem with r3000.s which means that
# bn_mul_words never appears in the .o (the PHUX code above has the
# same problem), for now we disable its use and use the (somewhat
# slower) bn_mulw.c. If someone can figure out the problem it'll
# allow the slightly faster asm code to be used.
IRIX:
# @make asm_mips
@make $(DEFINES) CFLAGS="$(CFLAGS) -O3"
IRIX64:
# @make asm_mips
@make $(DEFINES) CFLAGS="$(CFLAGS) -O3"
# ISC Unix: Use gcc
ISC:
@make asm_targets ASMFLAGS=OUT
@make $(DEFINES) CC=gcc CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3 -DASM_X86"
# Linux: cc is gcc. The 1e-5 users with rather old versions of Linux will
# need to make the asm targets with ASMFLAGS=OUT to build the a.out
# version of the asm core routines.
Linux:
@if uname -m | grep "i[3,4,5,6]86" > /dev/null; \
then \
$(MAKE) asm_targets ASMFLAGS=ELF; \
$(MAKE) $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3 -DASM_X86 -D_REENTRANT"; \
else \
$(MAKE) $(DEFINES) CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3 -D_REENTRANT"; \
fi
# MiNT: Use gcc
MiNT:
@make $(DEFINES) CC=gcc CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3"
# NeXT 3.0:
NeXT:
@make $(DEFINES) LDFLAGS="-object -s"
# OSF 1: Use gcc and the asm version of the bn routines. If you're using
# the OSF1 cc you need to use "-std1" to force ANSI compliance and
# change the optimization CFLAGS. For gcc we need to specify
# -fno-asm since pthread.h includes c_asm.h which contains a
# declaration
#
# long asm( const char *,...);
#
# which conflicts with the gcc asm keyword. This asm stuff is only
# used when inline asm alternatives to the Posix threading functions
# are enabled which isn't done by default so in theory we could also
# fix this by defining asm to something else before including pthread.h,
# but it's safer to just turn off asm in gcc since it's not used
# anywhere.
#
# The use of gcc on an Alpha is somewhat problematic since some
# versions of gcc do weird things with data alignment which may end up
# generating non-aligned access traps, the -m21164 turns on 21164-
# specific code generation which does the right thing for newer CPUs.
# At a pinch it's also possible to use -fno-strict-aliasing, but that
# just plasters over the problem.
OSF1:
@make asm_alpha
@make $(DEFINES) CC=gcc CFLAGS="$(CFLAGS) -fomit-frame-pointer -fno-asm -mcpu=21164a -O3 -D_REENTRANT"
# QNX 4.x:
QNX:
@make asm_targets ASMFLAGS=ELF
@make $(DEFINES) CFLAGS="$(CFLAGS) -O4 -DASM_X86"
# SCO: Unlike the entire rest of the world, SCO doesn't use -On, although it
# does recognise -O3 to mean "turn off pass 3 optimization". The SCO cc
# is in fact a mutant version of Microsoft C 6.0, so we use the usual
# MSC optimization options except for the unsafe ones. -Olx is
# equivalent to -Oegilt. Unless SCO rewrote half the compiler when
# noone was looking, you won't be getting much optimization for your -O.
#
# Actually it turns out that the only thing you get with -Olx is
# compiler bugs, so we only use -O, and even with that you get internal
# compiler faults which it traps and forces a compiler restart on,
# presumably with optimisations disabled.
#
# SCO is basically too braindamaged to support any of the asm builds.
# as won't take input from stdin and dumps core on the crypto .S files,
# and cc/as barf on bni80386.s. Even compiling the straight C code
# gives a whole slew of internal compiler errors/failed assertions. If
# you have a setup which works (ie with GNU tools installed) then you
# can add the following to build the library.
#
# @make asm_targets ASMFLAGS=ELF
#
# For another taste of the wonderful SCO compiler, take the trivial lex
# example from the dragon book, lex it, and compile it. Either the
# compiler will core dump from a SIGSEGV or the resulting program will
# from a SIGILL, depending on what level of optimization you use (a
# compiler that'll produce illegal code as output is pretty impressive).
#
# In addition the SCO cc ignores the path for output files and dumps the
# whole mess in the same directory as the source files. This means you
# need to set STATIC_OBJ_PATH = . in order for the library to be built,
# however the following rule does this for you by forwarding down the
# $(TARGET) define rather than $(DEFINES) which also includes the output
# path.
#
# If you're building the shared version after building the static one
# you need to manually remove all the object files before trying to
# build it, although it's extremely unlikely that SCO can handle this
# anyway so it's probably not worth bothering with.
#
# The SCO/UnixWare sockets libraries are extraordinarily buggy, make
# sure you've got the latest patches installed if you plan to use
# cryptlib's secure session interface. Note that some bugs reappear in
# later patches, so you should make sure you really do have the very
# latest patch installed ("SCO - Where Quality is Job #9" - unofficial
# company motto following a SCO employee survey).
#
# In terms of straight compiling of code, UnixWare (SCO 7.x) is only
# marginally better. as now finally accepts input from stdin if '-' is
# specified as a command-line arg, but it doesn't recognise 486
# instructions yet (they've only been with us for over a decade for
# crying out loud), even using the BSDI-format kludge doesn't quite
# work since as just terminates with an internal error.
#
# UnixWare also finally supports threads, but it's not possible to build
# cryptlib with threading support because of a compiler bug in which the
# preprocessor sprays random spaces around any code in which token-
# pasting is used. Although having foo##->mutex turn into
# "certInfo -> mutex" is OK, foo##.mutex turns into "certInfo. mutex"
# which the compiler chokes on (the appearances of spaces in different
# places doesn't seem to follow any pattern, the quoted strings above
# are exactly as output by the preprocessor).
#
# To avoid this mess, you can build the code using the SCO-modified gcc
# which has been hacked to work with cc-produced libraries. In that
# case you should build with -pthread -D__SCO_VERSION__ -D_REENTRANT
# instead of -Kthread.
#
# Cool, the SCO comment is now longer than the comments for all the
# other Unix variants put together.
SCO:
@echo "Please read the entry for SCO in the makefile before continuing."
@make $(TARGET) CFLAGS="$(CFLAGS) -O"
UnixWare:
@echo "Please read the entry for UnixWare in the makefile before continuing."
@make $(DEFINES) CFLAGS="$(CFLAGS) -O"
itgoaway:
@echo "You poor bastard."
@make $(DEFINES) CFLAGS="$(CFLAGS) -O"
# Sun/Slowaris: Use gcc, but fall back to the SUNSwspro compiler if necessary
# (in the checks below, the '-' is necessary because one of the
# checks returns a nonzero status somewhere which causes make
# to bail out, and the error suppression is necessary to avoid
# dozens of bogus warnings about signed vs unsigned chars).
#
# If you're running Slowaris on an x86 box, you should also
# make the various asm_xxx targets (see one of the x86-derived
# targets for how to do this).
SunOS:
@if [ `uname -m` = 'i86pc' ] ; \
then \
echo "To enable use of the x86 asm code please edit the Solaris makefile entry." ; \
else \
make asm_sparc ; \
fi
@- if [ `uname -r | tr -d '[A-Z].' | cut -c 1` = '5' ] ; \
then \
if [ `which $(CC) | grep -c ucb` = '1' ] ; then \
echo "Your default compiler is set to ucbcc which isn't a C compiler, you need to\neither point the makefile to the SUNWspro compiler or install gcc." ; \
elif [ `which gcc | grep -c "no gcc"` = '1' ] ; then \
make $(DEFINES) CFLAGS="$(CFLAGS) -erroff=E_ARG_INCOMPATIBLE_WITH_ARG -xO3 -D_REENTRANT" ; \
else \
make $(DEFINES) CC=gcc CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3 -D_REENTRANT" ; \
fi ; \
else \
make $(DEFINES) CC=gcc CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3" ; \
fi
# SVR4: Better results can be obtained by upgrading your OS to 4.4 BSD.
# A few SVR4 unames don't report the OS name properly (Olivetti Unix)
# so it's necessary to specify the SVR4 target on the command line.
SVR4:
@make $(DEFINES) CFLAGS="$(CFLAGS) -O3"
# Ultrix: Use vcc or gcc
ULTRIX:
@make asm_mips
@make $(DEFINES) CC=gcc CFLAGS="$(CFLAGS) -fomit-frame-pointer -O3"
# Amdahl UTS 4:
UTS4:
@make $(DEFINES) CFLAGS="$(CFLAGS) -Xc -O4"
#****************************************************************************
#* *
#* Defines for other OS's *
#* *
#****************************************************************************
BeOS:
@make $(DEFINES) CC=mwcc AR="mwcc -xml -o" SLD="mwcc -xms -f crypt.exp"
#****************************************************************************
#* *
#* Clean up after make has finished *
#* *
#****************************************************************************
# The removal of the object file directories is silenced since the
# directories may not exist and we don't want unnecessary error messages
# arising from trying to remove them
clean:
rm -f *.o core testlib stestlib endian $(LIBNAME) $(SLIBNAME)
@rm -f $(STATIC_OBJ_PATH)*.o
@if [ -d $(STATIC_OBJ_PATH) ] ; then rmdir $(STATIC_OBJ_DIR) ; fi
@rm -f $(SHARED_OBJ_PATH)*.o
@if [ -d $(SHARED_OBJ_DIR) ] ; then rmdir $(SHARED_OBJ_DIR) ; fi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -