This repository has been archived by the owner on Dec 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
54 lines (43 loc) · 1.5 KB
/
makefile
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
# Copyright(c) The Maintainers of Nanvix.
# Licensed under the MIT License.
DEFAULT_GOAL := all
#===============================================================================
# Toolchain Configuration
#===============================================================================
include $(BUILD_DIR)/mk/$(TARGET)/makefile
# Compiler Options
export CFLAGS += -std=c17
export CFLAGS += -Wall -Wextra -Werror
export CFLAGS += -Winit-self -Wswitch-default -Wfloat-equal -Wno-pointer-arith
export CFLAGS += -Wundef -Wshadow -Wuninitialized -Wlogical-op
export CFLAGS += -Wvla -Wredundant-decls
export CFLAGS += -pedantic-errors
export CFLAGS += -Wstack-usage=4096
# Optimization Flags
ifeq ($(RELEASE), yes)
export CFLAGS += -O3
else
export CFLAGS += -O0
export CFLAGS += -g
endif
# Cargo Options
ifeq ($(RELEASE), yes)
export CARGO_FLAGS := --release
endif
# File format for executables.
export EXEC_FORMAT := elf
#===============================================================================
# Run and Debug Rules
#===============================================================================
# Builds the system image.
image: all
ifeq ($(IMAGE), $(filter %.iso, $(IMAGE)))
@cp -f $(BINARIES_DIR)/*.$(EXEC_FORMAT) $(IMAGE_DIR)/
@grub-mkrescue $(IMAGE_DIR) -o $(IMAGE)
endif
# Runs system in release mode.
run: image
bash $(SCRIPTS_DIR)/run.sh $(TARGET) $(MACHINE) $(IMAGE) --no-debug $(TIMEOUT)
# Runs system in debug mode.
debug: image
bash $(SCRIPTS_DIR)/run.sh $(TARGET) $(MACHINE) $(IMAGE) --debug $(TIMEOUT)