aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2022-10-20 14:31:37 +0200
committerBad Diode <bd@badd10de.dev>2022-10-20 14:31:37 +0200
commitbc14ac83a5ad898aafd312e4d5f8fe8f43c60b0f (patch)
treed2f01bb2cd1ce28e2908fada710e3be4971d1e94 /Makefile
parent42dcdb3a98a957974225b5f699c02891db176c55 (diff)
downloaduxn64-bc14ac83a5ad898aafd312e4d5f8fe8f43c60b0f.tar.gz
uxn64-bc14ac83a5ad898aafd312e4d5f8fe8f43c60b0f.zip
Replace makemask with custom C code
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile23
1 files changed, 14 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index f69dd8d..57e7ceb 100644
--- a/Makefile
+++ b/Makefile
@@ -32,10 +32,12 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS))
32# Output names and executables. 32# Output names and executables.
33TARGET := uxn64 33TARGET := uxn64
34ELF := $(BUILD_DIR)/$(TARGET).elf 34ELF := $(BUILD_DIR)/$(TARGET).elf
35BIN := $(BUILD_DIR)/$(TARGET).n64 35BIN := $(BUILD_DIR)/$(TARGET).bin
36ROM := $(BUILD_DIR)/$(TARGET).n64
36 37
37# Target tools. 38# Target tools.
38TOOLS_BIN2CARR := tools/bin2carr/build/bin2carr 39TOOLS_BIN2CARR := tools/bin2carr/build/bin2carr
40TOOLS_MAKEROM := tools/makerom/build/makerom
39 41
40# Main compilation tool paths. 42# Main compilation tool paths.
41CC := $(SDK_BIN)/mips32-elf-gcc 43CC := $(SDK_BIN)/mips32-elf-gcc
@@ -43,8 +45,6 @@ LD := $(SDK_BIN)/mips32-elf-ld
43AS := $(SDK_BIN)/mips32-elf-as 45AS := $(SDK_BIN)/mips32-elf-as
44OBJDUMP := $(SDK_BIN)/mips32-elf-objdump 46OBJDUMP := $(SDK_BIN)/mips32-elf-objdump
45OBJCOPY := $(SDK_BIN)/mips32-elf-objcopy 47OBJCOPY := $(SDK_BIN)/mips32-elf-objcopy
46# TODO: Replace with internal tools to avoid dependencies.
47MAKEMASK := $(SDK_BIN)/makemask
48 48
49# Compiler and linker configuration. 49# Compiler and linker configuration.
50CFLAGS := -Wall -Wextra -pedantic 50CFLAGS := -Wall -Wextra -pedantic
@@ -65,16 +65,18 @@ else
65 CFLAGS += $(RELEASE_CFLAGS) 65 CFLAGS += $(RELEASE_CFLAGS)
66endif 66endif
67 67
68main: $(BIN) 68main: $(ROM)
69 69
70# Compile the elf file. 70# Compile the elf file.
71$(ELF): $(SRC_MAIN) $(UXN_ROM_C) $(WATCH_SRC) | $(BUILD_DIR) 71$(ELF): $(SRC_MAIN) $(UXN_ROM_C) $(WATCH_SRC) | $(BUILD_DIR)
72 $(CC) $(CFLAGS) $(LDFLAGS) -o $(ELF) -T $(SRC_LN) $(SRC_MAIN) $(LDLIBS) 72 $(CC) $(CFLAGS) $(LDFLAGS) -o $(ELF) -T $(SRC_LN) $(SRC_MAIN) $(LDLIBS)
73 73
74# Create the valid .n64 rom from the elf file. 74# Create the valid .n64 rom from the elf file.
75$(BIN): $(ELF) $(OBJECTS) $(WATCH_SRC) | $(BUILD_DIR) 75$(BIN): $(ELF) $(WATCH_SRC) | $(BUILD_DIR)
76 $(OBJCOPY) -O binary $< $@ 76 $(OBJCOPY) -O binary $(ELF) $(BIN)
77 $(MAKEMASK) $(BIN) 77
78$(ROM): $(BIN) $(TOOLS_MAKEROM) $(WATCH_SRC) | $(BUILD_DIR)
79 $(TOOLS_MAKEROM) $(BIN) -o $(ROM)
78 80
79# Build the uxn rom's C file. 81# Build the uxn rom's C file.
80$(UXN_ROM_C): $(TOOLS_BIN2CARR) | $(BUILD_DIR) 82$(UXN_ROM_C): $(TOOLS_BIN2CARR) | $(BUILD_DIR)
@@ -84,9 +86,12 @@ $(UXN_ROM_C): $(TOOLS_BIN2CARR) | $(BUILD_DIR)
84$(TOOLS_BIN2CARR): 86$(TOOLS_BIN2CARR):
85 make -C tools/bin2carr 87 make -C tools/bin2carr
86 88
89$(TOOLS_MAKEROM):
90 make -C tools/makerom
91
87# Test the output .n64 in an emulator. 92# Test the output .n64 in an emulator.
88run: $(BIN) 93run: $(ROM)
89 $(EMULATOR) $(BIN) 94 $(EMULATOR) $(ROM)
90 95
91# Remove build directory. 96# Remove build directory.
92clean: 97clean: