xref: /linux/tools/testing/selftests/nolibc/Makefile (revision 69050f8d6d075dc01af7a5f2f550a8067510366f)
1# SPDX-License-Identifier: GPL-2.0
2
3TEST_GEN_PROGS := nolibc-test libc-test
4
5include ../lib.mk
6include $(top_srcdir)/scripts/Makefile.compiler
7
8cc-option = $(call __cc-option, $(CC),,$(1),$(2))
9
10include Makefile.include
11
12$(OUTPUT)/nolibc-test: CFLAGS = -nostdlib -nostdinc -static \
13	 -isystem $(top_srcdir)/tools/include/nolibc -isystem $(top_srcdir)/usr/include \
14	 $(CFLAGS_NOLIBC_TEST)
15$(OUTPUT)/nolibc-test: LDLIBS = $(if $(LLVM),,-lgcc)
16$(OUTPUT)/nolibc-test: nolibc-test.c nolibc-test-linkage.c | headers
17
18$(OUTPUT)/libc-test: nolibc-test.c nolibc-test-linkage.c
19	$(call msg,CC,,$@)
20	$(Q)$(LINK.c) $^ -o $@
21
22help:
23	@echo "For the custom nolibc testsuite use '$(MAKE) -f Makefile.nolibc'; available targets:"
24	@$(MAKE) -f Makefile.nolibc help
25
26.PHONY: help
27