Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/powerpc: make sub-folders buildable on their own

Build breaks when executing make with run_tests for sub-folders
under powerpc. This is because, CFLAGS and GIT_VERSION macros are
defined in Makefile of toplevel powerpc folder.

make: Entering directory '/home/maddy/linux/tools/testing/selftests/powerpc/mm'
gcc hugetlb_vs_thp_test.c ../harness.c ../utils.c -o /home/maddy/selftest_output//hugetlb_vs_thp_test
hugetlb_vs_thp_test.c:6:10: fatal error: utils.h: No such file or directory
6 | #include "utils.h"
| ^~~~~~~~~
compilation terminated.

Fix this by adding the flags.mk in each sub-folder Makefile. Also remove
the CFLAGS and GIT_VERSION macros from powerpc/ folder Makefile since
the same is definied in flags.mk

Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240229093711.581230-3-maddy@linux.ibm.com

authored by

Madhavan Srinivasan and committed by
Michael Ellerman
108e5e68 5553a793

+24 -6
+1 -6
tools/testing/selftests/powerpc/Makefile
··· 7 7 8 8 ifeq ($(ARCH),powerpc) 9 9 10 - GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown") 11 - 12 - CFLAGS := -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR)/include $(CFLAGS) 13 - 14 - export CFLAGS 15 - 16 10 SUB_DIRS = alignment \ 17 11 benchmarks \ 18 12 cache_shape \ ··· 40 46 BUILD_TARGET=$(OUTPUT)/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all 41 47 42 48 include ../lib.mk 49 + include ./flags.mk 43 50 44 51 override define RUN_TESTS 45 52 +@for TARGET in $(SUB_DIRS); do \
+1
tools/testing/selftests/powerpc/alignment/Makefile
··· 3 3 4 4 top_srcdir = ../../../../.. 5 5 include ../../lib.mk 6 + include ../flags.mk 6 7 7 8 $(TEST_GEN_PROGS): ../harness.c ../utils.c
+1
tools/testing/selftests/powerpc/benchmarks/Makefile
··· 6 6 7 7 top_srcdir = ../../../../.. 8 8 include ../../lib.mk 9 + include ../flags.mk 9 10 10 11 CFLAGS += -O2 11 12
+1
tools/testing/selftests/powerpc/cache_shape/Makefile
··· 3 3 4 4 top_srcdir = ../../../../.. 5 5 include ../../lib.mk 6 + include ../flags.mk 6 7 7 8 $(TEST_GEN_PROGS): ../harness.c ../utils.c
+1
tools/testing/selftests/powerpc/copyloops/Makefile
··· 10 10 11 11 top_srcdir = ../../../../.. 12 12 include ../../lib.mk 13 + include ../flags.mk 13 14 14 15 # The loops are all 64-bit code 15 16 CFLAGS += -m64
+1
tools/testing/selftests/powerpc/dexcr/Makefile
··· 2 2 TEST_GEN_FILES := lsdexcr 3 3 4 4 include ../../lib.mk 5 + include ../flags.mk 5 6 6 7 $(OUTPUT)/hashchk_test: CFLAGS += -fno-pie $(call cc-option,-mno-rop-protect) 7 8
+1
tools/testing/selftests/powerpc/dscr/Makefile
··· 5 5 6 6 top_srcdir = ../../../../.. 7 7 include ../../lib.mk 8 + include ../flags.mk 8 9 9 10 $(OUTPUT)/dscr_default_test: LDLIBS += -lpthread 10 11 $(OUTPUT)/dscr_explicit_test: LDLIBS += -lpthread
+1
tools/testing/selftests/powerpc/eeh/Makefile
··· 7 7 8 8 top_srcdir = ../../../../.. 9 9 include ../../lib.mk 10 + include ../flags.mk
+1
tools/testing/selftests/powerpc/math/Makefile
··· 3 3 4 4 top_srcdir = ../../../../.. 5 5 include ../../lib.mk 6 + include ../flags.mk 6 7 7 8 $(TEST_GEN_PROGS): ../harness.c 8 9 $(TEST_GEN_PROGS): CFLAGS += -O2 -g -pthread -m64 -maltivec
+1
tools/testing/selftests/powerpc/mce/Makefile
··· 3 3 TEST_GEN_PROGS := inject-ra-err 4 4 5 5 include ../../lib.mk 6 + include ../flags.mk 6 7 7 8 $(TEST_GEN_PROGS): ../harness.c
+1
tools/testing/selftests/powerpc/mm/Makefile
··· 13 13 14 14 top_srcdir = ../../../../.. 15 15 include ../../lib.mk 16 + include ../flags.mk 16 17 17 18 $(TEST_GEN_PROGS): ../harness.c ../utils.c 18 19
+1
tools/testing/selftests/powerpc/nx-gzip/Makefile
··· 2 2 TEST_PROGS := nx-gzip-test.sh 3 3 4 4 include ../../lib.mk 5 + include ../flags.mk 5 6 6 7 CFLAGS = -O3 -m64 -I./include -I../include 7 8
+1
tools/testing/selftests/powerpc/papr_attributes/Makefile
··· 3 3 4 4 top_srcdir = ../../../../.. 5 5 include ../../lib.mk 6 + include ../flags.mk 6 7 7 8 $(TEST_GEN_PROGS): ../harness.c ../utils.c
+1
tools/testing/selftests/powerpc/papr_sysparm/Makefile
··· 6 6 7 7 top_srcdir = ../../../../.. 8 8 include ../../lib.mk 9 + include ../flags.mk 9 10 10 11 $(TEST_GEN_PROGS): ../harness.c ../utils.c 11 12
+1
tools/testing/selftests/powerpc/papr_vpd/Makefile
··· 6 6 7 7 top_srcdir = ../../../../.. 8 8 include ../../lib.mk 9 + include ../flags.mk 9 10 10 11 $(TEST_GEN_PROGS): ../harness.c ../utils.c 11 12
+1
tools/testing/selftests/powerpc/primitives/Makefile
··· 3 3 4 4 top_srcdir = ../../../../.. 5 5 include ../../lib.mk 6 + include ../flags.mk 6 7 7 8 CFLAGS += -I$(CURDIR) 8 9
+1
tools/testing/selftests/powerpc/ptrace/Makefile
··· 26 26 27 27 top_srcdir = ../../../../.. 28 28 include ../../lib.mk 29 + include ../flags.mk 29 30 30 31 TM_TESTS := $(patsubst %,$(OUTPUT)/%,$(TM_TESTS)) 31 32 TESTS_64 := $(patsubst %,$(OUTPUT)/%,$(TESTS_64))
+1
tools/testing/selftests/powerpc/security/Makefile
··· 6 6 top_srcdir = ../../../../.. 7 7 8 8 include ../../lib.mk 9 + include ../flags.mk 9 10 10 11 CFLAGS += $(KHDR_INCLUDES) 11 12
+1
tools/testing/selftests/powerpc/signal/Makefile
··· 10 10 11 11 top_srcdir = ../../../../.. 12 12 include ../../lib.mk 13 + include ../flags.mk 13 14 14 15 CFLAGS += -maltivec 15 16
+1
tools/testing/selftests/powerpc/stringloops/Makefile
··· 26 26 27 27 top_srcdir = ../../../../.. 28 28 include ../../lib.mk 29 + include ../flags.mk 29 30 30 31 # The loops are all 64-bit code 31 32 CFLAGS += -I$(CURDIR)
+1
tools/testing/selftests/powerpc/switch_endian/Makefile
··· 5 5 6 6 top_srcdir = ../../../../.. 7 7 include ../../lib.mk 8 + include ../flags.mk 8 9 9 10 ASFLAGS += -O2 -Wall -g -nostdlib -m64 10 11
+1
tools/testing/selftests/powerpc/syscalls/Makefile
··· 3 3 4 4 top_srcdir = ../../../../.. 5 5 include ../../lib.mk 6 + include ../flags.mk 6 7 7 8 CFLAGS += $(KHDR_INCLUDES) 8 9
+1
tools/testing/selftests/powerpc/tm/Makefile
··· 11 11 12 12 top_srcdir = ../../../../.. 13 13 include ../../lib.mk 14 + include ../flags.mk 14 15 15 16 $(TEST_GEN_PROGS): ../harness.c ../utils.c 16 17
+1
tools/testing/selftests/powerpc/vphn/Makefile
··· 3 3 4 4 top_srcdir = ../../../../.. 5 5 include ../../lib.mk 6 + include ../flags.mk 6 7 7 8 CFLAGS += -m64 -I$(CURDIR) 8 9