forked from 0xtob/nitrotracker
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
155 lines (117 loc) · 3.76 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# SPDX-License-Identifier: CC0-1.0
#
# SPDX-FileContributor: Antonio Niño Díaz, 2023
BLOCKSDS ?= /opt/blocksds/core
BLOCKSDSEXT ?= /opt/blocksds/external
# User config
# ===========
NAME := nitroustracker
export VERSION := 0.4.13
export GIT_HASH := $(shell git rev-parse --short HEAD)
GAME_TITLE := NitrousTracker
GAME_AUTHOR := v$(VERSION)
GAME_ICON := icon.bmp
# DLDI and internal SD slot of DSi
# --------------------------------
# Root folder of the SD image
SDROOT := sdroot
# Name of the generated image it "DSi-1.sd" for no$gba in DSi mode
SDIMAGE := image.bin
# Source code paths
# -----------------
NITROFATDIR :=
# Tools
# -----
MAKE := make
RM := rm -rf
# Verbose flag
# ------------
ifeq ($(VERBOSE),1)
V :=
else
V := @
endif
# Directories
# -----------
ARM9DIR := arm9
ARM7DIR := arm7
# Build artfacts
# --------------
NITROFAT_IMG := build/nitrofat.bin
ROM := $(NAME).midi.nds
ROM_DEBUG := $(NAME).debug.nds
ROM_NOMIDI := $(NAME).nds
# Targets
# -------
.PHONY: all clean arm9d arm9 arm9l arm7d arm7 arm7l libntxm tobkit tobkit-debug libdsmi sdimage
all: $(ROM) $(ROM_DEBUG) $(ROM_NOMIDI)
clean:
@echo " CLEAN"
$(V)$(MAKE) -f Makefile.arm9 clean --no-print-directory DEBUG=true MIDI=true
$(V)$(MAKE) -f Makefile.arm9 clean --no-print-directory DEBUG=false
$(V)$(MAKE) -f Makefile.arm9 clean --no-print-directory DEBUG=false MIDI=true
$(V)$(MAKE) -f Makefile.arm7 clean --no-print-directory DEBUG=true MIDI=true
$(V)$(MAKE) -f Makefile.arm7 clean --no-print-directory DEBUG=false
$(V)$(MAKE) -f Makefile.arm7 clean --no-print-directory DEBUG=false MIDI=true
$(V)$(MAKE) -C tobkit clean DEBUG=true
$(V)$(MAKE) -C tobkit clean DEBUG=false
$(V)$(MAKE) -C dsmi/ds/libdsmi -f Makefile.blocks clean
$(V)$(MAKE) -C libntxm/libntxm -f Makefile.blocks clean
$(V)$(RM) $(ROM) build $(SDIMAGE)
libntxm:
@make -C libntxm/libntxm -f Makefile.blocks
tobkit:
@make -C tobkit
tobkit-debug:
@make -C tobkit DEBUG=true
libdsmi:
@make -C dsmi/ds/libdsmi -f Makefile.blocks
arm9d: tobkit-debug libntxm libdsmi
$(V)+$(MAKE) -f Makefile.arm9 --no-print-directory DEBUG=true MIDI=true
arm9: tobkit libntxm libdsmi
$(V)+$(MAKE) -f Makefile.arm9 --no-print-directory DEBUG=false MIDI=true
arm9l: tobkit libntxm libdsmi
$(V)+$(MAKE) -f Makefile.arm9 --no-print-directory DEBUG=false
arm7d: libntxm
$(V)+$(MAKE) -f Makefile.arm7 --no-print-directory DEBUG=true MIDI=true
arm7: libntxm
$(V)+$(MAKE) -f Makefile.arm7 --no-print-directory DEBUG=false MIDI=true
arm7l: libntxm
$(V)+$(MAKE) -f Makefile.arm7 --no-print-directory DEBUG=false
ifneq ($(strip $(NITROFATDIR)),)
# Additional arguments for ndstool
NDSTOOL_FAT := -F $(NITROFAT_IMG)
$(NITROFAT_IMG): $(NITROFATDIR)
@echo " MKFATIMG $@ $(NITROFATDIR)"
$(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(NITROFATDIR) $@ 0
# Make the NDS ROM depend on the filesystem image only if it is needed
$(ROM): $(NITROFAT_IMG)
$(ROM_DEBUG): $(NITROFAT_IMG)
endif
# Combine the title strings
ifeq ($(strip $(GAME_SUBTITLE)),)
GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_AUTHOR)
else
GAME_FULL_TITLE := $(GAME_TITLE);$(GAME_SUBTITLE);$(GAME_AUTHOR)
endif
$(ROM): arm9 arm7
@echo " NDSTOOL $@"
$(V)$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \
-7 build/arm7.elf -9 build/arm9.elf \
-b $(GAME_ICON) "$(GAME_FULL_TITLE)" \
$(NDSTOOL_FAT)
$(ROM_DEBUG): arm9d arm7d
@echo " NDSTOOL $@"
$(V)$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \
-7 build/arm7d.elf -9 build/arm9d.elf \
-b $(GAME_ICON) "$(GAME_FULL_TITLE)" \
$(NDSTOOL_FAT)
$(ROM_NOMIDI): arm9l arm7l
@echo " NDSTOOL $@"
$(V)$(BLOCKSDS)/tools/ndstool/ndstool -c $@ \
-7 build/arm7l.elf -9 build/arm9l.elf \
-b $(GAME_ICON) "$(GAME_FULL_TITLE)" \
$(NDSTOOL_FAT)
sdimage:
@echo " MKFATIMG $(SDIMAGE) $(SDROOT)"
$(V)$(BLOCKSDS)/tools/mkfatimg/mkfatimg -t $(SDROOT) $(SDIMAGE) 0