aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-08-30 11:09:34 +0200
committerBad Diode <bd@badd10de.dev>2023-08-30 11:09:34 +0200
commit6a01445ef315c60a5f40b842d24e1e0d34a5d070 (patch)
tree8c279272574cfe487392eceef43108b75776a36b /Makefile
parent033b0d78a5081e86fdfb70ca23fab627f8cf2ce0 (diff)
downloaduxngba-6a01445ef315c60a5f40b842d24e1e0d34a5d070.tar.gz
uxngba-6a01445ef315c60a5f40b842d24e1e0d34a5d070.zip
Fix k mode instructions
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 9 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 4e5bab3..ac6f24d 100644
--- a/Makefile
+++ b/Makefile
@@ -15,8 +15,9 @@ LIBGBA += $(LIBGBA_DIR)/lib/libmm.a
15SRC_DIR := src 15SRC_DIR := src
16BUILD_DIR := build 16BUILD_DIR := build
17SRC_MAIN := $(SRC_DIR)/main.c 17SRC_MAIN := $(SRC_DIR)/main.c
18ROM := $(BUILD_DIR)/rom.c 18UXN_ROM := roms/dvd.rom
19ROM_SRC := roms/dvd.rom 19ROM_FILE := $(BUILD_DIR)/uxn.rom
20ROM_OBJ := $(BUILD_DIR)/rom.o
20ASM_FILES := $(wildcard $(SRC_DIR)/*.s) 21ASM_FILES := $(wildcard $(SRC_DIR)/*.s)
21WATCH_SRC := $(shell find $(SRC_DIR) -name *.c -or -name *.s -or -name *.h) 22WATCH_SRC := $(shell find $(SRC_DIR) -name *.c -or -name *.s -or -name *.h)
22INC_DIRS := $(shell find $(SRC_DIR) -type d) 23INC_DIRS := $(shell find $(SRC_DIR) -type d)
@@ -29,9 +30,6 @@ TARGET := uxngba
29ELF := $(BUILD_DIR)/$(TARGET).elf 30ELF := $(BUILD_DIR)/$(TARGET).elf
30BIN := $(BUILD_DIR)/$(TARGET).gba 31BIN := $(BUILD_DIR)/$(TARGET).gba
31 32
32# Target tools.
33TOOLS_BIN2CARR := tools/bin2carr/build/bin2carr
34
35# Compiler and linker configuration. 33# Compiler and linker configuration.
36CC := $(DEVKITBIN)/arm-none-eabi-gcc 34CC := $(DEVKITBIN)/arm-none-eabi-gcc
37OBJCOPY := $(DEVKITBIN)/arm-none-eabi-objcopy 35OBJCOPY := $(DEVKITBIN)/arm-none-eabi-objcopy
@@ -63,7 +61,7 @@ endif
63main: $(BUILD_DIR) $(ROM) $(BIN) 61main: $(BUILD_DIR) $(ROM) $(BIN)
64 62
65$(ROM): $(TOOLS_BIN2CARR) 63$(ROM): $(TOOLS_BIN2CARR)
66 ./tools/bin2carr/build/bin2carr -n uxn_rom -e u8 -o $(ROM) $(ROM_SRC) 64 ./tools/bin2carr/build/bin2carr -n uxn_rom -e u8 -o $(ROM) $(UXN_ROM)
67 65
68# Strip and fix header to create final .gba file. 66# Strip and fix header to create final .gba file.
69$(BIN): $(ELF) 67$(BIN): $(ELF)
@@ -71,8 +69,11 @@ $(BIN): $(ELF)
71 $(DEVKITTOOLS)/gbafix $(BIN) 69 $(DEVKITTOOLS)/gbafix $(BIN)
72 70
73# Link files. 71# Link files.
74$(ELF): $(SRC_MAIN) $(WATCH_SRC) 72$(ELF): $(SRC_MAIN) $(WATCH_SRC) | $(BUILD_DIR)
75 $(CC) $(CFLAGS) $(LDFLAGS) -o $(ELF) $(SRC_MAIN) $(ASM_FILES) $(LDLIBS) 73 cp $(UXN_ROM) $(ROM_FILE)
74 $(OBJCOPY) --rename-section .data=.rodata \
75 -I binary -O elf32-littlearm $(ROM_FILE) $(ROM_OBJ)
76 $(CC) $(CFLAGS) $(LDFLAGS) -o $(ELF) $(SRC_MAIN) $(ASM_FILES) $(LDLIBS) $(ROM_OBJ)
76 77
77# Create build directory if needed. 78# Create build directory if needed.
78$(BUILD_DIR): 79$(BUILD_DIR):
@@ -85,6 +86,3 @@ run: main
85# Remove build directory. 86# Remove build directory.
86clean: 87clean:
87 rm -rf $(BUILD_DIR) 88 rm -rf $(BUILD_DIR)
88
89$(TOOLS_BIN2CARR):
90 make -C tools/bin2carr