From 523c28a2155d1b56c4cf6314a792bcb0b70a76fc Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Mon, 6 Feb 2017 21:53:22 +0100 Subject: [PATCH] added support for Cygwin. Closes #8 --- _gnu-make/Makefile | 12 ++++++++++++ src/whereami.c | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/_gnu-make/Makefile b/_gnu-make/Makefile index 7efefdf..cf5954b 100644 --- a/_gnu-make/Makefile +++ b/_gnu-make/Makefile @@ -28,6 +28,10 @@ ifeq ($(platform),) override platform := freebsd override architecture := $(__uname_m) endif + ifeq ($(findstring cygwin,$(__uname_s)),cygwin) + override platform := cygwin + override architecture := $(__uname_m) + endif endif ifeq ($(architecture),) override architecture := unknown-architecture @@ -56,6 +60,11 @@ ifeq ($(platform),freebsd) CFLAGS += -fpic CXXFLAGS += -fpic endif +ifeq ($(platform),cygwin) +LDFLAGS += -ldl +CFLAGS += -D_XOPEN_SOURCE=500 -fpic +CXXFLAGS += -fpic +endif ifeq ($(platform),mac) libsuffix := .dylib @@ -69,6 +78,9 @@ endif ifeq ($(platform),freebsd) libsuffix := .so endif +ifeq ($(platform),cygwin) +libsuffix := .dll +endif .PHONY: build-executable build: build-executable diff --git a/src/whereami.c b/src/whereami.c index 289aeb1..be6d259 100644 --- a/src/whereami.c +++ b/src/whereami.c @@ -158,7 +158,7 @@ int WAI_PREFIX(getModulePath)(char* out, int capacity, int* dirname_length) return length; } -#elif defined(__linux__) +#elif defined(__linux__) || defined(__CYGWIN__) #include #include