mirror of
https://github.com/sonicdcer/sf64.git
synced 2024-11-26 22:40:42 +00:00
MacOS Building Support (#59)
* Fixed MacOS compilation * Updated spimdisasm requirement to use latest develop * Updated README * Fixed python requirements * Readded --gc-sections on mio0 * Added a conditional flag for gc-sections * Fixed indentation errors
This commit is contained in:
parent
510071802a
commit
d7d9e472c3
29
Makefile
29
Makefile
@ -5,6 +5,9 @@
|
|||||||
|
|
||||||
MAKEFLAGS += --no-builtin-rules --no-print-directory
|
MAKEFLAGS += --no-builtin-rules --no-print-directory
|
||||||
|
|
||||||
|
# Returns the path to the command $(1) if exists. Otherwise returns an empty string.
|
||||||
|
find-command = $(shell which $(1) 2>/dev/null)
|
||||||
|
|
||||||
#### Defaults ####
|
#### Defaults ####
|
||||||
|
|
||||||
# If COMPARE is 1, check the output md5sum after building
|
# If COMPARE is 1, check the output md5sum after building
|
||||||
@ -30,8 +33,16 @@ VERBOSE ?= 0
|
|||||||
PRINT ?= printf
|
PRINT ?= printf
|
||||||
|
|
||||||
# Set prefix to mips binutils binaries (mips-linux-gnu-ld => 'mips-linux-gnu-') - Change at your own risk!
|
# Set prefix to mips binutils binaries (mips-linux-gnu-ld => 'mips-linux-gnu-') - Change at your own risk!
|
||||||
# In nearly all cases, not having 'mips-linux-gnu-*' binaries on the PATH is indicative of missing dependencies
|
# Auto-detect prefix for MIPS toolchain
|
||||||
MIPS_BINUTILS_PREFIX ?= mips-linux-gnu-
|
ifneq ($(call find-command,mips-linux-gnu-ld),)
|
||||||
|
MIPS_BINUTILS_PREFIX := mips-linux-gnu-
|
||||||
|
else ifneq ($(call find-command,mips64-linux-gnu-ld),)
|
||||||
|
MIPS_BINUTILS_PREFIX := mips64-linux-gnu-
|
||||||
|
else ifneq ($(call find-command,mips64-elf-ld),)
|
||||||
|
MIPS_BINUTILS_PREFIX := mips64-elf-
|
||||||
|
else
|
||||||
|
$(error Unable to detect a suitable MIPS toolchain installed)
|
||||||
|
endif
|
||||||
|
|
||||||
VERSION ?= us
|
VERSION ?= us
|
||||||
|
|
||||||
@ -81,7 +92,7 @@ else ifeq ($(UNAME_S),Linux)
|
|||||||
CC_CHECK_COMP := arm-linux-gnueabihf-gcc
|
CC_CHECK_COMP := arm-linux-gnueabihf-gcc
|
||||||
endif
|
endif
|
||||||
else ifeq ($(UNAME_S),Darwin)
|
else ifeq ($(UNAME_S),Darwin)
|
||||||
DETECTED_OS := mac
|
DETECTED_OS := macos
|
||||||
MAKE := gmake
|
MAKE := gmake
|
||||||
CPPFLAGS += -xc++
|
CPPFLAGS += -xc++
|
||||||
endif
|
endif
|
||||||
@ -123,11 +134,19 @@ AS := $(MIPS_BINUTILS_PREFIX)as
|
|||||||
LD := $(MIPS_BINUTILS_PREFIX)ld
|
LD := $(MIPS_BINUTILS_PREFIX)ld
|
||||||
OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy
|
OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy
|
||||||
OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
|
OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
|
||||||
CPP := cpp
|
|
||||||
ICONV := iconv
|
ICONV := iconv
|
||||||
ASM_PROC := $(PYTHON) $(TOOLS)/asm-processor/build.py
|
ASM_PROC := $(PYTHON) $(TOOLS)/asm-processor/build.py
|
||||||
CAT := cat
|
CAT := cat
|
||||||
|
|
||||||
|
# Prefer clang as C preprocessor if installed on the system
|
||||||
|
ifneq (,$(call find-command,clang))
|
||||||
|
CPP := clang
|
||||||
|
CPPFLAGS := -E -P -x c -Wno-trigraphs -D_LANGUAGE_ASSEMBLY
|
||||||
|
else
|
||||||
|
CPP := cpp
|
||||||
|
CPPFLAGS := -P -Wno-trigraphs -D_LANGUAGE_ASSEMBLY
|
||||||
|
endif
|
||||||
|
|
||||||
ASM_PROC_FLAGS := --input-enc=utf-8 --output-enc=euc-jp --convert-statics=global-with-filename
|
ASM_PROC_FLAGS := --input-enc=utf-8 --output-enc=euc-jp --convert-statics=global-with-filename
|
||||||
|
|
||||||
SPLAT ?= $(PYTHON) $(TOOLS)/splat/split.py
|
SPLAT ?= $(PYTHON) $(TOOLS)/splat/split.py
|
||||||
@ -286,7 +305,7 @@ init:
|
|||||||
SF := ___ ___\n/ __|| _|\n\__ \| _|\n|___/|_|\n
|
SF := ___ ___\n/ __|| _|\n\__ \| _|\n|___/|_|\n
|
||||||
uncompressed: $(ROM)
|
uncompressed: $(ROM)
|
||||||
ifneq ($(COMPARE),0)
|
ifneq ($(COMPARE),0)
|
||||||
@echo "$(GREEN)Calculating Rom Header Checksum... $(YELLOW)$<$(NO_COL)"
|
@echo "$(GREEN)Calculating Rom Header Checksum... $(YELLOW)$<$(NO_COL)"
|
||||||
@$(PYTHON) $(COMPTOOL) -r $(ROM) .
|
@$(PYTHON) $(COMPTOOL) -r $(ROM) .
|
||||||
@md5sum --status -c $(TARGET).$(VERSION).uncompressed.md5 && \
|
@md5sum --status -c $(TARGET).$(VERSION).uncompressed.md5 && \
|
||||||
$(PRINT) "$(BLUE)$(TARGET).$(VERSION).uncompressed.z64$(NO_COL): $(GREEN)OK$(NO_COL)\n$(YELLOW) $(SF)" || \
|
$(PRINT) "$(BLUE)$(TARGET).$(VERSION).uncompressed.z64$(NO_COL): $(GREEN)OK$(NO_COL)\n$(YELLOW) $(SF)" || \
|
||||||
|
11
README.md
11
README.md
@ -34,7 +34,16 @@ Under Debian / Ubuntu (which we recommend using), you can install them with the
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install make git build-essential binutils-mips-linux-gnu python3 python3-pip clang-format-14 clang-tidy
|
sudo apt install make git build-essential binutils-mips-linux-gnu python3 python3-pip clang-format-14 clang-tidy
|
||||||
|
```
|
||||||
|
|
||||||
|
### MacOS
|
||||||
|
|
||||||
|
#### 1. Install build dependencies
|
||||||
|
Install [Homebrew](https://brew.sh) and the following dependencies:
|
||||||
|
```
|
||||||
|
brew update
|
||||||
|
brew install coreutils make pkg-config tehzz/n64-dev/mips64-elf-binutils
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 2. Clone the repository
|
#### 2. Clone the repository
|
||||||
|
@ -2,11 +2,13 @@ CC = gcc
|
|||||||
|
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
$(error Native Windows is currently unsupported for building this repository, use WSL instead c:)
|
$(error Native Windows is currently unsupported for building this repository, use WSL instead c:)
|
||||||
else ifeq ($(UNAME_S),Linux)
|
else ifeq ($(UNAME_S),Linux)
|
||||||
DETECTED_OS := linux
|
DETECTED_OS := linux
|
||||||
|
MIO0_FLAGS := --gc-sections
|
||||||
else ifeq ($(UNAME_S),Darwin)
|
else ifeq ($(UNAME_S),Darwin)
|
||||||
DETECTED_OS := mac
|
DETECTED_OS := macos
|
||||||
|
MIO0_FLAGS :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
RECOMP_DIR := ido-recomp/$(DETECTED_OS)
|
RECOMP_DIR := ido-recomp/$(DETECTED_OS)
|
||||||
@ -30,6 +32,6 @@ recomp:
|
|||||||
|
|
||||||
mio0:
|
mio0:
|
||||||
@echo "Building mio0..."
|
@echo "Building mio0..."
|
||||||
$(CC) -Wall -Wextra -Wno-format-overflow -O2 -ffunction-sections -fdata-sections -DMIO0_STANDALONE -s -Wl,--gc-sections -o mio0 mio0-decompressor/libmio0.c
|
$(CC) -Wall -Wextra -Wno-format-overflow -O2 -ffunction-sections -fdata-sections -DMIO0_STANDALONE -s -Wl,${MIO0_FLAGS} -o mio0 mio0-decompressor/libmio0.c
|
||||||
|
|
||||||
.PHONY: all clean distclean default
|
.PHONY: all clean distclean default
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
spimdisasm==1.17.0
|
spimdisasm==1.20.0
|
||||||
rabbitizer==1.7.0
|
rabbitizer==1.7.0
|
||||||
PyYAML
|
PyYAML
|
||||||
pylibyaml
|
pylibyaml
|
||||||
|
Loading…
Reference in New Issue
Block a user