xref: /linux/tools/testing/selftests/arm64/signal/Makefile (revision 114143a595895c03fbefccfd8346fc51fb4908ed)
1f96bf434SCristian Marussi# SPDX-License-Identifier: GPL-2.0
2f96bf434SCristian Marussi# Copyright (C) 2019 ARM Limited
3f96bf434SCristian Marussi
4f96bf434SCristian Marussi# Additional include paths needed by kselftest.h and local headers
5f96bf434SCristian MarussiCFLAGS += -D_GNU_SOURCE -std=gnu99 -I.
6f96bf434SCristian Marussi
7f96bf434SCristian MarussiSRCS := $(filter-out testcases/testcases.c,$(wildcard testcases/*.c))
8f96bf434SCristian MarussiPROGS := $(patsubst %.c,%,$(SRCS))
9f96bf434SCristian Marussi
10f96bf434SCristian Marussi# Generated binaries to be installed by top KSFT script
11f96bf434SCristian MarussiTEST_GEN_PROGS := $(notdir $(PROGS))
12f96bf434SCristian Marussi
13f96bf434SCristian Marussi# Get Kernel headers installed and use them.
14f96bf434SCristian Marussi
15f96bf434SCristian Marussi# Including KSFT lib.mk here will also mangle the TEST_GEN_PROGS list
16f96bf434SCristian Marussi# to account for any OUTPUT target-dirs optionally provided by
17f96bf434SCristian Marussi# the toplevel makefile
18f96bf434SCristian Marussiinclude ../../lib.mk
19f96bf434SCristian Marussi
20f96bf434SCristian Marussi$(TEST_GEN_PROGS): $(PROGS)
21f96bf434SCristian Marussi	cp $(PROGS) $(OUTPUT)/
22f96bf434SCristian Marussi
23f96bf434SCristian Marussi# Common test-unit targets to build common-layout test-cases executables
24f96bf434SCristian Marussi# Needs secondary expansion to properly include the testcase c-file in pre-reqs
25a884f797SMark BrownCOMMON_SOURCES := test_signals.c test_signals_utils.c testcases/testcases.c \
26*5225b656SAndre Przywara	signals.S sve_helpers.c
27a884f797SMark BrownCOMMON_HEADERS := test_signals.h test_signals_utils.h testcases/testcases.h
28a884f797SMark Brown
29f96bf434SCristian Marussi.SECONDEXPANSION:
30a884f797SMark Brown$(PROGS): $$@.c ${COMMON_SOURCES} ${COMMON_HEADERS}
31a884f797SMark Brown	$(CC) $(CFLAGS) ${@}.c ${COMMON_SOURCES} -o $@
32