about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarko Durkovic <marko@miding.de>2014-12-09T11·22+0100
committerMarko Durkovic <marko@miding.de>2014-12-09T12·00+0100
commit4872677ffafce60bf863583804bb5700601ad7a4 (patch)
tree33c15a5f64199ee8f8a2fb661f0532d6c18dfe3a
parent936f68668c191ca6f904dd868fe364aeba1d531f (diff)
Fix library handling on Cygwin
1. Shared lib extension is .dll
2. Shared libs are installed to $(prefix)/bin
3. Linker does not support -z flag
-rw-r--r--mk/libraries.mk16
1 files changed, 13 insertions, 3 deletions
diff --git a/mk/libraries.mk b/mk/libraries.mk
index 3b91c699e65a..3b292e988dca 100644
--- a/mk/libraries.mk
+++ b/mk/libraries.mk
@@ -3,7 +3,11 @@ libs-list :=
 ifeq ($(OS), Darwin)
   SO_EXT = dylib
 else
-  SO_EXT = so
+  ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
+    SO_EXT = dll
+  else
+    SO_EXT = so
+  endif
 endif
 
 # Build a library with symbolic name $(1).  The library is defined by
@@ -50,7 +54,11 @@ define build-library
   $(1)_OBJS := $$(addsuffix .o, $$(basename $$(_srcs)))
   _libs := $$(foreach lib, $$($(1)_LIBS), $$($$(lib)_PATH))
 
-  $(1)_INSTALL_DIR ?= $$(libdir)
+  ifeq (CYGWIN,$(findstring CYGWIN,$(OS)))
+    $(1)_INSTALL_DIR ?= $$(bindir)
+  else
+    $(1)_INSTALL_DIR ?= $$(libdir)
+  endif
 
   $(1)_LDFLAGS_USE :=
   $(1)_LDFLAGS_USE_INSTALLED :=
@@ -65,7 +73,9 @@ define build-library
       endif
     else
       ifneq ($(OS), Darwin)
-        $(1)_LDFLAGS += -Wl,-z,defs
+        ifneq (CYGWIN,$(findstring CYGWIN,$(OS)))
+          $(1)_LDFLAGS += -Wl,-z,defs
+        endif
       endif
     endif