aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2023-09-08 13:14:10 +0200
committerBad Diode <bd@badd10de.dev>2023-09-08 13:14:10 +0200
commitc9a2f4a3cb84f1f16a9a300454f52c072bd5f779 (patch)
treec3e67263b7ced3ee6d474259f4016bd308137c96 /Makefile
parent7862310f04f40a9eb5aba0903c472b6656ec2a8f (diff)
downloaduxngba-main.tar.gz
uxngba-main.zip
Update build system to allow switching roms without make cleanHEADmain
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 9 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index ac6f24d..8da65eb 100644
--- a/Makefile
+++ b/Makefile
@@ -60,19 +60,22 @@ endif
60 60
61main: $(BUILD_DIR) $(ROM) $(BIN) 61main: $(BUILD_DIR) $(ROM) $(BIN)
62 62
63$(ROM): $(TOOLS_BIN2CARR) 63# Creates the rom object file from the given UXN_ROM.
64 ./tools/bin2carr/build/bin2carr -n uxn_rom -e u8 -o $(ROM) $(UXN_ROM) 64$(ROM_FILE):
65 cp $(UXN_ROM) $(ROM_FILE)
66
67$(ROM_OBJ): $(ROM_FILE)
68 $(OBJCOPY) --rename-section .data=.rodata \
69 -I binary -O elf32-littlearm $(ROM_FILE) $(ROM_OBJ)
65 70
66# Strip and fix header to create final .gba file. 71# Strip and fix header to create final .gba file.
67$(BIN): $(ELF) 72$(BIN): $(ELF)
68 $(OBJCOPY) -v -O binary $(ELF) $(BIN) 73 $(OBJCOPY) -v -O binary $(ELF) $(BIN)
69 $(DEVKITTOOLS)/gbafix $(BIN) 74 $(DEVKITTOOLS)/gbafix $(BIN)
75 rm $(ROM_FILE)
70 76
71# Link files. 77# Link files.
72$(ELF): $(SRC_MAIN) $(WATCH_SRC) | $(BUILD_DIR) 78$(ELF): $(SRC_MAIN) $(WATCH_SRC) $(ROM_OBJ) | $(BUILD_DIR)
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) 79 $(CC) $(CFLAGS) $(LDFLAGS) -o $(ELF) $(SRC_MAIN) $(ASM_FILES) $(LDLIBS) $(ROM_OBJ)
77 80
78# Create build directory if needed. 81# Create build directory if needed.