aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCufi, Carles <Carles.Cufi@nordicsemi.no>2017-05-19 09:06:54 +0000
committerDavid Gibson <david@gibson.dropbear.id.au>2017-05-20 16:17:41 +1000
commitd990b8013889b816ec054c7e07a77db59c56c400 (patch)
tree8579e00e0c86028968096ed56af62c9d96a34db4
parent51f56dedf8ea1108edc66150c0bf7e9f76b48daa (diff)
downloaddtc-d990b8013889b816ec054c7e07a77db59c56c400.tar.gz
Makefile: Fix build on MSYS2 and Cygwin
The host compiler on MSYS2 and Cygwin does not allow the -fPIC option, issuing a warning that is treated as an error and stops the build. Detect whether we're running under MSYS2 or Cygwin and avoid adding -fPIC to prevent the error from happening. Tested on Linux, MSYS2 and Cygwin. Signed-off-by: Carles Cufi <carles.cufi@gmail.com> [dwg: Added explicit empty CFLAGS for clarity] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--Makefile6
1 files changed, 5 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 7fa2be8..43957e6 100644
--- a/Makefile
+++ b/Makefile
@@ -33,12 +33,16 @@ LIBDIR = $(PREFIX)/lib
INCLUDEDIR = $(PREFIX)/include
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
- sed -e 's/\(cygwin\).*/cygwin/')
+ sed -e 's/\(cygwin\|msys\).*/\1/')
ifeq ($(HOSTOS),darwin)
SHAREDLIB_EXT = dylib
SHAREDLIB_CFLAGS = -fPIC
SHAREDLIB_LDFLAGS = -fPIC -dynamiclib -Wl,-install_name -Wl,
+else ifeq ($(HOSTOS),$(filter $(HOSTOS),msys cygwin))
+SHAREDLIB_EXT = so
+SHAREDLIB_CFLAGS =
+SHAREDLIB_LDFLAGS = -shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
else
SHAREDLIB_EXT = so
SHAREDLIB_CFLAGS = -fPIC