liboptcfg

changeset 5:aca7267dfee0 tip

fixed cross-compilation with mingw-w64
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 31 Aug 2017 05:59:19 +0300
parents a6f127f3408d
children
files Makefile src/optcfg.c
diffstat 2 files changed, 14 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/Makefile	Wed Jul 27 05:05:45 2016 +0300
     1.2 +++ b/Makefile	Thu Aug 31 05:59:19 2017 +0300
     1.3 @@ -11,12 +11,18 @@
     1.4  
     1.5  alib = lib$(name).a
     1.6  
     1.7 +sodir = lib
     1.8 +
     1.9  CFLAGS = -pedantic -Wall -g
    1.10  
    1.11 -sys := $(shell uname -s)
    1.12 +sys := $(shell uname -s | sed 's/MINGW.*/mingw/')
    1.13  ifeq ($(sys), Darwin)
    1.14  	solib = lib$(name).dylib
    1.15  	shared = -dynamiclib
    1.16 +else ifeq ($(sys), mingw)
    1.17 +	solib = lib$(name).dll
    1.18 +	shared = -shared
    1.19 +	sodir = bin
    1.20  else
    1.21  	ldname = lib$(name).so
    1.22  	soname = lib$(name).so.$(so_major)
    1.23 @@ -40,11 +46,11 @@
    1.24  
    1.25  .PHONY: install
    1.26  install:
    1.27 -	mkdir -p $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
    1.28 +	mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/include $(DESTDIR)$(PREFIX)/lib
    1.29  	cp src/optcfg.h $(DESTDIR)$(PREFIX)/include/optcfg.h
    1.30  	cp $(alib) $(DESTDIR)$(PREFIX)/lib/$(alib)
    1.31 -	cp $(solib) $(DESTDIR)$(PREFIX)/lib/$(solib)
    1.32 -	[ -n "$(soname)" ] && cd $(DESTDIR)$(PREFIX)/lib && \
    1.33 +	cp $(solib) $(DESTDIR)$(PREFIX)/$(sodir)/$(solib)
    1.34 +	[ -n "$(soname)" ] && cd $(DESTDIR)$(PREFIX)/$(sodir) && \
    1.35  		rm -f $(soname) $(ldname) && \
    1.36  		ln -s $(solib) $(soname) && \
    1.37  		ln -s $(soname) $(ldname) || true
    1.38 @@ -53,7 +59,7 @@
    1.39  uninstall:
    1.40  	rm -f $(DESTDIR)$(PREFIX)/include/optcfg.h
    1.41  	rm -f $(DESTDIR)$(PREFIX)/lib/$(alib)
    1.42 -	rm -f $(DESTDIR)$(PREFIX)/lib/$(solib)
    1.43 +	rm -f $(DESTDIR)$(PREFIX)/$(sodir)/$(solib)
    1.44  	[ -n "$(soname)" ] && \
    1.45 -		rm -f $(DESTDIR)$(PREFIX)/lib/$(soname) && \
    1.46 -		rm -f $(DESTDIR)$(PREFIX)/lib/$(ldname) || true
    1.47 +		rm -f $(DESTDIR)$(PREFIX)/$(sodir)/$(soname) && \
    1.48 +		rm -f $(DESTDIR)$(PREFIX)/$(sodir)/$(ldname) || true
     2.1 --- a/src/optcfg.c	Wed Jul 27 05:05:45 2016 +0300
     2.2 +++ b/src/optcfg.c	Thu Aug 31 05:59:19 2017 +0300
     2.3 @@ -2,7 +2,7 @@
     2.4  #include <stdlib.h>
     2.5  #include <string.h>
     2.6  #include <ctype.h>
     2.7 -#ifdef _MSC_VER
     2.8 +#ifdef WIN32
     2.9  #include <malloc.h>
    2.10  #else
    2.11  #include <alloca.h>