-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (43 loc) · 1.72 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
ROOTDIR = $(N64_INST)
GCCN64PREFIX = $(ROOTDIR)/bin/mips64-elf-
CHKSUM64PATH = $(ROOTDIR)/bin/chksum64
MKDFSPATH = $(ROOTDIR)/bin/mkdfs
MKSPRITE = $(ROOTDIR)/bin/mksprite
N64TOOL = $(ROOTDIR)/bin/n64tool
LINK_FLAGS = -L$(ROOTDIR)/mips64-elf/lib -ldragon -lc -lm -ldragonsys -Tn64ld.x
PROG_NAME = Memory64
CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O2 -Wall -Werror -I$(ROOTDIR)/mips64-elf/include -Iinclude
ASFLAGS = -mtune=vr4300 -march=vr4300
CC = $(GCCN64PREFIX)gcc
AS = $(GCCN64PREFIX)as
LD = $(GCCN64PREFIX)ld
OBJCOPY = $(GCCN64PREFIX)objcopy
all: $(PROG_NAME).z64
$(PROG_NAME).z64: $(PROG_NAME).bin $(PROG_NAME).dfs
@rm -f $@
$(N64TOOL) -l 2M -t "$(PROG_NAME)" -h $(ROOTDIR)/mips64-elf/lib/header -o $(PROG_NAME).z64 $(PROG_NAME).bin -s 1M $(PROG_NAME).dfs
$(CHKSUM64PATH) $@
$(PROG_NAME).bin : $(PROG_NAME).elf
$(OBJCOPY) -O binary $< $@
SRCS := $(wildcard src/*.c)
OBJS := $(SRCS:.c=.o)
$(PROG_NAME).elf : $(OBJS)
$(LD) -o $@ $^ $(LINK_FLAGS)
sprites:
mkdir -p filesystem/gfx/
$(MKSPRITE) 16 1 9 resources/gfx/logo.png filesystem/gfx/logo.sprite
sounds:
mkdir -p filesystem/sfx/
sox resources/sfx/A.aiff -b 16 -e signed-integer -B -r 44100 filesystem/sfx/A.raw remix -
sox resources/sfx/B.aiff -b 16 -e signed-integer -B -r 44100 filesystem/sfx/B.raw remix -
sox resources/sfx/C.aiff -b 16 -e signed-integer -B -r 44100 filesystem/sfx/C.raw remix -
sox resources/sfx/start.aiff -b 16 -e signed-integer -B -r 44100 filesystem/sfx/start.raw remix -
$(PROG_NAME).dfs: sprites sounds
$(MKDFSPATH) $@ ./filesystem/
cen64:
$(CEN64_DIR)/cen64 $(CEN64_DIR)/pifdata.bin $(PROG_NAME).z64
docker:
docker build -t build .
docker run --rm build cat $(PROG_NAME).z64 > $(PROG_NAME).z64
clean:
rm -f *.z64 *.elf src/*.o *.bin *.dfs