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>main
parent
51f56dedf8
commit
d990b80138
6
Makefile
6
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
|
||||
|
|
Loading…
Reference in New Issue