diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-01-29 17:09:43 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-01-29 17:09:43 -0400 |
commit | 3125154316a235574579e9d25985236bd799982b (patch) | |
tree | fb0fb6e163370d1b894e33454e18a2123db17990 /Makefile | |
parent | 0a9de9d69124f425a22c225a7b9a5c85d7fb4d4b (diff) |
Add `Makefile`, and `obj_files.mk`
This makefile is based on the one from the Super Mario Sunshine
decompilation project. https://github.com/doldecomp/sms
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9278985 --- /dev/null +++ b/Makefile @@ -0,0 +1,70 @@ +NAME := pso-gc + +BUILD_DIR := build/$(NAME) + +DOL := $(BUILD_DIR)/PsoV3.dol +ELF := $(DOL:.dol=.elf) + +WINE := wine +DEVKITPPC := /opt/devkitpro/devkitPPC + +MWCC_VERSION := 1.3.2 +MWLD_VERSION := 1.3.2 + +ASM_INPUTS := $(wildcard asm/*.s) +C_INPUTS := $(wildcard src/*.c) +CPP_INPUTS := $(wildcard src/*.cpp) +LDSCRIPT := $(BUILD_DIR)/ldscript.lcf + +AS := $(DEVKITPPC)/bin/powerpc-eabi-as +CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp -P + +CC := $(WINE) tools/mwcc_compiler/$(MWCC_VERSION)/mwcceppc.exe +LD := $(WINE) tools/mwcc_compiler/$(MWCC_VERSION)/mwldeppc.exe + +INCLUDES := -i include/ +ASM_INCLUDES := -I include/ + + +LDFLAGS := -fp hard -nodefaults + +ASFLAGS := -mgekko $(ASM_INCLUDES) + +CFLAGS := -nodefaults -proc gekko -fp hard -O4 -use_lmw_stmw on -str reuse -RTTI off -rostr -sdata2 4 $(INCLUDES) + +include obj_files.mk + +ALL_DIRS := $(sort $(dir $(O_FILES))) + +default: all + +all: $(ELF) + +DUMMY != mkdir -p $(ALL_DIRS) + +$(LDSCRIPT): ldscript.lcf + $(CPP) -MMD -MP -MT $@ -MF $@.d -I include/ -I . -DBUILD_DIR=$(BUILD_DIR) -o $@ $< + +clean: + rm -f -d -r build + find . -name '*.o' -exec rm {} + + +$(ELF): $(O_FILES) $(LDSCRIPT) + @echo $(O_FILES) > build/o_files + $(LD) $(LDFLAGS) -o $@ -lcf $(LDSCRIPT) @build/o_files + +$(BUILD_DIR)/%.o: %.s + @echo Assembling $< + $(QUIET) $(AS) $(ASFLAGS) -o $@ $< + +$(BUILD_DIR)/%.o: %.c + @echo "Compiling " $< + $(QUIET) $(CC) $(CFLAGS) $(FILE_UNIQUE_CFLAGS) -c -o $@ $< + +$(BUILD_DIR)/%.o: %.cp + @echo "Compiling " $< + $(QUIET) $(CC) $(CFLAGS) $(FILE_UNIQUE_CFLAGS) -c -o $@ $< + +$(BUILD_DIR)/%.o: %.cpp + @echo "Compiling " $< + $(QUIET) $(CC) $(CFLAGS) $(FILE_UNIQUE_CFLAGS) -c -o $@ $< |