-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (58 loc) · 2.57 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
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
MAKEFILE_PATH:=$(realpath $(shell dirname $(firstword $(MAKEFILE_LIST))))
$(info MAKEFILE_PATH=$(MAKEFILE_PATH))
include $(DEVKITARM)/ds_rules
export GAME_TITLE := FSPDS
export GAME_ICON := $(CURDIR)/icon.bmp
export TARGET := FSPDS
export NDS_FILE := $(TARGET)
USE_NTFS := ${shell grep -E "^NTFS\s*\=\s*.*\s*$$" $(MAKEFILE_PATH)/config.ini | sed -E "s/^NTFS\s*\=\s*(.*)\s*$$/\1/" | grep . || echo "0"}
ifeq ($(USE_NTFS), 1)
$(info NTFS)
NITRO := nitrofs
else
$(info NO_NTFS)
NITRO :=
endif
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
#NITROFS_INC := $(ROOT_DIR)/arm9/nitrofs
#include $(NITROFS_INC)
ifneq ($(strip $(NITRO)),)
NITRO_FILES := arm9/$(NITRO)
endif
.PHONY: arm7/$(TARGET).elf arm9/$(TARGET).elf
TARGET_BUILD_VERSION := ${shell python build_counter.py}
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
all: $(TARGET).nds
#---------------------------------------------------------------------------------
ifneq ($(strip $(NITRO)),)
$(TARGET).nds : arm7/$(TARGET).elf arm9/$(TARGET).elf $(NITRO_FILES)
$(info ndstool -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf -b $(GAME_ICON) "$(GAME_TITLE)" -d $(NITRO_FILES) -c $(TARGET).nds)
@ndstool -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf -b $(GAME_ICON) "$(GAME_TITLE)" -d $(NITRO_FILES) -c $(TARGET).nds
@echo built ... $(notdir $@)
mv $(TARGET).nds $(TARGET)-V$(TARGET_BUILD_VERSION).nds
else
$(TARGET).nds : arm7/$(TARGET).elf arm9/$(TARGET).elf
$(info ndstool -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf -b $(GAME_ICON) "$(GAME_TITLE)" -d $(NITRO_FILES) -c $(TARGET).nds)
@ndstool -7 arm7/$(TARGET).elf -9 arm9/$(TARGET).elf -b $(GAME_ICON) "$(GAME_TITLE)" -c $(TARGET).nds
@echo built ... $(notdir $@)
mv $(TARGET).nds $(TARGET)-V$(TARGET_BUILD_VERSION).nds
endif
#---------------------------------------------------------------------------------
arm7/$(TARGET).elf:
$(MAKE) -C arm7
#---------------------------------------------------------------------------------
arm9/$(TARGET).elf:
$(MAKE) -C arm9
#---------------------------------------------------------------------------------
clean:
$(MAKE) -C arm9 clean
$(MAKE) -C arm7 clean
rm -f $(TARGET).arm7 $(TARGET).arm9