History

Merge tag 'landlock-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux

Pull landlock fix from Mickaël Salaün: "Fix out-of-tree builds for Landlock tests" * tag 'landlock-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux: selftests/landlock: Fix out-of-tree builds

Linus Torvalds committed 4 years ago

Commit 9395cd72 parents a7b7751 a5254052 files · +14 −9Browse files

Unified · Split

2 files
  1. tools/testing/selftests/landlock/Makefile +10 −9
  2. tools/testing/selftests/lib.mk +4 −0
tools/testing/selftests/landlock/Makefile+10−9
@@ -1,6 +1,11 @@
11 # SPDX-License-Identifier: GPL-2.0
2+#
3+# First run: make -C ../../../.. headers_install
24
35 CFLAGS += -Wall -O2 $(KHDR_INCLUDES)
6+LDLIBS += -lcap
7+
8+LOCAL_HDRS += common.h
49
510 src_test := $(wildcard *_test.c)
611
@@ -8,14 +13,10 @@ TEST_GEN_PROGS := $(src_test:.c=) · 1 unmodified line
813
914 TEST_GEN_PROGS_EXTENDED := true
1015
11−OVERRIDE_TARGETS := 1
12−top_srcdir := ../../../..
13−include ../lib.mk
14−
15−khdr_dir = $(top_srcdir)/usr/include
16+# Static linking for short targets:
17+$(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
1618
17−$(OUTPUT)/true: true.c
18− $(LINK.c) $< $(LDLIBS) -o $@ -static
19+include ../lib.mk
1920
20−$(OUTPUT)/%_test: %_test.c $(khdr_dir)/linux/landlock.h ../kselftest_harness.h common.h
21− $(LINK.c) $< $(LDLIBS) -o $@ -lcap -I$(khdr_dir)
21+# Static linking for targets with $(OUTPUT)/ prefix:
22+$(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
tools/testing/selftests/lib.mk+4−0
@@ -42,6 +42,10 @@ endif · 41 unmodified lines
4242 selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST))))
4343 top_srcdir = $(selfdir)/../../..
4444
45+ifeq ($(KHDR_INCLUDES),)
46+KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
47+endif
48+
4549 # The following are built by lib.mk common compile rules.
4650 # TEST_CUSTOM_PROGS should be used by tests that require
4751 # custom build rule and prevent common build rule use.