Skip to content

Commit a738a4c

Browse files
roxellshuahkh
authored andcommitted
selftests: cgroup: build error multiple outpt files
When building selftests/cgroup: with clang the following error are seen: clang -Wall -pthread test_memcontrol.c cgroup_util.c ../clone3/clone3_selftests.h -o .../builds/current/kselftest/cgroup/test_memcontrol clang: error: cannot specify -o when generating multiple output files make[3]: *** [../lib.mk:146: .../builds/current/kselftest/cgroup/test_memcontrol] Error 1 Rework to add the header files to LOCAL_HDRS before including ../lib.mk, since the dependency is evaluated in '$(OUTPUT)/%:%.c $(LOCAL_HDRS)' in file lib.mk. Suggested-by: Arnd Bergmann <[email protected]> Signed-off-by: Anders Roxell <[email protected]> Acked-by: Christian Brauner <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 009482c commit a738a4c

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tools/testing/selftests/cgroup/Makefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ TEST_GEN_PROGS += test_core
1111
TEST_GEN_PROGS += test_freezer
1212
TEST_GEN_PROGS += test_kill
1313

14+
LOCAL_HDRS += $(selfdir)/clone3/clone3_selftests.h $(selfdir)/pidfd/pidfd.h
15+
1416
include ../lib.mk
1517

16-
$(OUTPUT)/test_memcontrol: cgroup_util.c ../clone3/clone3_selftests.h
17-
$(OUTPUT)/test_kmem: cgroup_util.c ../clone3/clone3_selftests.h
18-
$(OUTPUT)/test_core: cgroup_util.c ../clone3/clone3_selftests.h
19-
$(OUTPUT)/test_freezer: cgroup_util.c ../clone3/clone3_selftests.h
20-
$(OUTPUT)/test_kill: cgroup_util.c ../clone3/clone3_selftests.h ../pidfd/pidfd.h
18+
$(OUTPUT)/test_memcontrol: cgroup_util.c
19+
$(OUTPUT)/test_kmem: cgroup_util.c
20+
$(OUTPUT)/test_core: cgroup_util.c
21+
$(OUTPUT)/test_freezer: cgroup_util.c
22+
$(OUTPUT)/test_kill: cgroup_util.c

tools/testing/selftests/lib.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ endif
141141
# Selftest makefiles can override those targets by setting
142142
# OVERRIDE_TARGETS = 1.
143143
ifeq ($(OVERRIDE_TARGETS),)
144-
LOCAL_HDRS := $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h
144+
LOCAL_HDRS += $(selfdir)/kselftest_harness.h $(selfdir)/kselftest.h
145145
$(OUTPUT)/%:%.c $(LOCAL_HDRS)
146146
$(LINK.c) $(filter-out $(LOCAL_HDRS),$^) $(LDLIBS) -o $@
147147

0 commit comments

Comments
 (0)