diff options
author | Bad Diode <bd@badd10de.dev> | 2022-10-20 14:31:37 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2022-10-20 14:31:37 +0200 |
commit | bc14ac83a5ad898aafd312e4d5f8fe8f43c60b0f (patch) | |
tree | d2f01bb2cd1ce28e2908fada710e3be4971d1e94 /Makefile | |
parent | 42dcdb3a98a957974225b5f699c02891db176c55 (diff) | |
download | uxn64-bc14ac83a5ad898aafd312e4d5f8fe8f43c60b0f.tar.gz uxn64-bc14ac83a5ad898aafd312e4d5f8fe8f43c60b0f.zip |
Replace makemask with custom C code
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -32,10 +32,12 @@ INC_FLAGS := $(addprefix -I,$(INC_DIRS)) | |||
32 | # Output names and executables. | 32 | # Output names and executables. |
33 | TARGET := uxn64 | 33 | TARGET := uxn64 |
34 | ELF := $(BUILD_DIR)/$(TARGET).elf | 34 | ELF := $(BUILD_DIR)/$(TARGET).elf |
35 | BIN := $(BUILD_DIR)/$(TARGET).n64 | 35 | BIN := $(BUILD_DIR)/$(TARGET).bin |
36 | ROM := $(BUILD_DIR)/$(TARGET).n64 | ||
36 | 37 | ||
37 | # Target tools. | 38 | # Target tools. |
38 | TOOLS_BIN2CARR := tools/bin2carr/build/bin2carr | 39 | TOOLS_BIN2CARR := tools/bin2carr/build/bin2carr |
40 | TOOLS_MAKEROM := tools/makerom/build/makerom | ||
39 | 41 | ||
40 | # Main compilation tool paths. | 42 | # Main compilation tool paths. |
41 | CC := $(SDK_BIN)/mips32-elf-gcc | 43 | CC := $(SDK_BIN)/mips32-elf-gcc |
@@ -43,8 +45,6 @@ LD := $(SDK_BIN)/mips32-elf-ld | |||
43 | AS := $(SDK_BIN)/mips32-elf-as | 45 | AS := $(SDK_BIN)/mips32-elf-as |
44 | OBJDUMP := $(SDK_BIN)/mips32-elf-objdump | 46 | OBJDUMP := $(SDK_BIN)/mips32-elf-objdump |
45 | OBJCOPY := $(SDK_BIN)/mips32-elf-objcopy | 47 | OBJCOPY := $(SDK_BIN)/mips32-elf-objcopy |
46 | # TODO: Replace with internal tools to avoid dependencies. | ||
47 | MAKEMASK := $(SDK_BIN)/makemask | ||
48 | 48 | ||
49 | # Compiler and linker configuration. | 49 | # Compiler and linker configuration. |
50 | CFLAGS := -Wall -Wextra -pedantic | 50 | CFLAGS := -Wall -Wextra -pedantic |
@@ -65,16 +65,18 @@ else | |||
65 | CFLAGS += $(RELEASE_CFLAGS) | 65 | CFLAGS += $(RELEASE_CFLAGS) |
66 | endif | 66 | endif |
67 | 67 | ||
68 | main: $(BIN) | 68 | main: $(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. |
88 | run: $(BIN) | 93 | run: $(ROM) |
89 | $(EMULATOR) $(BIN) | 94 | $(EMULATOR) $(ROM) |
90 | 95 | ||
91 | # Remove build directory. | 96 | # Remove build directory. |
92 | clean: | 97 | clean: |