Author: František Dvořák Date: Wed Jan 11 16:38:38 2017 +0100 MinGW port diff --git a/Makefile b/Makefile index cfab74f..4eaeec5 100644 --- a/Makefile +++ b/Makefile @@ -44,14 +44,13 @@ WAV49 = -DWAV49 # CCFLAGS = -c -O CC = gcc -ansi -pedantic -CCFLAGS = -c -O2 -DNeedFunctionPrototypes=1 +CCFLAGS = -c -D_REENTRANT -DNeedFunctionPrototypes=1 LD = $(CC) # LD = gcc # LDFLAGS = - # If your compiler needs additional flags/libraries, regardless of # the source compiled, configure them here. @@ -64,6 +63,7 @@ LD = $(CC) # LDLIB = -lgcc ######### Additional libraries needed by $(LD) +EXEEXT = .exe # Where do you want to install libraries, binaries, a header file # and the manual pages? @@ -81,7 +81,7 @@ 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_MAN = $(GSM_INSTALL_ROOT)/share/man/man3 # Where do you want to install the toast binaries and their manpage? @@ -91,7 +91,7 @@ GSM_INSTALL_MAN = $(GSM_INSTALL_ROOT)/man/man3 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)/share/man/man1 # Other tools @@ -100,7 +100,7 @@ LN = ln BASENAME = basename AR = ar ARFLAGS = cr -RMFLAGS = +RMFLAGS = -f FIND = find COMPRESS = compress COMPRESSFLAGS = @@ -130,20 +130,21 @@ INC = $(ROOT)/inc ######### Remove -DNDEBUG to enable assertions. CFLAGS = $(CCFLAGS) $(SASR) $(DEBUG) $(MULHACK) $(FAST) $(LTP_CUT) \ - $(WAV49) $(CCINC) -I$(INC) + $(WAV49) $(CCINC) -I$(INC) $(RPM_CFLAGS) ######### It's $(CC) $(CFLAGS) -LFLAGS = $(LDFLAGS) $(LDINC) +LFLAGS = $(LDFLAGS) $(LDINC) $(RPM_LDFLAGS) ######### It's $(LD) $(LFLAGS) # Targets LIBGSM = $(LIB)/libgsm.a +LIBGSMSO = $(LIB)/libgsm-1.dll -TOAST = $(BIN)/toast -UNTOAST = $(BIN)/untoast -TCAT = $(BIN)/tcat +TOAST = $(BIN)/toast$(EXEEXT) +UNTOAST = $(BIN)/untoast$(EXEEXT) +TCAT = $(BIN)/tcat$(EXEEXT) # Headers @@ -257,7 +258,8 @@ STUFF = ChangeLog \ # Install targets GSM_INSTALL_TARGETS = \ - $(GSM_INSTALL_LIB)/libgsm.a \ + $(GSM_INSTALL_BIN)/libgsm-1.dll \ + $(GSM_INSTALL_LIB)/libgsm.dll.a \ $(GSM_INSTALL_INC)/gsm.h \ $(GSM_INSTALL_MAN)/gsm.3 \ $(GSM_INSTALL_MAN)/gsm_explode.3 \ @@ -265,9 +267,9 @@ GSM_INSTALL_TARGETS = \ $(GSM_INSTALL_MAN)/gsm_print.3 TOAST_INSTALL_TARGETS = \ - $(TOAST_INSTALL_BIN)/toast \ - $(TOAST_INSTALL_BIN)/tcat \ - $(TOAST_INSTALL_BIN)/untoast \ + $(TOAST_INSTALL_BIN)/toast$(EXEEXT) \ + $(TOAST_INSTALL_BIN)/tcat$(EXEEXT) \ + $(TOAST_INSTALL_BIN)/untoast$(EXEEXT) \ $(TOAST_INSTALL_MAN)/toast.1 @@ -279,7 +281,7 @@ TOAST_INSTALL_TARGETS = \ # Target rules -all: $(LIBGSM) $(TOAST) $(TCAT) $(UNTOAST) +all: $(LIBGSMSO) $(TOAST) $(TCAT) $(UNTOAST) @-echo $(ROOT): Done. tst: $(TST)/lin2cod $(TST)/cod2lin $(TOAST) $(TST)/test-result @@ -299,16 +301,18 @@ install: toastinstall gsminstall # The basic API: libgsm +$(LIBGSMSO) $(LIB)/libgsm.dll.a: $(LIB) $(GSM_OBJECTS) + $(LD) $(LDFLAGS) $(LIBS) $(GSM_OBJECTS) -shared -Xlinker -soname -Xlinker libgsm-1.dll -o $(LIBGSMSO) -Wl,--out-implib=$(LIB)/libgsm.dll.a + $(LIBGSM): $(LIB) $(GSM_OBJECTS) -rm $(RMFLAGS) $(LIBGSM) $(AR) $(ARFLAGS) $(LIBGSM) $(GSM_OBJECTS) $(RANLIB) $(LIBGSM) - # Toast, Untoast and Tcat -- the compress-like frontends to gsm. -$(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSM) - $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSM) $(LDLIB) +$(TOAST): $(BIN) $(TOAST_OBJECTS) $(LIBGSMSO) + $(LD) $(LFLAGS) -o $(TOAST) $(TOAST_OBJECTS) $(LIBGSMSO) $(LDLIB) $(UNTOAST): $(BIN) $(TOAST) -rm $(RMFLAGS) $(UNTOAST) @@ -350,54 +354,53 @@ toastuninstall: rm $(RMFLAGS) $(TOAST_INSTALL_TARGETS); \ fi -$(TOAST_INSTALL_BIN)/toast: $(TOAST) +$(TOAST_INSTALL_BIN)/toast$(EXEEXT): $(TOAST) -rm $@ - cp $(TOAST) $@ - chmod 755 $@ + install -pm755 $(TOAST) $@ -$(TOAST_INSTALL_BIN)/untoast: $(TOAST_INSTALL_BIN)/toast +$(TOAST_INSTALL_BIN)/untoast$(EXEEXT): $(TOAST_INSTALL_BIN)/toast$(EXEEXT) -rm $@ ln $? $@ -$(TOAST_INSTALL_BIN)/tcat: $(TOAST_INSTALL_BIN)/toast +$(TOAST_INSTALL_BIN)/tcat$(EXEEXT): $(TOAST_INSTALL_BIN)/toast$(EXEEXT) -rm $@ ln $? $@ $(TOAST_INSTALL_MAN)/toast.1: $(MAN)/toast.1 -rm $@ - cp $? $@ - chmod 444 $@ + install -pm644 $? $@ $(GSM_INSTALL_MAN)/gsm.3: $(MAN)/gsm.3 -rm $@ - cp $? $@ - chmod 444 $@ + install -pm644 $? $@ $(GSM_INSTALL_MAN)/gsm_option.3: $(MAN)/gsm_option.3 -rm $@ - cp $? $@ - chmod 444 $@ + install -pm644 $? $@ $(GSM_INSTALL_MAN)/gsm_explode.3: $(MAN)/gsm_explode.3 -rm $@ - cp $? $@ - chmod 444 $@ + install -pm644 $? $@ $(GSM_INSTALL_MAN)/gsm_print.3: $(MAN)/gsm_print.3 -rm $@ - cp $? $@ - chmod 444 $@ + install -pm644 $? $@ $(GSM_INSTALL_INC)/gsm.h: $(INC)/gsm.h -rm $@ - cp $? $@ - chmod 444 $@ + install -pm644 $? $@ $(GSM_INSTALL_LIB)/libgsm.a: $(LIBGSM) -rm $@ - cp $? $@ - chmod 444 $@ + install -pm644 $? $@ +$(GSM_INSTALL_BIN)/libgsm-1.dll: $(LIBGSMSO) + -rm $@ + install -pm755 $? $@ + +$(GSM_INSTALL_LIB)/libgsm.dll.a: $(LIB)/libgsm.dll.a + -rm $@ + install -pm644 $? $@ # Distribution diff --git a/inc/config.h b/inc/config.h index dfb1ead..d6295bd 100644 --- a/inc/config.h +++ b/inc/config.h @@ -18,10 +18,7 @@ #define HAS_ERRNO_DECL 1 /* errno.h declares errno */ #define HAS_FSTAT 1 /* fstat syscall */ -#define HAS_FCHMOD 1 /* fchmod syscall */ #define HAS_CHMOD 1 /* chmod syscall */ -#define HAS_FCHOWN 1 /* fchown syscall */ -#define HAS_CHOWN 1 /* chown syscall */ /*efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */ #define HAS_STRING_H 1 /* /usr/include/string.h */