-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (44 loc) · 1.14 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
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
.PHONY: build clean cargo assets
.DEFAULT: build
# Configure here name and runner
NAME := $(shell cat Cargo.toml | sed -n -e 's/name = "\([^"]*\)".*/\1/p')
RUNNER := melonDS
# Configure here flags for cargo and ndstool
CARGOFLAGS :=
NDSTOOLFLAGS :=
# Profile selection
# Use "make DEBUG=1" for debug
ifdef DEBUG
PROFILE := debug
else
PROFILE := release
CARGOFLAGS += --release
endif
# Use "make VERBOSE=1" for verbose
ifdef VERBOSE
CARGOFLAGS += --verbose
NDSTOOLFLAGS += -vv
endif
OUTPUT := target/nds/$(PROFILE)
_ADDFILES := -d nitrofiles
build: $(OUTPUT)/$(NAME).nds
$(OUTPUT)/$(NAME).nds: $(OUTPUT)/$(NAME).elf
@echo "Creating ROM $@ ($(PROFILE))"
@ndstool -c $@ -9 $< $(NDSTOOLFLAGS) $(_ADDFILES)
@echo "File on $(OUTPUT)/$(NAME).nds"
$(OUTPUT)/$(NAME).elf: cargo
cargo:
@echo "Compiling code ($(PROFILE))"
@cargo build $(CARGOFLAGS)
run: build
$(RUNNER) $(OUTPUT)/$(NAME).nds
clean:
@cargo clean
@rm -f $(OUTPUT)/$(NAME).nds
update:
@CARGO_NET_GIT_FETCH_WITH_CLI=true cargo update
assets:
$(MAKE) -C assets