-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
64 lines (50 loc) · 1.73 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
55
56
57
58
59
60
61
62
63
64
# SPDX-License-Identifier: GPL-2.0
#
# Define V=1 for more verbose compile.
# Define S=1 for sanitation checks.
# Define LDFLAGS=-static for statically linked tools.
CFLAGS =
ifeq (1,$(S))
S_CFLAGS = -fsanitize=address -fsanitize=leak -fsanitize=undefined \
-fsanitize-address-use-after-scope -fstack-check
endif
DEP_CFLAGS = -Wp,-MMD,$(@D)/$(@F).d -MT $(@D)/$(@F)
BASIC_CFLAGS = -Wall -Iinclude $(DEP_CFLAGS) $(CFLAGS)
MODULE_LD = script/iop.ld
# FIXME: -O0 -> -O2
IOP_CFLAGS = -O0 -march=r3000 -EL -msoft-float -fomit-frame-pointer \
-fno-pic -mno-abicalls -fno-common -ffreestanding -static \
-fno-strict-aliasing -nostdlib -mlong-calls -mno-gpopt \
-mno-shared -G0 -ffunction-sections -fdata-sections \
$(BASIC_CFLAGS)
IOP_LDFLAGS = -O2 --gpsize=0 -G0 --nmagic --orphan-handling=error \
--discard-all --gc-sections --emit-relocs -nostdlib \
-z max-page-size=4096 --no-relax --script=$(MODULE_LD)
TARGET_CC = $(CROSS_COMPILE)gcc
TARGET_LD = $(CROSS_COMPILE)ld
TARGET_OBJCOPY = $(CROSS_COMPILE)objcopy
.PHONY: all
all: module tool
include tool/Makefile
include builtin/Makefile
include module/Makefile
ALL_DEP = $(sort $(ALL_OBJ:%=%.d))
.PHONY: check
check: test
.PHONY: gtags
gtags:
$(QUIET_GEN)gtags
OTHER_CLEAN += GPATH GRTAGS GTAGS
.PHONY: clean
clean:
$(QUIET_RM)$(RM) $(ALL_OBJ) $(ALL_DEP) $(OTHER_CLEAN)
V = @
Q = $(V:1=)
QUIET_AR = $(Q:@=@echo ' AR '$@;)
QUIET_AS = $(Q:@=@echo ' AS '$@;)
QUIET_CC = $(Q:@=@echo ' CC '$@;)
QUIET_GEN = $(Q:@=@echo ' GEN '$@;)
QUIET_LINK = $(Q:@=@echo ' LD '$@;)
QUIET_TEST = $(Q:@=@echo ' TEST '$@;)
QUIET_RM = $(Q:@=@echo ' RM '$@;)
$(eval -include $(ALL_DEP))