asterinas/test/initramfs/src/apps/Makefile

90 lines
1.7 KiB
Makefile
Raw Normal View History

# SPDX-License-Identifier: MPL-2.0
2025-07-04 08:37:47 +00:00
HOST_PLATFORM ?= x86_64-linux
# Prevent the implicit rules from compiling ".c" or ".s" files automatically.
MAKEFLAGS += --no-builtin-rules
2023-05-29 05:29:53 +00:00
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
2025-07-02 11:10:37 +00:00
INITRAMFS ?= $(CUR_DIR)/../../build/initramfs
2024-06-28 11:12:24 +00:00
TEST_BUILD_DIR ?= $(INITRAMFS)/test
# These test apps are sorted by name
TEST_APPS := \
alarm \
2024-05-06 05:35:13 +00:00
capability \
2023-12-14 02:33:23 +00:00
clone3 \
2024-05-25 20:42:16 +00:00
cpu_affinity \
2025-09-18 07:53:05 +00:00
devfs \
2024-05-16 11:05:32 +00:00
epoll \
2023-12-04 07:21:31 +00:00
eventfd2 \
2024-05-15 04:00:14 +00:00
execve \
2024-11-25 00:09:18 +00:00
exit \
ext2 \
2024-06-27 02:46:58 +00:00
fdatasync \
2024-05-15 04:00:14 +00:00
file_io \
fork_c \
getcpu \
getpid \
hello_pie \
inotify \
2024-05-31 10:24:20 +00:00
itimer \
2023-12-04 07:32:38 +00:00
mmap \
mongoose \
2025-08-04 09:37:45 +00:00
namespace \
network \
2024-06-30 18:34:55 +00:00
pipe \
2025-02-25 11:15:27 +00:00
prctl \
2025-04-21 06:17:02 +00:00
process \
procfs \
pseudofs \
pthread \
pty \
2025-02-11 13:35:24 +00:00
sched \
shm \
2024-04-07 15:08:18 +00:00
vsock \
2023-05-29 05:29:53 +00:00
2025-07-04 08:37:47 +00:00
# TODO: Refactor those tests for target CPU arch using C macro-based conditional compilation.
ifeq ($(HOST_PLATFORM), x86_64-linux)
TEST_APPS += \
fork \
hello_c \
hello_world \
signal_c
endif
2025-09-30 05:58:47 +00:00
ifeq ($(INTEL_TDX), 1)
TEST_APPS += generate_tdx_quote
endif
2024-05-08 02:33:25 +00:00
# The C head and source files of all the apps, excluding the downloaded mongoose files
C_SOURCES := \
$(shell find . -type f \( -name "*.c" -or -name "*.h" \) \
! -name "mongoose.c" ! -name "mongoose.h")
2023-05-29 05:29:53 +00:00
.PHONY: all
2024-02-29 09:05:35 +00:00
all: $(TEST_APPS) scripts
.PHONY: $(TEST_APPS)
$(TEST_APPS):
@make --no-print-directory -C $@
.PHONY: format
format:
2024-06-28 11:12:24 +00:00
@echo "Fixing code format for general tests..."
@clang-format -i $(C_SOURCES)
.PHONY: check
check:
2024-06-28 11:12:24 +00:00
@echo "Checking code format for general tests..."
@clang-format --dry-run --Werror $(C_SOURCES)
2024-06-28 11:12:24 +00:00
$(TEST_BUILD_DIR):
2024-02-29 09:05:35 +00:00
@mkdir -p $@
.PHONY: scripts
2024-06-28 11:12:24 +00:00
scripts: | $(TEST_BUILD_DIR)
@make --no-print-directory BUILD_DIR=$(TEST_BUILD_DIR) -C scripts