--- gsm-1.0-pl10/Makefile.wiget Tue Jul 2 16:36:06 1996 +++ gsm-1.0-pl10/Makefile Tue Aug 29 13:37:15 2000 @@ -44,7 +44,7 @@ # CCFLAGS = -c -O CC = gcc -ansi -pedantic -CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1 +CCFLAGS = $(OPTFLAGS) -DNeedFunctionPrototypes=1 LD = $(CC) @@ -64,6 +64,7 @@ # LDLIB = -lgcc ######### Additional libraries needed by $(LD) +PICFLAGS = -fPIC # Where do you want to install libraries, binaries, a header file # and the manual pages? @@ -78,10 +79,10 @@ # Leave GSM_INSTALL_ROOT empty to not install the GSM library outside of # this directory. -GSM_INSTALL_ROOT = $(INSTALL_ROOT) +GSM_INSTALL_ROOT = $(INSTALL_ROOT)/usr 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)/share/man/man3 # Where do you want to install the toast binaries and their manpage? @@ -89,12 +90,13 @@ # Leave TOAST_INSTALL_ROOT empty to not install the toast binaries outside # of this directory. -TOAST_INSTALL_ROOT = $(INSTALL_ROOT) +TOAST_INSTALL_ROOT = $(INSTALL_ROOT)/usr TOAST_INSTALL_BIN = $(TOAST_INSTALL_ROOT)/bin -TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/man/man1 +TOAST_INSTALL_MAN = $(TOAST_INSTALL_ROOT)/share/man/man1 # Other tools +MV = mv SHELL = /bin/sh LN = ln BASENAME = basename @@ -140,6 +142,7 @@ # Targets LIBGSM = $(LIB)/libgsm.a +LIBGSMSO= $(LIB)/libgsm.so TOAST = $(BIN)/toast UNTOAST = $(BIN)/untoast @@ -222,6 +225,8 @@ $(SRC)/short_term.o \ $(SRC)/table.o +GSM_SHOBJECTS = $(foreach OBJX,$(GSM_OBJECTS),$(patsubst $(SRC)/%,shared/%,$(OBJX))) + TOAST_OBJECTS = $(SRC)/toast.o \ $(SRC)/toast_lin.o \ $(SRC)/toast_ulaw.o \ @@ -258,6 +263,7 @@ GSM_INSTALL_TARGETS = \ $(GSM_INSTALL_LIB)/libgsm.a \ + $(GSM_INSTALL_LIB)/libgsm.so.1.0.10 \ $(GSM_INSTALL_INC)/gsm.h \ $(GSM_INSTALL_MAN)/gsm.3 \ $(GSM_INSTALL_MAN)/gsm_explode.3 \ @@ -274,12 +280,12 @@ # Default rules .c.o: - $(CC) $(CFLAGS) $? - @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1 + $(CC) -c $(CFLAGS) $? -o $@ +# @-mv `$(BASENAME) $@` $@ > /dev/null 2>&1 # Target rules -all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST) +all: $(LIBGSM) $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST) @-echo $(ROOT): Done. tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result @@ -298,24 +304,38 @@ # The basic API: libgsm +#$(LIBGSMSO): $(LIB) $(GSM_OBJECTS) +# ld -o $@.1.0.10 -shared -soname libgsm.so.1 $(GSM_OBJECTS) $(LIBGSM): $(LIB) $(GSM_OBJECTS) - -rm $(RMFLAGS) $(LIBGSM) $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS) $(RANLIB) $(LIBGSM) +shared: + mkdir shared + +shared/%.o: + $(CC) -c $(CFLAGS) $(PICFLAGS) -o $@ $(addprefix $(SRC)/,$(patsubst %.o,%.c,$(@F))) + +#libgsm.so.2: shared $(GSM_SHOBJECTS) +# echo $(GSM_SHOBJECTS) +# cd shared; $(CC) -shared -Wl -soname libgsm.so.2 -o libgsm.so.2.0 *.o + +$(LIBGSMSO): shared $(GSM_SHOBJECTS) + cd shared; ld -o ../lib/libgsm.so.1.0.10 -shared -soname libgsm.so.1 *.o + strip --strip-unneeded $(LIBGSMSO).1.0.10 + + # Toast, Untoast and Tcat -- the compress-like frontends to gsm. $(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM) $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB) $(UNTOAST): $(BIN) $(TOAST) - -rm $(RMFLAGS) $(UNTOAST) $(LN) $(TOAST) $(UNTOAST) $(TCAT): $(BIN) $(TOAST) - -rm $(RMFLAGS) $(TCAT) $(LN) $(TOAST) $(TCAT) @@ -351,53 +371,47 @@ fi $(TOAST_INSTALL_BIN)/toast: $(TOAST) - -rm $@ cp $(TOAST) $@ chmod 755 $@ $(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast - -rm $@ - ln $? $@ + ln -sf toast $@ -$(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast - -rm $@ - ln $? $@ +$(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast + ln -sf toast $@ $(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 $@ +$(GSM_INSTALL_LIB)/libgsm.so.1.0.10: $(LIBGSMSO).1.0.10 + cp $? $@ + ln -sf libgsm.so.1.0.10 $(GSM_INSTALL_LIB)/libgsm.so.1 + ln -sf libgsm.so.1.0.10 $(GSM_INSTALL_LIB)/libgsm.so # Distribution