-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (47 loc) · 1.51 KB
/
Makefile
File metadata and controls
64 lines (47 loc) · 1.51 KB
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
export PATH := $(DEVKITARM)/bin:$(PATH)
CC=arm-none-eabi-gcc
CP=arm-none-eabi-g++
OC=arm-none-eabi-objcopy
LD=arm-none-eabi-ld
MV=mv -f
RM=rm -rf
LIBNAME=dctr
ELFNAME=$(LIBNAME).elf
BINNAME=$(LIBNAME).bin
DATNAME=$(LIBNAME).dat
SRC_DIR:=src/$(LIBNAME)
OBJ_DIR:=obj/$(LIBNAME)
LIB_DIR:=lib
DEP_DIR:=obj/$(LIBNAME)
LIBS=-lctrff -lctr
CFLAGS=-std=gnu99 -Os -g -mword-relocations -fomit-frame-pointer -ffast-math
C9FLAGS=-mcpu=arm946e-s -march=armv5te -mlittle-endian
LDFLAGS=$(LIBS)
OCFLAGS=--set-section-flags .bss=alloc,load,contents
OBJS:=$(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(wildcard $(SRC_DIR)/*.c))
OBJS+=$(patsubst $(SRC_DIR)/%.s, $(OBJ_DIR)/%.o, $(wildcard $(SRC_DIR)/*.s))
OBJS+=$(patsubst $(SRC_DIR)/%.S, $(OBJ_DIR)/%.o, $(wildcard $(SRC_DIR)/*.S))
OUT_DIR=bin out obj/dctr
.PHONY: clean
all: out/$(DATNAME)
out/$(DATNAME): bin/$(BINNAME)
make dir_out=../out name=$(DATNAME) -C CakeHax launcher
dd if=bin/$(BINNAME) of=out/$(DATNAME) bs=512 seek=144
bin/dctr.bin: $(OBJS) | dirs
$(CC) -nostartfiles --specs=$(LIBNAME).specs $(OBJS) $(LDFLAGS) -o bin/$(ELFNAME)
$(OC) $(OCFLAGS) -O binary bin/$(ELFNAME) bin/$(BINNAME)
obj/%.o: src/%.c | dirs
@echo Compiling $<
$(CC) -c $(CFLAGS) $(C9FLAGS) $< -o $@
obj/%.o: src/%.s | dirs
@echo Compiling $<
$(CC) -c $(CFLAGS) $(C9FLAGS) $< -o $@
obj/%.o: src/%.S | dirs
@echo Compiling $<
$(CC) -c $(CFLAGS) $(C9FLAGS) $< -o $@
dirs: ${OUT_DIR}
${OUT_DIR}:
mkdir -p ${OUT_DIR}
clean:
rm -rf bin/*.elf bin/*.bin obj/*
make dir_out=../out name=dctr.dat -C CakeHax clean