📄 makefile
字号:
## Copyright 1992 by Jutta Degener and Carsten Bormann, Technische# Universitaet Berlin. See the accompanying file "COPYRIGHT" for# details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.## Machine dependent flags you must configure to portSASR = -DSASR######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1)#MULHACK = -DUSE_FLOAT_MUL######### Define this if your host multiplies floats faster than integers,######### e.g. on a SPARCstation.#FAST = -DFAST######### Define together with USE_FLOAT_MUL to enable the GSM library's######### approximation option for incorrect, but good-enough results.# Choose a compiler. The code works both with ANSI and K&R-C.# Use -DNeedFunctionPrototypes to compile with, -UNeedFunctionPrototypes to# compile without, function prototypes in the header files.## You can use the -DSTUPID_COMPILER to circumvent some compilers'# static limits regarding the number of subexpressions in a statement.CC = tcc#CC = gcc# CCFLAGS = -c -DSTUPID_COMPILER# CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1CCFLAGS = -c -O -UNeedFunctionPrototypes# LD = gccLD = $(CC)# LDFLAGS =# If your compiler needs additional flags/libraries, regardless of# the source compiled, configure them here.CCINC = -Ic:\tc\include######### Includes needed by $(CC)LDINC = -Ic:\tc\include######### Library paths needed by $(LD)#LDLIB = .\src\getopt.obj######### Additional libraries needed by $(LD)# Where do you want to install libraries, binaries, a header file# and the manual pages?## Leave INSTALL_ROOT empty (or just don't execute "make install") to# not install gsm and toast outside of this directory.INSTALL_ROOT =# Where do you want to install the gsm library, header file, and manpages?## Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of# this directory.GSM_INSTALL_ROOT = $(INSTALL_ROOT)GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/libGSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/incGSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3# Where do you want to install the toast binaries and their manpage?## Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside# of this directory.TOAST_INSTALL_ROOT = $(INSTALL_ROOT)TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/binTOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1# Other toolsSHELL = /bin/shLN = lnBASENAME = basenameAR = TLIBARFLAGS = crRMFLAGS =FIND = findCOMPRESS = compressCOMPRESSFLAGS = # RANLIB = trueRANLIB = ranlib## You shouldn't have to configure below this line if you're porting.# # Local DirectoriesROOT = .ADDTST = $(ROOT)\add-testTST = $(ROOT)\tstMAN = $(ROOT)\manBIN = $(ROOT)\binSRC = $(ROOT)\srcLIB = $(ROOT)\libTLS = $(ROOT)\tlsINC = $(ROOT)\inc.PATH.c = $(SRC)# FlagsDEBUG = -DNDEBUG######### Remove -DNDEBUG to enable assertions.CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(CCINC) -I$(INC)######### It's $(CC) $(CFLAGS)LFLAGS = $(LDFLAGS) $(LDINC)######### It's $(LD) $(LFLAGS)# TargetsLIBGSM = $(LIB)\libgsm.libTOAST = $(BIN)\toast.exeUNTOAST = $(BIN)\untoast.exeTCAT = $(BIN)\tcat.exe# HeadersGSM_HEADERS = $(INC)\gsm.hHEADERS = $(INC)\proto.h \ $(INC)\unproto.h \ $(INC)\config.h \ $(INC)\private.h \ $(INC)\gsm.h \ $(INC)\toast.h \ $(TLS)\taste.h# SourcesGSM_SOURCES = $(SRC)\add.c \ $(SRC)\code.c \ $(SRC)\debug.c \ $(SRC)\decode.c \ $(SRC)\long_term.c \ $(SRC)\lpc.c \ $(SRC)\preprocess.c \ $(SRC)\rpe.c \ $(SRC)\gsm_destroy.c \ $(SRC)\gsm_decode.c \ $(SRC)\gsm_encode.c \ $(SRC)\gsm_explode.c \ $(SRC)\gsm_implode.c \ $(SRC)\gsm_create.c \ $(SRC)\gsm_print.c \ $(SRC)\gsm_option.c \ $(SRC)\short_term.c \ $(SRC)\table.cTOAST_SOURCES = $(SRC)\toast.c \ $(SRC)\toast_lin.c \ $(SRC)\toast_ulaw.c \ $(SRC)\toast_alaw.c \ $(SRC)\toast_audio.c \ $(SRC)\getopt.cSOURCES = $(GSM_SOURCES) \ $(TOAST_SOURCES) \ $(ADDTST)\add_test.c \ $(TLS)\bitter.c \ $(TLS)\bitter.dta \ $(TLS)\taste.c \ $(TLS)\sweet.c \ $(TST)\cod2lin.c \ $(TST)\cod2txt.c \ $(TST)\gsm2cod.c \ $(TST)\lin2cod.c \ $(TST)\lin2txt.c# Object filesGSM_OBJECTS = $(SRC)\add.obj \ $(SRC)\code.obj \ $(SRC)\debug.obj \ $(SRC)\decode.obj \ $(SRC)\long_term.obj \ $(SRC)\lpc.obj \ $(SRC)\preprocess.obj \ $(SRC)\rpe.obj \ $(SRC)\gsm_destroy.obj \ $(SRC)\gsm_decode.obj \ $(SRC)\gsm_encode.obj \ $(SRC)\gsm_explode.obj \ $(SRC)\gsm_implode.obj \ $(SRC)\gsm_create.obj \ $(SRC)\gsm_print.obj \ $(SRC)\gsm_option.obj \ $(SRC)\short_term.obj \ $(SRC)\table.objTOAST_OBJECTS = $(SRC)\toast.obj \ $(SRC)\toast_lin.obj \ $(SRC)\toast_ulaw.obj \ $(SRC)\toast_alaw.obj \ $(SRC)\toast_audio.obj \ $(SRC)\getopt.objOBJECTS = $(GSM_OBJECTS) $(TOAST_OBJECTS)# ManualsGSM_MANUALS = $(MAN)\gsm.3 \ $(MAN)\gsm_explode.3 \ $(MAN)\gsm_option.3 \ $(MAN)\gsm_print.3TOAST_MANUALS = $(MAN)\toast.1MANUALS = $(GSM_MANUALS) $(TOAST_MANUALS) $(MAN)\bitter.1# Other stuff in the distributionSTUFF = ChangeLog \ INSTALL \ MACHINES \ MANIFEST \ Makefile \ README \ $(ADDTST)\add_test.dta \ $(TLS)\bitter.dta \ $(TST)\run# Install targetsGSM_INSTALL_TARGETS = \ $(GSM_INSTALL_LIB)\libgsm.a \ $(GSM_INSTALL_INC)\gsm.h \ $(GSM_INSTALL_MAN)\gsm.3 \ $(GSM_INSTALL_MAN)\gsm_explode.3 \ $(GSM_INSTALL_MAN)\gsm_option.3 \ $(GSM_INSTALL_MAN)\gsm_print.3TOAST_INSTALL_TARGETS = \ $(TOAST_INSTALL_BIN)\toast \ $(TOAST_INSTALL_BIN)\tcat \ $(TOAST_INSTALL_BIN)\untoast \ $(TOAST_INSTALL_MAN)\toast.1# Default rules.c.obj: $(CC) $(CFLAGS) -n$(SRC) $<# @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1# Target rulesall: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST) @-echo $(ROOT): Done.tst: $(TST)\lin2cod.exe $(TST)\cod2lin.exe $(TST)\lin2txt.exe \ $(TST)\gsm2cod.exe $(TST)\cod2txt.exe @-echo tst: Done.addtst: $(ADDTST)\add.exe $(ADDTST)\add_test.dta $(ADDTST)\add.exe < $(ADDTST)\add_test.dta @-echo addtst: Done.misc: $(TLS)\sweet $(TLS)\bitter \ $(TST)\lin2txt $(TST)\cod2txt $(TST)\gsm2cod @-echo misc: Done.install: toastinstall gsminstall @-echo install: Done.# The basic API: libgsm$(LIBGSM): $(LIB) $(GSM_OBJECTS) -del $(RMFLAGS) $(LIBGSM) $(AR) $(LIBGSM) @lib.rsp # Toast, Untoast and Tcat -- the compress-like frontends to gsm.$(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM) $(LD) $(LFLAGS) -e$(TOAST) @toast.rsp $(LIBGSM) $(LDLIB)$(UNTOAST): $(BIN) $(TOAST) -del $(RMFLAGS) $(UNTOAST) copy $(TOAST) $(UNTOAST)$(TCAT): $(BIN) $(TOAST) -del $(RMFLAGS) $(TCAT) copy $(TOAST) $(TCAT)# The local bin and lib directories$(BIN): -mkdir $(BIN)$(LIB): -mkdir $(LIB) # Installationgsminstall: -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \ make $(GSM_INSTALL_TARGETS) ; \ fitoastinstall: -if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then \ make $(TOAST_INSTALL_TARGETS); \ figsmuninstall: -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \ rm $(RMFLAGS) $(GSM_INSTALL_TARGETS) ; \ fitoastuninstall: -if [ x"$(TOAST_INSTALL_ROOT)" != x ] ; then \ rm $(RMFLAGS) $(TOAST_INSTALL_TARGETS); \ fi$(TOAST_INSTALL_BIN)/toast: $(TOAST) -rm $@ cp $(TOAST) $@ chmod 755 $@$(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast -rm $@ ln $? $@$(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast -rm $@ ln $? $@$(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1 -rm $@ cp $? $@ chmod 444 $@$(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3 -rm $@ cp $? $@ chmod 444 $@$(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3 -rm $@ cp $? $@ chmod 444 $@$(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3 -rm $@ cp $? $@ chmod 444 $@$(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3 -rm $@ cp $? $@ chmod 444 $@$(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h -rm $@ cp $? $@ chmod 444 $@$(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM) -rm $@ cp $? $@ chmod 444 $@# Distributiondist: gsm-1.0.tar.Z @echo dist: Done.gsm-1.0.tar.Z: $(STUFF) $(SOURCES) $(HEADERS) $(MANUALS) ( cd $(ROOT)/..; \ tar cvf - `cat $(ROOT)/gsm-1.0/MANIFEST \ | sed '/^#/d'` \ ) | $(COMPRESS) $(COMPRESSFLAGS) > $(ROOT)/gsm-1.0.tar.Z# Cleanuninstall: toastuninstall gsmuninstall @-echo uninstall: Done.semi-clean: -rm $(RMFLAGS) */*.o \ $(TST)/lin2cod $(TST)/lin2txt \ $(TST)/cod2lin $(TST)/cod2txt \ $(TST)/gsm2cod \ $(TST)/*.*.* -$(FIND) . \( -name core -o -name foo \) \ -print | xargs rm $(RMFLAGS)clean: semi-clean -rm $(RMFLAGS) $(LIBGSM) $(ADDTST)/add \ $(TOAST) $(TCAT) $(UNTOAST) \ $(ROOT)/gsm-1.0.tar.Z# Two tools that helped me generate gsm_encode.c and gsm_decode.c,# but aren't generally needed to port this.$(TLS)/sweet: $(TLS)/sweet.o $(TLS)/taste.o $(LD) $(LFLAGS) -o $(TLS)/sweet \ $(TLS)/sweet.o $(TLS)/taste.o $(LDLIB)$(TLS)/bitter: $(TLS)/bitter.o $(TLS)/taste.o $(LD) $(LFLAGS) -o $(TLS)/bitter \ $(TLS)/bitter.o $(TLS)/taste.o $(LDLIB)# Run $(ADDTST)/add < $(ADDTST)/add_test.dta to make sure the# basic arithmetic functions work as intended.$(ADDTST)\add.exe: $(ADDTST)\add_test.obj $(LD) $(LFLAGS) -e$(ADDTST)\add.exe $(ADDTST)\add_test.obj $(LDLIB)$(ADDTST)\add_test.obj: $(ADDTST)\add_test.c $(CC) $(CFLAGS) -n$(ADDTST) $(ADDTST)\add_test.c# Various conversion programs between linear, text, .gsm and the code# format used by the tests we ran (.cod). We paid for the test data,# so I guess we can't just provide them with this package. Still,# if you happen to have them lying around, here's the code.# # You can use gsm2cod | cod2txt independently to look at what's# coded inside the compressed frames, although this shouldn't be# hard to roll on your own using the gsm_print() function from# the API.#$(TST)\test-result: $(TST)\lin2cod.exe $(TST)\cod2lin.exe $(TST)\run# ( cd $(TST); .\run ) $(TST)\lin2txt.exe: $(TST)\lin2txt.obj $(LD) $(LFLAGS) -e$(TST)\lin2txt.exe \ $(TST)\lin2txt.obj $(LIBGSM) $(LDLIB)$(TST)\lin2cod.exe: $(TST)\lin2cod.obj $(LD) $(LFLAGS) -e$(TST)\lin2cod.exe \ $(TST)\lin2cod.obj $(LIBGSM) $(LDLIB)$(TST)\gsm2cod.exe: $(TST)\gsm2cod.obj $(LD) $(LFLAGS) -e$(TST)\gsm2cod.exe \ $(TST)\gsm2cod.obj $(LIBGSM) $(LDLIB)$(TST)\cod2txt.exe: $(TST)\cod2txt.obj $(LD) $(LFLAGS) -e$(TST)\cod2txt.exe \ $(TST)\cod2txt.obj $(LIBGSM) $(LDLIB)$(TST)\cod2lin.exe: $(TST)\cod2lin.obj $(LD) $(LFLAGS) -e$(TST)\cod2lin.exe \ $(TST)\cod2lin.obj $(LIBGSM) $(LDLIB)$(TST)\lin2txt.obj: $(TST)\lin2txt.c $(CC) $(CFLAGS) -n$(TST) $(TST)\lin2txt.c$(TST)\lin2cod.obj: $(TST)\lin2cod.c $(CC) $(CFLAGS) -n$(TST) $(TST)\lin2cod.c$(TST)\gsm2cod.obj: $(TST)\gsm2cod.c $(CC) $(CFLAGS) -n$(TST) $(TST)\gsm2cod.c$(TST)\cod2txt.obj: $(TST)\cod2txt.c $(CC) $(CFLAGS) -n$(TST) $(TST)\cod2txt.c$(TST)\cod2lin.obj: $(TST)\cod2lin.c $(CC) $(CFLAGS) -n$(TST) $(TST)\cod2lin.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -