diff options
author | Cufi, Carles <Carles.Cufi@nordicsemi.no> | 2017-05-19 09:06:54 +0000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2017-05-20 16:17:41 +1000 |
commit | d990b8013889b816ec054c7e07a77db59c56c400 (patch) | |
tree | 8579e00e0c86028968096ed56af62c9d96a34db4 | |
parent | 51f56dedf8ea1108edc66150c0bf7e9f76b48daa (diff) | |
download | dtc-d990b8013889b816ec054c7e07a77db59c56c400.zip dtc-d990b8013889b816ec054c7e07a77db59c56c400.tar.gz dtc-d990b8013889b816ec054c7e07a77db59c56c400.tar.bz2 |
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-- | Makefile | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |