Skip to content

Commit

Permalink
Merge tag 'landlock-6.0-rc7' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/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
  • Loading branch information
Linus Torvalds committed Sep 23, 2022
2 parents a7b7751 + a525405 commit 9395cd7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tools/testing/selftests/landlock/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# 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)

TEST_GEN_PROGS := $(src_test:.c=)

TEST_GEN_PROGS_EXTENDED := true

OVERRIDE_TARGETS := 1
top_srcdir := ../../../..
include ../lib.mk

khdr_dir = $(top_srcdir)/usr/include
# Static linking for short targets:
$(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static

$(OUTPUT)/true: true.c
$(LINK.c) $< $(LDLIBS) -o $@ -static
include ../lib.mk

$(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
4 changes: 4 additions & 0 deletions tools/testing/selftests/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9395cd7

Please sign in to comment.