Re: [PATCH 2/7] selftests: add CFLAGS_EXTRA

2015-08-27 Thread Michael Ellerman
On Tue, 2015-08-25 at 20:49 +0800, Bamvor Zhang Jian wrote:
> 
> On 08/24/2015 11:48 AM, Michael Ellerman wrote:
> > On Fri, 2015-08-14 at 21:43 +0800, Bamvor Jian Zhang wrote:
> >> One may pass the "-I /path/to/headers -L /path/to/lib" through
> >> CFLAGS_EXTRA for cross compiling. mqueue could compile pass
> >> in this way when we provide the popt.h and libpopt.so. And kdbus
> >> could compile pass with sys/capability and libcap.so
> > 
> > There should be no need to define a new variable.
> > 
> > You should just update the relevant Makefiles to use CFLAGS += rather than
> > CFLAGS =. And then you can just specifiy CFLAGS on the command line.

> yeap, it works for me. There is only one line need to be changed:

OK, so please send a patch to update that Makefile.

> diff --git a/tools/testing/selftests/mqueue/Makefile 
> b/tools/testing/selftests/mqueue/Makefile
> index 0e3b41e..ca8327f 100644
> --- a/tools/testing/selftests/mqueue/Makefile
> +++ b/tools/testing/selftests/mqueue/Makefile
> @@ -1,4 +1,4 @@
> -CFLAGS = -O2
> +CFLAGS += -O2
>  
>  all:
>   $(CC) $(CFLAGS) mq_open_tests.c -o mq_open_tests -lrt

And this can be simplified to:

LDLIBS = -lrt

all: mq_open_tests

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/7] selftests: add CFLAGS_EXTRA

2015-08-27 Thread Michael Ellerman
On Tue, 2015-08-25 at 20:49 +0800, Bamvor Zhang Jian wrote:
 
 On 08/24/2015 11:48 AM, Michael Ellerman wrote:
  On Fri, 2015-08-14 at 21:43 +0800, Bamvor Jian Zhang wrote:
  One may pass the -I /path/to/headers -L /path/to/lib through
  CFLAGS_EXTRA for cross compiling. mqueue could compile pass
  in this way when we provide the popt.h and libpopt.so. And kdbus
  could compile pass with sys/capability and libcap.so
  
  There should be no need to define a new variable.
  
  You should just update the relevant Makefiles to use CFLAGS += rather than
  CFLAGS =. And then you can just specifiy CFLAGS on the command line.

 yeap, it works for me. There is only one line need to be changed:

OK, so please send a patch to update that Makefile.

 diff --git a/tools/testing/selftests/mqueue/Makefile 
 b/tools/testing/selftests/mqueue/Makefile
 index 0e3b41e..ca8327f 100644
 --- a/tools/testing/selftests/mqueue/Makefile
 +++ b/tools/testing/selftests/mqueue/Makefile
 @@ -1,4 +1,4 @@
 -CFLAGS = -O2
 +CFLAGS += -O2
  
  all:
   $(CC) $(CFLAGS) mq_open_tests.c -o mq_open_tests -lrt

And this can be simplified to:

LDLIBS = -lrt

all: mq_open_tests

cheers


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/7] selftests: add CFLAGS_EXTRA

2015-08-25 Thread Bamvor Zhang Jian


On 08/24/2015 11:48 AM, Michael Ellerman wrote:
> On Fri, 2015-08-14 at 21:43 +0800, Bamvor Jian Zhang wrote:
>> One may pass the "-I /path/to/headers -L /path/to/lib" through
>> CFLAGS_EXTRA for cross compiling. mqueue could compile pass
>> in this way when we provide the popt.h and libpopt.so. And kdbus
>> could compile pass with sys/capability and libcap.so
> 
> There should be no need to define a new variable.
> 
> You should just update the relevant Makefiles to use CFLAGS += rather than
> CFLAGS =. And then you can just specifiy CFLAGS on the command line.
yeap, it works for me. There is only one line need to be changed:
diff --git a/tools/testing/selftests/mqueue/Makefile 
b/tools/testing/selftests/mqueue/Makefile
index 0e3b41e..ca8327f 100644
--- a/tools/testing/selftests/mqueue/Makefile
+++ b/tools/testing/selftests/mqueue/Makefile
@@ -1,4 +1,4 @@
-CFLAGS = -O2
+CFLAGS += -O2
 
 all:
$(CC) $(CFLAGS) mq_open_tests.c -o mq_open_tests -lrt

regards

bamvor
> 
> cheers
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/7] selftests: add CFLAGS_EXTRA

2015-08-25 Thread Bamvor Zhang Jian


