This repository was archived by the owner on Feb 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild_rule.mk
54 lines (48 loc) · 1.73 KB
/
build_rule.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
include common.mk
INCLUDE_PATH = -I$(realpath source/arch/hw/) -I$(realpath source/arch/$(ARCH)/) -I$(realpath source/kernel)
KERNEL_INCLUDE_PATH = -I$(realpath source/arch/hw/libc/) -I$(realpath source/kernel/freebsd/) -I$(realpath source/kernel/acpica/include/)
RAPH_FLAGS = -ggdb3 -O0 \
-Wall -Werror=return-type -Werror=switch -Werror=unused-result -Wshadow \
-DARCH=$(ARCH) $(INCLUDE_PATH) \
-MMD -MP
RAPH_KERNELFLAGS = -nostdinc -nostdlib \
-ffreestanding -fno-builtin \
-mcmodel=large -mno-mmx \
-D__KERNEL__ -D_KERNEL -D__NO_LIBC__ \
-DARCH=$(ARCH) -Dbootverbose=0 \
$(KERNEL_INCLUDE_PATH)
RAPH_CFLAGS = $(RAPH_FLAGS) -std=c99
RAPH_CXXFLAGS = $(RAPH_FLAGS) -std=c++1y
RAPH_KERNELCFLAGS = $(RAPH_KERNELFLAGS) $(RAPH_CFLAGS)
RAPH_KERNELCXXFLAGS = $(RAPH_KERNELFLAGS) $(RAPH_CXXFLAGS) -fno-exceptions -fno-rtti -fno-use-cxa-atexit -fno-threadsafe-statics
CFLAGS += $(RAPH_KERNELCFLAGS)
CXXFLAGS += $(RAPH_KERNELCXXFLAGS)
ASFLAGS += $(RAPH_FLAGS) $(RAPH_KERNELFLAGS)
RAPH_PROJECT_ROOT = $(realpath $(shell pwd))
LANG=C
export RAPH_CFLAGS
export RAPH_CXXFLAGS
export CFLAGS
export CXXFLAGS
export ASFLAGS
export RAPH_PROJECT_ROOT
export LANG=C
format:
@echo "Formatting with clang-format. Please wait..."
@git ls-files source/kernel/ \
| grep -v source/kernel/freebsd \
| grep -v source/kernel/acpica \
| grep -v source/kernel/dev/storage/ahci/ \
| grep -v source/kernel/dev/nic/intel/ \
| grep -E ".*\.cc$$|.*\.h$$" \
| xargs -n 1 clang-format -i
@echo "Done."
test:
@$(MAKE) -f build_rule.mk format
git diff --quiet
@$(MAKE) -C source/unit_test test
clean:
@$(MAKE) -C source/unit_test clean
@$(MAKE) -C source/arch/$(ARCH) -f $(BUILD_RULE_FILE) clean
%:
@$(MAKE) -C source/arch/$(ARCH) -f $(BUILD_RULE_FILE) $@