[dpdk-dev] e1000: fix build with clang

Message ID 1464101290-28547-1-git-send-email-h.mikita89@gmail.com (mailing list archive)
State Superseded, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Hiroyuki Mikita May 24, 2016, 2:48 p.m. UTC
  GCC_VERSION is empty in case of clang:
	/bin/sh: line 0: test: -ge: unary operator expected

It is the same issue as http://dpdk.org/dev/patchwork/patch/5994/

Fixes: 366113dbfb69 ("e1000: suppress misleading indentation warning")

Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
---
 drivers/net/e1000/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Wenzhuo Lu May 25, 2016, 12:35 a.m. UTC | #1
Hi,


> -----Original Message-----
> From: Hiroyuki Mikita [mailto:h.mikita89@gmail.com]
> Sent: Tuesday, May 24, 2016 10:48 PM
> To: Lu, Wenzhuo
> Cc: dev@dpdk.org
> Subject: [PATCH] e1000: fix build with clang
> 
> GCC_VERSION is empty in case of clang:
> 	/bin/sh: line 0: test: -ge: unary operator expected
> 
> It is the same issue as http://dpdk.org/dev/patchwork/patch/5994/
> 
> Fixes: 366113dbfb69 ("e1000: suppress misleading indentation warning")
> 
> Signed-off-by: Hiroyuki Mikita <h.mikita89@gmail.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
  
Thomas Monjalon May 25, 2016, noon UTC | #2
2016-05-24 23:48, Hiroyuki Mikita:
> GCC_VERSION is empty in case of clang:
> 	/bin/sh: line 0: test: -ge: unary operator expected
> 
> It is the same issue as http://dpdk.org/dev/patchwork/patch/5994/

I did this patch but it looks broken for cross-compiler.
Please fix it. Thanks
  

Patch

diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index f4879e6..d580dea 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -50,11 +50,11 @@  ifeq ($(CC), icc)
 CFLAGS_BASE_DRIVER = -wd177 -wd181 -wd188 -wd869 -wd2259
 else
 #
-# CFLAGS for gcc
+# CFLAGS for gcc/clang
 #
 CFLAGS_BASE_DRIVER = -Wno-uninitialized -Wno-unused-parameter
 CFLAGS_BASE_DRIVER += -Wno-unused-variable
-ifeq ($(shell test $(GCC_VERSION) -ge 60 && echo 1), 1)
+ifeq ($(shell test $(CC) = gcc && test $(GCC_VERSION) -ge 60 && echo 1), 1)
 CFLAGS_BASE_DRIVER += -Wno-misleading-indentation
 endif
 endif