[v2] selftests: sync: missing CFLAGS while compiling

Message ID 1517955821-11511-1-git-send-email-daniel.diaz@linaro.org
State New
Headers show
Series
  • [v2] selftests: sync: missing CFLAGS while compiling
Related show

Commit Message

Daniel Díaz Feb. 6, 2018, 10:23 p.m.
From: Anders Roxell <anders.roxell@linaro.org>


Based on patch: https://patchwork.kernel.org/patch/10042045/

arch64-linux-gnu-gcc -c sync.c -o sync/sync.o
sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory
 #include <linux/sync_file.h>
                             ^
CFLAGS is not used during the compile step, so the system instead of
kernel headers are used.  Fix this by adding CFLAGS to the OBJS compile
rule.

Reported-by: Lei Yang <Lei.Yang@windriver.com>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>

---
 tools/testing/selftests/sync/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.7.4

Comments

Shuah Khan Feb. 13, 2018, 9:25 p.m. | #1
On 02/06/2018 03:23 PM, Daniel Díaz wrote:
> From: Anders Roxell <anders.roxell@linaro.org>

> 

> Based on patch: https://patchwork.kernel.org/patch/10042045/

> 

> arch64-linux-gnu-gcc -c sync.c -o sync/sync.o

> sync.c:42:29: fatal error: linux/sync_file.h: No such file or directory

>  #include <linux/sync_file.h>

>                              ^

> CFLAGS is not used during the compile step, so the system instead of

> kernel headers are used.  Fix this by adding CFLAGS to the OBJS compile

> rule.

> 

> Reported-by: Lei Yang <Lei.Yang@windriver.com>

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>

> Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>

> ---

>  tools/testing/selftests/sync/Makefile | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/tools/testing/selftests/sync/Makefile b/tools/testing/selftests/sync/Makefile

> index b3c8ba3..d0121a8 100644

> --- a/tools/testing/selftests/sync/Makefile

> +++ b/tools/testing/selftests/sync/Makefile

> @@ -30,7 +30,7 @@ $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)

>  	$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)

>  

>  $(OBJS): $(OUTPUT)/%.o: %.c

> -	$(CC) -c $^ -o $@

> +	$(CC) -c $^ -o $@ $(CFLAGS)

>  

>  $(TESTS): $(OUTPUT)/%.o: %.c

>  	$(CC) -c $^ -o $@

> 


Thanks for the patch. Applied to linux-kselftest fixes for 4.16-rc3

thanks,
-- Shuah

Patch

diff --git a/tools/testing/selftests/sync/Makefile b/tools/testing/selftests/sync/Makefile
index b3c8ba3..d0121a8 100644
--- a/tools/testing/selftests/sync/Makefile
+++ b/tools/testing/selftests/sync/Makefile
@@ -30,7 +30,7 @@  $(TEST_CUSTOM_PROGS): $(TESTS) $(OBJS)
 	$(CC) -o $(TEST_CUSTOM_PROGS) $(OBJS) $(TESTS) $(CFLAGS) $(LDFLAGS)
 
 $(OBJS): $(OUTPUT)/%.o: %.c
-	$(CC) -c $^ -o $@
+	$(CC) -c $^ -o $@ $(CFLAGS)
 
 $(TESTS): $(OUTPUT)/%.o: %.c
 	$(CC) -c $^ -o $@