$NetBSD: patch-ab,v 1.9 2008/05/20 19:30:01 tnn Exp $ --- Makefile.orig 1996-07-02 16:36:06.000000000 +0200 +++ Makefile @@ -7,11 +7,13 @@ SASR = -DSASR ######### Define SASR if >> is a signed arithmetic shift (-1 >> 1 == -1) -MULHACK = -DUSE_FLOAT_MUL +#MULHACK = -DUSE_FLOAT_MUL +MULHACK = ######### Define this if your host multiplies floats faster than integers, ######### e.g. on a SPARCstation. -FAST = -DFAST +#FAST = -DFAST +FAST = ######### Define together with USE_FLOAT_MUL to enable the GSM library's ######### approximation option for incorrect, but good-enough results. @@ -43,7 +45,7 @@ WAV49 = # CC = /usr/lang/acc # CCFLAGS = -c -O -CC = gcc -ansi -pedantic +# CC = gcc -ansi -pedantic CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1 LD = $(CC) @@ -71,7 +73,7 @@ LD = $(CC) # Leave INSTALL_ROOT empty (or just don't execute "make install") to # not install gsm and toast outside of this directory. -INSTALL_ROOT = +# INSTALL_ROOT = # Where do you want to install the gsm library, header file, and manpages? # @@ -80,8 +82,8 @@ INSTALL_ROOT = GSM_INSTALL_ROOT = $(INSTALL_ROOT) GSM_INSTALL_LIB = $(GSM_INSTALL_ROOT)/lib -GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/inc -GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3 +GSM_INSTALL_INC = $(GSM_INSTALL_ROOT)/include +GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/${PKGMANDIR}/man3 # Where do you want to install the toast binaries and their manpage? @@ -91,13 +93,14 @@ GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/ma TOAST_INSTALL_ROOT = $(INSTALL_ROOT) TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin -TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1 +TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/${PKGMANDIR}/man1 # Other tools SHELL = /bin/sh -LN = ln +LN = ln -s BASENAME = basename +DIRNAME = dirname AR = ar ARFLAGS = cr RMFLAGS = @@ -114,7 +117,7 @@ RANLIB = ranlib # Local Directories -ROOT = . +#ROOT = . ADDTST = $(ROOT)/add-test TST = $(ROOT)/tst MAN = $(ROOT)/man @@ -129,7 +132,7 @@ INC = $(ROOT)/inc # DEBUG = -DNDEBUG ######### Remove -DNDEBUG to enable assertions. -CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \ +CFLAGS += $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \ $(WAV49) $(CCINC) -I$(INC) ######### It's $(CC) $(CFLAGS) @@ -139,7 +142,7 @@ LFLAGS = $(LDFLAGS) $(LDINC) # Targets -LIBGSM = $(LIB)/libgsm.a +LIBGSM = $(LIB)/libgsm.la TOAST = $(BIN)/toast UNTOAST = $(BIN)/untoast @@ -257,7 +260,7 @@ STUFF = ChangeLog \ # Install targets GSM_INSTALL_TARGETS = \ - $(GSM_INSTALL_LIB)/libgsm.a \ + $(GSM_INSTALL_LIB)/libgsm.la \ $(GSM_INSTALL_INC)/gsm.h \ $(GSM_INSTALL_MAN)/gsm.3 \ $(GSM_INSTALL_MAN)/gsm_explode.3 \ @@ -273,10 +276,15 @@ TOAST_INSTALL_TARGETS = \ # Default rules +.SUFFIXES: .o .lo + .c.o: $(CC) $(CFLAGS) $? @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1 +.c.lo: + cd `${DIRNAME} $@` && ${LIBTOOL} --mode=compile ${CC} ${CFLAGS} $? + # Target rules all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST) @@ -299,16 +307,20 @@ install: toastinstall gsminstall # The basic API: libgsm -$(LIBGSM): $(LIB) $(GSM_OBJECTS) +$(LIBGSM): $(LIB) $(GSM_OBJECTS:.o=.lo) -rm $(RMFLAGS) $(LIBGSM) - $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS) - $(RANLIB) $(LIBGSM) + cd $(LIB) && \ + $(LIBTOOL) --mode=link $(CC) -o `$(BASENAME) $@` \ + $(GSM_OBJECTS:.o=.lo) \ + -rpath $(PREFIX)/lib -version-info 1:10 # Toast, Untoast and Tcat -- the compress-like frontends to gsm. $(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM) - $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB) + cd $(BIN) && \ + $(LIBTOOL) --mode=link $(LD) $(LFLAGS) -o `$(BASENAME) $@` \ + $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB) $(UNTOAST): $(BIN) $(TOAST) -rm $(RMFLAGS) $(UNTOAST) @@ -332,12 +344,12 @@ $(LIB): gsminstall: -if [ x"$(GSM_INSTALL_ROOT)" != x ] ; then \ - make $(GSM_INSTALL_TARGETS) ; \ + $(MAKE) $(GSM_INSTALL_TARGETS) ; \ fi toastinstall: -if [ x"$(TOAST_INSTALL_ROOT)" != x ]; then \ - make $(TOAST_INSTALL_TARGETS); \ + $(MAKE) $(TOAST_INSTALL_TARGETS); \ fi gsmuninstall: @@ -351,52 +363,34 @@ toastuninstall: fi $(TOAST_INSTALL_BIN)/toast: $(TOAST) - -rm $@ - cp $(TOAST) $@ - chmod 755 $@ + ${LIBTOOL} --mode=install ${BSD_INSTALL_PROGRAM} $? $(TOAST_INSTALL_BIN) $(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast - -rm $@ - ln $? $@ + ${LN} -f toast $@ $(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast - -rm $@ - ln $? $@ + ${LN} -f toast $@ $(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1 - -rm $@ - cp $? $@ - chmod 444 $@ + ${BSD_INSTALL_MAN} $? $(TOAST_INSTALL_MAN) $(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3 - -rm $@ - cp $? $@ - chmod 444 $@ + ${BSD_INSTALL_MAN} $? $(GSM_INSTALL_MAN) $(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3 - -rm $@ - cp $? $@ - chmod 444 $@ + ${BSD_INSTALL_MAN} $? $(GSM_INSTALL_MAN) $(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3 - -rm $@ - cp $? $@ - chmod 444 $@ + ${BSD_INSTALL_MAN} $? $(GSM_INSTALL_MAN) $(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3 - -rm $@ - cp $? $@ - chmod 444 $@ + ${BSD_INSTALL_MAN} $? $(GSM_INSTALL_MAN) $(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h - -rm $@ - cp $? $@ - chmod 444 $@ - -$(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM) - -rm $@ - cp $? $@ - chmod 444 $@ + ${BSD_INSTALL_DATA} $? $(GSM_INSTALL_INC) + +$(GSM_INSTALL_LIB)/libgsm.la: $(LIBGSM) + ${LIBTOOL} --mode=install ${BSD_INSTALL_LIB} $? $(GSM_INSTALL_LIB) # Distribution