Merge pull request #135 from ethteck/mac-support

Mac support
This commit is contained in:
Ethan Roseman 2020-12-07 09:21:39 +09:00 committed by GitHub
commit 1aa81bb3bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 42 additions and 3 deletions

2
.gitignore vendored
View File

@ -26,3 +26,5 @@ settings.mk
/img /img
/msg /msg
/sprite /sprite
tools/Yay0compress

View File

@ -58,6 +58,19 @@ CPP := cpp
LD := $(CROSS)ld LD := $(CROSS)ld
OBJCOPY := $(CROSS)objcopy OBJCOPY := $(CROSS)objcopy
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS=linux
ICONV := iconv --from UTF-8 --to SHIFT-JIS
endif
ifeq ($(UNAME_S),Darwin)
OS=mac
ICONV := tools/iconv.py UTF-8 SHIFT-JIS
endif
OLD_AS=tools/$(OS)/mips-nintendo-nu64-as
CC=tools/$(OS)/cc1
CPPFLAGS := -Iinclude -Isrc -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32 -Wundef -Wcomment CPPFLAGS := -Iinclude -Isrc -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32 -Wundef -Wcomment
ASFLAGS := -EB -Iinclude -march=vr4300 -mtune=vr4300 ASFLAGS := -EB -Iinclude -march=vr4300 -mtune=vr4300
OLDASFLAGS := -EB -Iinclude -G 0 OLDASFLAGS := -EB -Iinclude -G 0
@ -138,12 +151,12 @@ $(BUILD_DIR)/%.Yay0.o: $(BUILD_DIR)/%.bin.Yay0
# Compile C files # Compile C files
$(BUILD_DIR)/%.c.o: %.c $(MDEPS) | $(GENERATED_HEADERS) $(BUILD_DIR)/%.c.o: %.c $(MDEPS) | $(GENERATED_HEADERS)
@mkdir -p $(shell dirname $@) @mkdir -p $(shell dirname $@)
$(CPP) $(CPPFLAGS) -o - $(CPPMFLAGS) $< | iconv --from UTF-8 --to SHIFT-JIS | $(CC) $(CFLAGS) -o - | $(OLD_AS) $(OLDASFLAGS) -o $@ - $(CPP) $(CPPFLAGS) -o - $(CPPMFLAGS) $< | $(ICONV) | $(CC) $(CFLAGS) -o - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
# Compile C files (with DSL macros) # Compile C files (with DSL macros)
$(foreach cfile, $(DSL_C_FILES), $(BUILD_DIR)/$(cfile).o): $(BUILD_DIR)/%.c.o: %.c $(MDEPS) tools/compile_dsl_macros.py | $(GENERATED_HEADERS) $(foreach cfile, $(DSL_C_FILES), $(BUILD_DIR)/$(cfile).o): $(BUILD_DIR)/%.c.o: %.c $(MDEPS) tools/compile_dsl_macros.py | $(GENERATED_HEADERS)
@mkdir -p $(shell dirname $@) @mkdir -p $(shell dirname $@)
$(CPP) $(CPPFLAGS) -o - $< $(CPPMFLAGS) | $(PYTHON) tools/compile_dsl_macros.py | iconv --from UTF-8 --to SHIFT-JIS | $(CC) $(CFLAGS) -o - | $(OLD_AS) $(OLDASFLAGS) -o $@ - $(CPP) $(CPPFLAGS) -o - $< $(CPPMFLAGS) | $(PYTHON) tools/compile_dsl_macros.py | $(ICONV) | $(CC) $(CFLAGS) -o - | $(OLD_AS) $(OLDASFLAGS) -o $@ -
# Assemble handwritten ASM # Assemble handwritten ASM
$(BUILD_DIR)/%.s.o: %.s $(BUILD_DIR)/%.s.o: %.s

Binary file not shown.

23
tools/iconv.py Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/python3
import argparse
import sys
parser = argparse.ArgumentParser(description='Convert a file from one encoding to another')
parser.add_argument("f")
parser.add_argument("t")
parser.add_argument('infile', nargs='?', type=argparse.FileType('r'), default=sys.stdin)
parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'), default=sys.stdout)
args = parser.parse_args()
def main(args):
sys.stdin.reconfigure(encoding=args.f)
in_data = args.infile.read()
sys.stdout.reconfigure(encoding=args.t)
args.outfile.write(in_data)
if __name__ == "__main__":
main(parser.parse_args())

BIN
tools/mac/cc1 Executable file

Binary file not shown.

BIN
tools/mac/mips-nintendo-nu64-as Executable file

Binary file not shown.

@ -1 +1 @@
Subproject commit 25ef3afa263dc83bf1c6f9534a5da28b86c46a99 Subproject commit e0262202ef931e0a0d09a144fcded281d0dc1656

View File

@ -26,6 +26,7 @@ segments:
- type: code - type: code
start: 0x1000 start: 0x1000
vram: 0x80025C00 vram: 0x80025C00
subalign: 8
files: files:
- [0x1000, c, code_1000_len_60] - [0x1000, c, code_1000_len_60]
- [0x1060, c, code_1060_len_310] - [0x1060, c, code_1060_len_310]