On 08/24/2015 11:48 AM, Michael Ellerman wrote:
 On Fri, 2015-08-14 at 21:43 +0800, Bamvor Jian Zhang wrote:
 One may pass the -I /path/to/headers -L /path/to/lib through
 CFLAGS_EXTRA for cross compiling. mqueue could compile pass
 in this way when we provide the popt.h and libpopt.so. And kdbus
 could compile pass with sys/capability and libcap.so
 
 There should be no need to define a new variable.
 
 You should just update the relevant Makefiles to use CFLAGS += rather than
 CFLAGS =. And then you can just specifiy CFLAGS on the command line.
yeap, it works for me. There is only one line need to be changed:
diff --git a/tools/testing/selftests/mqueue/Makefile 
b/tools/testing/selftests/mqueue/Makefile
index 0e3b41e..ca8327f 100644
--- a/tools/testing/selftests/mqueue/Makefile
+++ b/tools/testing/selftests/mqueue/Makefile
@@ -1,4 +1,4 @@
-CFLAGS = -O2
+CFLAGS += -O2
 
 all:
$(CC) $(CFLAGS) mq_open_tests.c -o mq_open_tests -lrt

regards

bamvor
 
 cheers
 
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/7] selftests: add CFLAGS_EXTRA

2015-08-23 Thread Michael Ellerman
On Fri, 2015-08-14 at 21:43 +0800, Bamvor Jian Zhang wrote:
> One may pass the "-I /path/to/headers -L /path/to/lib" through
> CFLAGS_EXTRA for cross compiling. mqueue could compile pass
> in this way when we provide the popt.h and libpopt.so. And kdbus
> could compile pass with sys/capability and libcap.so

There should be no need to define a new variable.

You should just update the relevant Makefiles to use CFLAGS += rather than
CFLAGS =. And then you can just specifiy CFLAGS on the command line.

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/7] selftests: add CFLAGS_EXTRA

2015-08-23 Thread Michael Ellerman
On Fri, 2015-08-14 at 21:43 +0800, Bamvor Jian Zhang wrote:
 One may pass the -I /path/to/headers -L /path/to/lib through
 CFLAGS_EXTRA for cross compiling. mqueue could compile pass
 in this way when we provide the popt.h and libpopt.so. And kdbus
 could compile pass with sys/capability and libcap.so

There should be no need to define a new variable.

You should just update the relevant Makefiles to use CFLAGS += rather than
CFLAGS =. And then you can just specifiy CFLAGS on the command line.

cheers


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/7] selftests: add CFLAGS_EXTRA

2015-08-14 Thread Bamvor Jian Zhang
One may pass the "-I /path/to/headers -L /path/to/lib" through
CFLAGS_EXTRA for cross compiling. mqueue could compile pass
in this way when we provide the popt.h and libpopt.so. And kdbus
could compile pass with sys/capability and libcap.so

Sed-off-by: Bamvor Jian Zhang 

--
Originally, I want to add something like --sysroot to the compile
which mean the user need to provide the full filesystem including
headers and library for compiler. With CFLAGS_EXTRA, the user only
need to provide the minimal headers and/or librarys for building.
---
 tools/testing/selftests/lib.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index ee412ba..1acfd02 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -2,6 +2,8 @@
 # Makefile can operate with or without the kbuild infrastructure.
 CC := $(CROSS_COMPILE)gcc
 
+CFLAGS += $(CFLAGS_EXTRA)
+
 define RUN_TESTS
@for TEST in $(TEST_PROGS); do \
(./$$TEST && echo "selftests: $$TEST [PASS]") || echo 
"selftests: $$TEST [FAIL]"; \
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/7] selftests: add CFLAGS_EXTRA

2015-08-14 Thread Bamvor Jian Zhang
One may pass the -I /path/to/headers -L /path/to/lib through
CFLAGS_EXTRA for cross compiling. mqueue could compile pass
in this way when we provide the popt.h and libpopt.so. And kdbus
could compile pass with sys/capability and libcap.so

Sed-off-by: Bamvor Jian Zhang bamvor.zhangj...@linaro.org

--
Originally, I want to add something like --sysroot to the compile
which mean the user need to provide the full filesystem including
headers and library for compiler. With CFLAGS_EXTRA, the user only
need to provide the minimal headers and/or librarys for building.
---
 tools/testing/selftests/lib.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index ee412ba..1acfd02 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -2,6 +2,8 @@
 # Makefile can operate with or without the kbuild infrastructure.
 CC := $(CROSS_COMPILE)gcc
 
+CFLAGS += $(CFLAGS_EXTRA)
+
 define RUN_TESTS
@for TEST in $(TEST_PROGS); do \
(./$$TEST  echo selftests: $$TEST [PASS]) || echo 
selftests: $$TEST [FAIL]; \
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/