71 lines
1.3 KiB
Makefile
71 lines
1.3 KiB
Makefile
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
# Prevent the implicit rules from compiling ".c" or ".s" files automatically.
|
|
MAKEFLAGS += --no-builtin-rules
|
|
|
|
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|
CUR_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
|
|
|
|
INITRAMFS ?= $(CUR_DIR)/../build/initramfs
|
|
TEST_BUILD_DIR ?= $(INITRAMFS)/test
|
|
|
|
# These test apps are sorted by name
|
|
TEST_APPS := \
|
|
alarm \
|
|
capability \
|
|
clone3 \
|
|
cpu_affinity \
|
|
epoll \
|
|
eventfd2 \
|
|
execve \
|
|
exit \
|
|
fdatasync \
|
|
file_io \
|
|
fork \
|
|
fork_c \
|
|
getcpu \
|
|
getpid \
|
|
hello_c \
|
|
hello_pie \
|
|
hello_world \
|
|
itimer \
|
|
mmap \
|
|
mongoose \
|
|
network \
|
|
pipe \
|
|
prctl \
|
|
pthread \
|
|
pty \
|
|
shm \
|
|
signal_c \
|
|
vsock \
|
|
|
|
# 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")
|
|
|
|
.PHONY: all
|
|
all: $(TEST_APPS) scripts
|
|
|
|
.PHONY: $(TEST_APPS)
|
|
$(TEST_APPS):
|
|
@make --no-print-directory -C $@
|
|
|
|
.PHONY: format
|
|
format:
|
|
@echo "Fixing code format for general tests..."
|
|
@clang-format -i $(C_SOURCES)
|
|
|
|
.PHONY: check
|
|
check:
|
|
@echo "Checking code format for general tests..."
|
|
@clang-format --dry-run --Werror $(C_SOURCES)
|
|
|
|
$(TEST_BUILD_DIR):
|
|
@mkdir -p $@
|
|
|
|
.PHONY: scripts
|
|
scripts: | $(TEST_BUILD_DIR)
|
|
@make --no-print-directory BUILD_DIR=$(TEST_BUILD_DIR) -C scripts
|