Landlock fix for v6.0-rc7

-----BEGIN PGP SIGNATURE-----
 
 iIYEABYIAC4WIQSVyBthFV4iTW/VU1/l49DojIL20gUCYy2I2hAcbWljQGRpZ2lr
 b2QubmV0AAoJEOXj0OiMgvbSO6IA/0JQ+wSbd7M2LgSoaXqSf5jgOTtcwyN5i7CR
 1t6UwB9AAQCkE5iX3+BQpUAMyBTJinISvjf9C0vNyWiLyUlDSxgPBw==
 =CqGg
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2022-09-23 08:59:16 -07:00
commit 9395cd7cef
2 changed files with 14 additions and 9 deletions

View File

@ -1,6 +1,11 @@
# SPDX-License-Identifier: GPL-2.0
#
# First run: make -C ../../../.. headers_install
CFLAGS += -Wall -O2 $(KHDR_INCLUDES)
LDLIBS += -lcap
LOCAL_HDRS += common.h
src_test := $(wildcard *_test.c)
@ -8,14 +13,10 @@ TEST_GEN_PROGS := $(src_test:.c=)
TEST_GEN_PROGS_EXTENDED := true
OVERRIDE_TARGETS := 1
top_srcdir := ../../../..
# Static linking for short targets:
$(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
include ../lib.mk
khdr_dir = $(top_srcdir)/usr/include
$(OUTPUT)/true: true.c
$(LINK.c) $< $(LDLIBS) -o $@ -static
$(OUTPUT)/%_test: %_test.c $(khdr_dir)/linux/landlock.h ../kselftest_harness.h common.h
$(LINK.c) $< $(LDLIBS) -o $@ -lcap -I$(khdr_dir)
# Static linking for targets with $(OUTPUT)/ prefix:
$(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static

View File

@ -42,6 +42,10 @@ endif
selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST))))
top_srcdir = $(selfdir)/../../..
ifeq ($(KHDR_INCLUDES),)
KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
endif
# The following are built by lib.mk common compile rules.
# TEST_CUSTOM_PROGS should be used by tests that require
# custom build rule and prevent common build rule use.