📄 makefile
字号:
#!/bin/make## Copyright (c) 1994 David I. Bell and Landon Curt Noll# Permission is granted to use, distribute, or modify this source,# provided that this copyright notice remains intact.## Arbitrary precision calculator.## calculator by David I. Bell# Makefile by Landon Curt Noll###############################################################################-=-=-=-=-=-=-=-=- You may want to change some values below -=-=-=-=-=-=-=-=-################################################################################ Determine the type of terminal controls that you want to use## VARARG value meaning# ------------ -------# (nothing) let the makefile guess at what you need# -DUSE_TERMIOS use struct termios from <termios.h># -DUSE_TERMIO use struct termios from <termio.h># -DUSE_SGTTY use struct sgttyb from <sys/ioctl.h>#TERMCONTROL=#TERMCONTROL= -DUSE_TERMIOS#TERMCONTROL= -DUSE_TERMIO#TERMCONTROL= -DUSE_SGTTY# Determine the type of varargs that you want to use## VARARG value meaning# ------------ -------# (nothing) let the makefile guess at what you need# STDARG you have ANSI C and /usr/include/stdarg.h# VARARGS you have /usr/include/varargs.h# SIMULATE_STDARG use simulated ./stdarg.h## Try defining VARARG to be nothing. The makefile will look for the# needed .h files, trying for stdarg.h first.#VARARG=#VARARG= STDARG#VARARG= VARARGS#VARARG= SIMULATE_STDARG# If your system does not have a vsprintf() function, you could be in trouble.## vsprintf(stream, format, ap)## This function works like sprintf except that the 3rd arg is a va_list# strarg (or varargs) list.## If you have vsprintf, then define DONT_HAVE_VSPRINTF to be an empty string.# Some old systems do not have vsprintf(). If you do not have vsprintf()# then define DONT_HAVE_VSPRINTF to be -DDONT_HAVE_VSPRINTF and hope for# the best.#DONT_HAVE_VSPRINTF=#DONT_HAVE_VSPRINTF= -DDONT_HAVE_VSPRINTF# Determine the byte order of your machine## Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...# Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...## If in doubt, leave BYTE_ORDER empty. This makefile will attempt to# use BYTE_ORDER in <machine/endian.h> or it will attempt to run# the endian program. If you get syntax errors when you compile,# try forcing the value to be BIG_ENDIAN and run the calc regression# tests. (see the README file) If the calc regression tests fail, do# a make clobber and try LITTLE_ENDIAN. If that fails, ask a wizard# for help.#BYTE_ORDER=#BYTE_ORDER= BIG_ENDIAN#BYTE_ORDER= LITTLE_ENDIAN# Determine the number of bits in a long## If in doubt, leave LONG_BITS empty. This makefile will run# the longbits program to determine the length.#LONG_BITS=#LONG_BITS= 32#LONG_BITS= 64# Determine whether to use the standard malloc or the alternative one# included with the calculator. On some machines, the alternative malloc# may be faster. It also can help to debug malloc problems.## Define MALLOC to be -DCALC_MALLOC to use the internal malloc routines.## If in doubt, leave MALLOC empty.#MALLOC=#MALLOC= -DCALC_MALLOC# where to install binary files##BINDIR= /usr/local/bin#BINDIR= /usr/binBINDIR= /usr/contrib/bin# where to install the lib/*.cal files## ${TOPDIR} is the directory under which the calc directory will be placed.# ${LIBDIR} is where the *.cal, bindings and help directory are installed.# ${HELPDIR} is where the help directory is installed.##TOPDIR= /usr/local/lib#TOPDIR= /usr/libTOPDIR= /usr/libdataLIBDIR= ${TOPDIR}/calcHELPDIR= ${LIBDIR}/help# where man pages are installed## Use MANDIR= to disable installation of the calc man (source) page.#MANDIR=#MANDIR=/usr/local/man/man1#MANDIR=/usr/man/man1#MANDIR=/usr/share/man/man1#MANDIR=/usr/man/u_man/man1#MANDIR=/usr/contrib/man/man1# where cat (formatted man) pages are installed## Use CATDIR= to disable installation of the calc cat (formatted) page.#CATDIR=#CATDIR=/usr/local/man/cat1#CATDIR=/usr/man/cat1#CATDIR=/usr/share/man/cat1#CATDIR=/usr/man/u_man/cat1#CATDIR=/usr/contrib/man/cat1# extenstion to add on to the calc man page filename## This is ignored if CATDIR is empty.#MANEXT= 1#MANEXT= l# extenstion to add on to the calc man page filename## This is ignored if CATDIR is empty.##CATEXT= 1CATEXT= 0#CATEXT= l# how to format a man page## We will execute ${NROFF} ${NROFF_ARG} calc.1 to format the calc man page.## This is ignored if CATDIR is empty.NROFF= nroff#NROFF= groffNROFF_ARG = -man#NROFF_ARG = -mandoc# If the $CALCPATH environment variable is not defined, then the following# path will be search for calc lib routines.#CALCPATH= .:./lib:~/lib:${LIBDIR}# If the $CALCRC environment variable is not defined, then the following# path will be search for calc lib routines.#CALCRC= ${LIBDIR}/startup:~/.calcrc# If the $CALCBINDINGS environment variable is not defined, then the following# file will be used for the command line and edit history key bindings.#CALCBINDINGS= ${LIBDIR}/bindings#CALCBINDINGS= ${LIBDIR}/altbind# If $PAGER is not set, use this program to display a help file#CALCPAGER= more#CALCPAGER= pg#CALCPAGER= cat#CALCPAGER= less# Compile/Debug options for ${CC} and ${LD}#DEBUG= -O#DEBUG= -O2#DEBUG= -O3#DEBUG= -g#DEBUG= -gx#DEBUG= -WM,-g#DEBUG=# On systems that have dynamic shared libs, you want want to disable them# for faster calc startup.#NO_SHARED=#NO_SHARED= -dn# If you are running an an old BSD system, then you may not have# the following functions:## memcpy() strchr() memset()## If you do not have these functions, define OLD_BSD to be -DOLD_BSD,# otherwise define OLD_BSD to be an empty string.## Modern BSD and BSD-like systems have these functions and thus don't# need OLD_BSD. If you don't know, try using the empty string and if# you get complaints, try -DOLD_BSD.#OLD_BSD=#OLD_BSD= -DOLD_BSD# Some old systems don't know what a uid_t is. Define UID_T if you get# an error regarding 'uid_t' when compiling files such as calc.c#UID_T=#UID_T= -DUID_T# Some systems require one to use ranlib to add a symbol table to# a *.a library. Set RANLIB to the utility that performs this action.# Set RANLIB to : if your system does not need such a utility.#RANLIB=ranlib#RANLIB=:# Some systems are able to form lint libs. How it is formed depends# on your system. If you do not care about lint, use : as the# LINTLIB value.## System type LINTLIB recomendation## BSD ${LINT} ${LCFLAGS} ${LINTFLAGS} -u -Ccalc# SYSV ${LINT} ${LCFLAGS} ${LINTFLAGS} -u -o calc# disable :#LINTLIB= ${LINT} ${LCFLAGS} ${LINTFLAGS} -u -Ccalc#LINTLIB= ${LINT} ${LCFLAGS} ${LINTFLAGS} -u -o calc#LINTLIB= :# The lint flags vary from system to system. Some systems have the# opposite meaning for the flags below. Other systems change flag# meaning altogether.## System LINTFLAGS recomendation## SunOs -a -h -v -z#LINTFLAGS= -a -h -v -z#LINTFLAGS=# Select your compiler type## LCFLAGS are flags that both ${CC} and ${LINT} can use# LDFLAGS are flags that both ${CC} amd ${LD} can use# CCMAIN are flags for ${CC} when compiling only files with main()# CCOPT ate flags for ${CC} only# CFLAGS are the default flags given to ${CC}## If you do not wish to use purify, leave ${PURIFY} commented out.##PURIFY= /u2/purify/purify -logfile=pure.out#PURIFY= /u2/purify/purify###### common cc#LCFLAGS= ${MALLOC} ${OLD_BSD} ${DONT_HAVE_VSPRINTF} ${UID_T}LDFLAGS= ${DEBUG}CCMAIN=CCOPT=CFLAGS= ${CCOPT} ${LDFLAGS} ${LCFLAGS}CC= ${PURIFY} cc## for RS6000 cc##LCFLAGS= ${MALLOC} ${OLD_BSD} ${DONT_HAVE_VSPRINTF} ${UID_T}#LDFLAGS= ${DEBUG}#CCMAIN=#CCOPT=#CFLAGS= ${CCOPT} ${LDFLAGS} ${LCFLAGS} -qlanglvl=ansi#CC= ${PURIFY} cc## for gcc1##LCFLAGS= ${MALLOC} ${OLD_BSD} ${DONT_HAVE_VSPRINTF} ${UID_T}#LDFLAGS= ${DEBUG}#CCMAIN=#CCOPT= -Wall#CFLAGS= ${CCOPT} ${LDFLAGS} ${LCFLAGS} -ansi#CC= ${PURIFY} gcc## for gcc2##LCFLAGS= ${MALLOC} ${OLD_BSD} ${DONT_HAVE_VSPRINTF} ${UID_T}#LDFLAGS= ${DEBUG}#CCMAIN= -Wno-return-type#CCOPT= -Wall -Wno-implicit -Wno-comment#CFLAGS= ${CCOPT} ${LDFLAGS} ${LCFLAGS} -ansi#CC= ${PURIFY} gcc###############################################################################-=-=-=-=-=-=-=-=- Be careful if you change something below -=-=-=-=-=-=-=-=-################################################################################ standard utilities used during make#SHELL= /bin/shMAKE= makeSED= sedTEE= teeLINT= lintCTAGS= ctagsLD= ${CC}## the source files which are built into a math library#LIBSRC = alloc.c comfunc.c commath.c qfunc.c qio.c qmath.c qmod.c qtrans.c \ zfunc.c zio.c zmath.c zmod.c zmul.c## the object files which are built into a math library#LIBOBJS = alloc.o comfunc.o commath.o qfunc.o qio.o qmath.o qmod.o qtrans.o \ zfunc.o zio.o zmath.o zmod.o zmul.o## the calculator source files#CALCSRC = addop.c assocfunc.c calc.c codegen.c config.c const.c file.c \ func.c hist.c input.c label.c listfunc.c matfunc.c obj.c opcodes.c \ string.c symbol.c token.c value.c version.c## we build these .o files for calc#CALCOBJS = addop.o assocfunc.o calc.o codegen.o config.o const.o file.o \ func.o hist.o input.o label.o listfunc.o matfunc.o obj.o opcodes.o \ string.o symbol.o token.o value.o version.o# we build these .h files during the make#BUILD_H_SRC= args.h config.h endian.h have_malloc.h have_stdlib.h \ have_string.h longbits.h terminal.h# these .h files are needed by programs that use libcalc.a#LIB_H_SRC= alloc.h args.h cmath.h endian.h have_malloc.h have_stdlib.h \ have_string.h longbits.h qmath.h stdarg.h zmath.h# these .h files are neither built, nor required by libcalc.a#CALC_H_SRC= calc.h config.h func.h hist.h label.h opcodes.h stdarg.h \ string.h symbol.h terminal.h token.h value.h# there are the complete list of .h files#H_SRC = ${CALC_H_SRC} ${LIB_H_SRC}# The code program is not part of the calc distribution, don't worry# if you do not have it.#CODEOBJS= code.oall: calc calc.1calc: libcalc.a ${CALCOBJS} ${LD} ${LDFLAGS} ${CALCOBJS} libcalc.a -o calc ${NO_SHARED}calc.o: calc.c ${CC} ${CFLAGS} ${CCMAIN} -c calc.chsrc: ${BUILD_H_SRC}hist.o: hist.c Makefile ${CC} ${CFLAGS} ${TERMCONTROL} -c hist.clibcalc.a: ${LIBOBJS} Makefile rm -f libcalc.a ar qc libcalc.a ${LIBOBJS} ${RANLIB} libcalc.aendian: endian.c -@rm -f endian.o endian ${CC} ${CFLAGS} ${CCMAIN} endian.c -o endian ${NO_SHARED}longbits: longbits.c -@rm -f longbits.o longbits ${CC} ${CFLAGS} ${CCMAIN} longbits.c -o longbits ${NO_SHARED}config.h: Makefile rm -f config.h @echo 'forming config.h' @echo '/*' > config.h @echo ' * DO NOT EDIT -- generated by the Makefile' >> config.h @echo ' */' >> config.h @echo '' >> config.h @echo '/* the default :-separated search path */' >> config.h @echo '#ifndef DEFAULTCALCPATH' >> config.h @echo '#define DEFAULTCALCPATH "${CALCPATH}"' >> config.h @echo '#endif /* DEFAULTCALCPATH */' >> config.h @echo '' >> config.h @echo '/* the default :-separated startup file list */' >> config.h @echo '#ifndef DEFAULTCALCRC' >> config.h @echo '#define DEFAULTCALCRC "${CALCRC}"' >> config.h @echo '#endif /* DEFAULTCALCRC */' >> config.h @echo '' >> config.h @echo '/* the default key bindings file */' >> config.h @echo '#ifndef DEFAULTCALCBINDINGS' >> config.h @echo '#define DEFAULTCALCBINDINGS "${CALCBINDINGS}"' >> config.h @echo '#endif /* DEFAULTCALCBINDINGS */' >> config.h @echo '' >> config.h @echo '/* the location of the help directory */' >> config.h @echo '#ifndef HELPDIR' >> config.h @echo '#define HELPDIR "${HELPDIR}"' >> config.h @echo '#endif /* HELPDIR */' >> config.h @echo '' >> config.h @echo '/* the default pager to use */' >> config.h @echo '#ifndef DEFAULTCALCPAGER' >> config.h @echo '#define DEFAULTCALCPAGER "${CALCPAGER}"' >> config.h @echo '#endif /* DEFAULTCALCPAGER */' >> config.h @echo 'config.h formed'endian.h: endian Makefile rm -f endian.h @echo 'forming endian.h' @echo '/*' > endian.h @echo ' * DO NOT EDIT -- generated by the Makefile' >> endian.h @echo ' */' >> endian.h @echo '' >> endian.h -@if [ X"${BYTE_ORDER}" = X ]; then \ if [ -f /usr/include/machine/endian.h ]; then \ echo '#include <machine/endian.h>' >> endian.h; \ else \ ./endian >> endian.h; \ fi; \ else \ echo "#define BYTE_ORDER ${BYTE_ORDER}" >> endian.h; \ fi @echo 'endian.h formed'longbits.h: longbits rm -f longbits.h @echo 'forming longbits.h' @echo '/*' > longbits.h @echo ' * DO NOT EDIT -- generated by the Makefile' >> longbits.h @echo ' */' >> longbits.h @echo '' >> longbits.h -@if [ X"${LONG_BITS}" = X ]; then \ ./longbits >> longbits.h; \ else \ echo "#define LONG_BITS ${LONG_BITS}" >> longbits.h; \ fi @echo 'longbits.h formed'have_malloc.h: Makefile rm -f have_malloc.h @echo 'forming have_malloc.h' @echo '/*' > have_malloc.h @echo ' * DO NOT EDIT -- generated by the Makefile' >> have_malloc.h @echo ' */' >> have_malloc.h @echo '' >> have_malloc.h @echo '/* do we have /usr/include/malloc.h? */' > have_malloc.h -@if [ -f /usr/include/malloc.h ]; then \ echo '#define HAVE_MALLOC_H /* yes */' >> have_malloc.h; \ else \ echo '#undef HAVE_MALLOC_H /* no */' >> have_malloc.h; \ fi @echo 'have_malloc.h formed'have_stdlib.h: Makefile rm -f have_stdlib.h @echo 'forming have_stdlib.h' @echo '/*' > have_stdlib.h @echo ' * DO NOT EDIT -- generated by the Makefile' >> have_stdlib.h @echo ' */' >> have_stdlib.h @echo '' >> have_stdlib.h @echo '/* do we have /usr/include/stdlib.h? */' > have_stdlib.h -@if [ -f /usr/include/stdlib.h ]; then \ echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \ else \ echo '#undef HAVE_STDLIB_H /* no */' >> have_stdlib.h; \ fi @echo 'have_stdlib.h formed'have_string.h: Makefile rm -f have_string.h @echo 'forming have_string.h' @echo '/*' > have_string.h @echo ' * DO NOT EDIT -- generated by the Makefile' >> have_string.h @echo ' */' >> have_string.h @echo '' >> have_string.h @echo '/* do we have /usr/include/string.h? */' > have_string.h -@if [ -f /usr/include/string.h ]; then \ echo '#define HAVE_STRING_H /* yes */' >> have_string.h; \ else \ echo '#undef HAVE_STRING_H /* no */' >> have_string.h; \ fi @echo 'have_string.h formed'terminal.h: Makefile rm -f terminal.h @echo 'forming terminal.h' @echo '/*' > terminal.h @echo ' * DO NOT EDIT -- generated by the Makefile' >> terminal.h @echo ' */' >> terminal.h @echo '' >> terminal.h @echo '#if !defined(USE_TERMIOS)' >> terminal.h @echo '#if !defined(USE_TERMIO)' >> terminal.h @echo '#if !defined(USE_SGTTY)' >> terminal.h -@if [ -f /usr/include/termios.h ]; then \ echo '#define USE_TERMIOS /* <termios.h> */' >> terminal.h; \ echo '#undef USE_TERMIO /* <termio.h> */' >> terminal.h; \ echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \ elif [ -f /usr/include/termio.h ]; then \ echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \ echo '#define USE_TERMIO /* <termio.h> */' >> terminal.h; \ echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \ else \ echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \ echo '#undef USE_TERMIO /* <termio.h> */' >> terminal.h; \ echo '#define USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \ fi @echo '#endif' >> terminal.h @echo '#endif' >> terminal.h @echo '#endif' >> terminal.h @echo 'terminal.h formed'args.h: Makefile try_stdarg.c rm -f args.h @echo 'forming args.h' @echo '/*' > args.h @echo ' * DO NOT EDIT -- generated by the Makefile' >> args.h @echo ' */' >> args.h @echo '' >> args.h @echo '/* what sort of variable args do we have? */' >> args.h -@if [ ! -z "${VARARG}" ]; then \ echo '#define ${VARARG}' >> args.h; \ elif [ -f /usr/include/stdarg.h -a -f /usr/include/varargs.h ]; then \ rm -f try_stdarg; \ ${CC} ${CFLAGS} ${CCMAIN} try_stdarg.c -o try_stdarg; \ if ./try_stdarg; then \ echo '#define STDARG' >> args.h; \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -