-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
74 lines (52 loc) · 1.79 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
65
66
67
68
69
70
71
72
73
74
SHELL = /bin/sh
.PHONY: all
.SUFFIXES:
.DEFAULTGOAL: all
DEPS :=
ASFLAGS :=
include Tools.mak
# Component Makefiles
include $(DIALOGUE)/Makefile
# Configuration
BASEROM := ../FE5.sfc
BUILD_SCRIPT := Build.asm
ROM_TARGET := $(BIN)/FireEmblem5.sfc
SYM_TARGET := $(ROM_TARGET:.sfc=.cpu.sym)
LOG_TARGET := Log.txt
MAP_TARGET := Map.txt
ERROR_TARGET := Errors.txt
BUILD_TARGETS := $(ROM_TARGET) $(SYM_TARGET) $(LOG_TARGET) $(ERROR_TARGET) $(MAP_TARGET)
ASFLAGS += -x -f -C -a
ASFLAGS += -Wall
ASFLAGS += -Wno-portable -Wno-shadow -Wno-deprecated
ASFLAGS += -D BASEROM=\"$(BASEROM)\"
ASFLAGS += -D USE_FE5_DEFINITIONS=true
ASFLAGS += -i "$(VOLTEDGE)/VoltEdge.h" -i "$(BUILD_SCRIPT)"
ASFLAGS += -o "$(ROM_TARGET)"
ASFLAGS += --vice-labels -l "$(SYM_TARGET)"
ASFLAGS += --map "$(MAP_TARGET)"
DEPS += $(shell $(scan_includes) "$(BUILD_SCRIPT)" "$(VOLTEDGE)/VoltEdge.h")
all: $(BUILD_TARGETS) checksum compare symbols
# This mess is to allow the errors to be printed
# unconditionally but the log file can only be processed
# if the build was successful. This keeps track of the exit
# status of the assembly step and saves that for the return value.
$(BUILD_TARGETS): $(BUILD_SCRIPT) $(DEPS) $(MAKEFILE_LIST)
@($(64tass) $(ASFLAGS) 1>"$(LOG_TARGET)" -E "$(ERROR_TARGET)" && $(regions) "$(MAP_TARGET)") ; \
declare -i e=$$? ; \
cat "$(ERROR_TARGET)" >&2 ; \
exit $$((e))
checksum: $(ROM_TARGET)
@$(update_checksum) "$<" | tee -a "$(LOG_TARGET)"
compare: $(ROM_TARGET)
@$(compare) "$(BASEROM)" "$(ROM_TARGET)" | tee -a "$(ERROR_TARGET)"
symbols: $(SYM_TARGET)
@$(fix_sym) "$<"
$(BIN):
@mkdir -p $(BIN)
# `clean` to get rid of files in the BIN folder
# `veryclean` to get rid of all generated files
clean:: | $(BIN)
@$(RM) $(BIN)/*.*
veryclean:: clean
@$(RM) "$(LOG_TARGET)" "$(ERROR_TARGET)" "$(MAP_TARGET)"