devicetree-compiler.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] Makefile: Fix build on MSYS2 and Cygwin
@ 2017-05-19  9:06 Cufi, Carles
       [not found] ` <ee8fd5de5a5e47d5af81ecbf352f506a-hR+23Fw+YnFSHonuZl5R5Q@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Cufi, Carles @ 2017-05-19  9:06 UTC (permalink / raw)
  To: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org,
	jdl-CYoMK+44s/E@public.gmane.org, Andy Gross, Kumar Gala

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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 7fa2be8..a3eb585 100644
--- a/Makefile
+++ b/Makefile
@@ -33,12 +33,15 @@ 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_LDFLAGS = -shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
 else
 SHAREDLIB_EXT     = so
 SHAREDLIB_CFLAGS  = -fPIC
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v4] Makefile: Fix build on MSYS2 and Cygwin
       [not found] ` <ee8fd5de5a5e47d5af81ecbf352f506a-hR+23Fw+YnFSHonuZl5R5Q@public.gmane.org>
@ 2017-05-20  6:18   ` david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+
  0 siblings, 0 replies; 2+ messages in thread
From: david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+ @ 2017-05-20  6:18 UTC (permalink / raw)
  To: Cufi, Carles
  Cc: devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	jdl-CYoMK+44s/E@public.gmane.org, Andy Gross, Kumar Gala

[-- Attachment #1: Type: text/plain, Size: 1491 bytes --]

On Fri, May 19, 2017 at 09:06:54AM +0000, Cufi, Carles wrote:
> 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Applied, thanks.

> ---
>  Makefile | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 7fa2be8..a3eb585 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -33,12 +33,15 @@ 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_LDFLAGS = -shared -Wl,--version-script=$(LIBFDT_version) -Wl,-soname,
>  else
>  SHAREDLIB_EXT     = so
>  SHAREDLIB_CFLAGS  = -fPIC

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-20  6:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-19  9:06 [PATCH v4] Makefile: Fix build on MSYS2 and Cygwin Cufi, Carles
     [not found] ` <ee8fd5de5a5e47d5af81ecbf352f506a-hR+23Fw+YnFSHonuZl5R5Q@public.gmane.org>
2017-05-20  6:18   ` david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).