18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci# Copyright (C) 2019 ARM Limited
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci# Additional include paths needed by kselftest.h and local headers
58c2ecf20Sopenharmony_ciCFLAGS += -D_GNU_SOURCE -std=gnu99 -I.
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ciSRCS := $(filter-out testcases/testcases.c,$(wildcard testcases/*.c))
88c2ecf20Sopenharmony_ciPROGS := $(patsubst %.c,%,$(SRCS))
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci# Generated binaries to be installed by top KSFT script
118c2ecf20Sopenharmony_ciTEST_GEN_PROGS := $(notdir $(PROGS))
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci# Get Kernel headers installed and use them.
148c2ecf20Sopenharmony_ciKSFT_KHDR_INSTALL := 1
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci# Including KSFT lib.mk here will also mangle the TEST_GEN_PROGS list
178c2ecf20Sopenharmony_ci# to account for any OUTPUT target-dirs optionally provided by
188c2ecf20Sopenharmony_ci# the toplevel makefile
198c2ecf20Sopenharmony_ciinclude ../../lib.mk
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci$(TEST_GEN_PROGS): $(PROGS)
228c2ecf20Sopenharmony_ci	cp $(PROGS) $(OUTPUT)/
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci# Common test-unit targets to build common-layout test-cases executables
258c2ecf20Sopenharmony_ci# Needs secondary expansion to properly include the testcase c-file in pre-reqs
268c2ecf20Sopenharmony_ci.SECONDEXPANSION:
278c2ecf20Sopenharmony_ci$(PROGS): test_signals.c test_signals_utils.c testcases/testcases.c signals.S $$@.c test_signals.h test_signals_utils.h testcases/testcases.h
288c2ecf20Sopenharmony_ci	$(CC) $(CFLAGS) $^ -o $@
29