Commit 108e5e68 authored by Madhavan Srinivasan's avatar Madhavan Srinivasan Committed by Michael Ellerman

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: default avatarMadhavan Srinivasan <maddy@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240229093711.581230-3-maddy@linux.ibm.com
parent 5553a793
......@@ -7,12 +7,6 @@ ARCH := $(shell echo $(ARCH) | sed -e s/ppc.*/powerpc/)
ifeq ($(ARCH),powerpc)
GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown")
CFLAGS := -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR)/include $(CFLAGS)
export CFLAGS
SUB_DIRS = alignment \
benchmarks \
cache_shape \
......@@ -46,6 +40,7 @@ $(SUB_DIRS):
BUILD_TARGET=$(OUTPUT)/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all
include ../lib.mk
include ./flags.mk
override define RUN_TESTS
+@for TARGET in $(SUB_DIRS); do \
......
......@@ -3,5 +3,6 @@ TEST_GEN_PROGS := copy_first_unaligned alignment_handler
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
$(TEST_GEN_PROGS): ../harness.c ../utils.c
......@@ -6,6 +6,7 @@ TEST_FILES := settings
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
CFLAGS += -O2
......
......@@ -3,5 +3,6 @@ TEST_GEN_PROGS := cache_shape
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
$(TEST_GEN_PROGS): ../harness.c ../utils.c
......@@ -10,6 +10,7 @@ EXTRA_SOURCES := validate.c ../harness.c stubs.S
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
# The loops are all 64-bit code
CFLAGS += -m64
......
......@@ -2,6 +2,7 @@ TEST_GEN_PROGS := hashchk_test
TEST_GEN_FILES := lsdexcr
include ../../lib.mk
include ../flags.mk
$(OUTPUT)/hashchk_test: CFLAGS += -fno-pie $(call cc-option,-mno-rop-protect)
......
......@@ -5,6 +5,7 @@ TEST_GEN_PROGS := dscr_default_test dscr_explicit_test dscr_user_test \
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
$(OUTPUT)/dscr_default_test: LDLIBS += -lpthread
$(OUTPUT)/dscr_explicit_test: LDLIBS += -lpthread
......
......@@ -7,3 +7,4 @@ TEST_FILES := eeh-functions.sh settings
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
......@@ -3,6 +3,7 @@ TEST_GEN_PROGS := fpu_syscall fpu_preempt fpu_signal fpu_denormal vmx_syscall vm
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
$(TEST_GEN_PROGS): ../harness.c
$(TEST_GEN_PROGS): CFLAGS += -O2 -g -pthread -m64 -maltivec
......
......@@ -3,5 +3,6 @@
TEST_GEN_PROGS := inject-ra-err
include ../../lib.mk
include ../flags.mk
$(TEST_GEN_PROGS): ../harness.c
......@@ -13,6 +13,7 @@ TEST_GEN_FILES := tempfile
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
$(TEST_GEN_PROGS): ../harness.c ../utils.c
......
......@@ -2,6 +2,7 @@ TEST_GEN_FILES := gzfht_test gunz_test
TEST_PROGS := nx-gzip-test.sh
include ../../lib.mk
include ../flags.mk
CFLAGS = -O3 -m64 -I./include -I../include
......
......@@ -3,5 +3,6 @@ TEST_GEN_PROGS := attr_test
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
$(TEST_GEN_PROGS): ../harness.c ../utils.c
\ No newline at end of file
$(TEST_GEN_PROGS): ../harness.c ../utils.c
......@@ -6,6 +6,7 @@ TEST_GEN_PROGS := papr_sysparm
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
$(TEST_GEN_PROGS): ../harness.c ../utils.c
......
......@@ -6,6 +6,7 @@ TEST_GEN_PROGS := papr_vpd
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
$(TEST_GEN_PROGS): ../harness.c ../utils.c
......
......@@ -3,6 +3,7 @@ TEST_GEN_PROGS := load_unaligned_zeropad
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
CFLAGS += -I$(CURDIR)
......
......@@ -26,6 +26,7 @@ LOCAL_HDRS += $(patsubst %,$(selfdir)/powerpc/ptrace/%,$(wildcard *.h))
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
TM_TESTS := $(patsubst %,$(OUTPUT)/%,$(TM_TESTS))
TESTS_64 := $(patsubst %,$(OUTPUT)/%,$(TESTS_64))
......
......@@ -6,6 +6,7 @@ TEST_PROGS := mitigation-patching.sh
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
CFLAGS += $(KHDR_INCLUDES)
......
......@@ -10,6 +10,7 @@ TEST_FILES := settings
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
CFLAGS += -maltivec
......
......@@ -26,6 +26,7 @@ endif
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
# The loops are all 64-bit code
CFLAGS += -I$(CURDIR)
......
......@@ -5,6 +5,7 @@ EXTRA_CLEAN = $(OUTPUT)/*.o $(OUTPUT)/check-reversed.S
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
ASFLAGS += -O2 -Wall -g -nostdlib -m64
......
......@@ -3,6 +3,7 @@ TEST_GEN_PROGS := ipc_unmuxed rtas_filter
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
CFLAGS += $(KHDR_INCLUDES)
......
......@@ -11,6 +11,7 @@ TEST_FILES := settings
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
$(TEST_GEN_PROGS): ../harness.c ../utils.c
......
......@@ -3,6 +3,7 @@ TEST_GEN_PROGS := test-vphn
top_srcdir = ../../../../..
include ../../lib.mk
include ../flags.mk
CFLAGS += -m64 -I$(CURDIR)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment