From ec1f149fc83c2e6554f414279bd224fb3b479ada Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 17 Apr 2020 13:38:38 -0400 Subject: add metrowerk assembler patcher and automate it during the build. --- Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index fac3e52f..06087477 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,12 @@ default: all +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + ################ Target Executable and Sources ############### BUILD_DIR := build @@ -24,6 +30,14 @@ S_FILES := $(foreach dir,$(ASM_DIRS),$(wildcard $(dir)/*.s)) # Object files O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \ $(foreach file,$(S_FILES),$(BUILD_DIR)/$(file:.s=.o)) \ + +################### Universal Dependencies ################### + +# Make tools if out of date +DUMMY != make -s -C tools >&2 || echo FAIL +ifeq ($(DUMMY),FAIL) + $(error Failed to build tools) +endif ##################### Compiler Options ####################### @@ -57,10 +71,17 @@ CFLAGS = -O4,p -proc v5te -thumb -fp soft -lang c -Cpp_exceptions off -interwork # DS TOOLS TOOLS_DIR = tools SHA1SUM = sha1sum +MWASMARM_PATCHER = tools/mwasmarm_patcher/mwasmarm_patcher$(EXE) + +DUMMY != $(MWASMARM_PATCHER) $(MWASMARM) || echo FAIL +ifeq ($(DUMMY),FAIL) + $(error MWASMARM patcher returned an error) +endif ######################### Targets ########################### all: $(ROM) + $(info Test) @$(SHA1SUM) -c $(TARGET).sha1 clean: -- cgit v1.2.3 From 1c3d43b94ccb8d2bd60df4d7c2d5c3b9963920ac Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Fri, 17 Apr 2020 13:43:01 -0400 Subject: fixes --- Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 06087477..cd726fe7 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,6 @@ endif ######################### Targets ########################### all: $(ROM) - $(info Test) @$(SHA1SUM) -c $(TARGET).sha1 clean: -- cgit v1.2.3 From 6446890d29234348c6af89982db4a4d8518855d4 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 18 Apr 2020 00:00:48 -0400 Subject: tidy up dependencies and tweak Makefile to show tool being ran once at start --- Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index cd726fe7..0b43fef2 100644 --- a/Makefile +++ b/Makefile @@ -73,11 +73,6 @@ TOOLS_DIR = tools SHA1SUM = sha1sum MWASMARM_PATCHER = tools/mwasmarm_patcher/mwasmarm_patcher$(EXE) -DUMMY != $(MWASMARM_PATCHER) $(MWASMARM) || echo FAIL -ifeq ($(DUMMY),FAIL) - $(error MWASMARM patcher returned an error) -endif - ######################### Targets ########################### all: $(ROM) @@ -86,12 +81,15 @@ all: $(ROM) clean: $(RM) -r $(BUILD_DIR) +patch_mwasmarm: + $(MWASMARM_PATCHER) $(MWASMARM) + ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS)) $(BUILD_DIR)/%.o: %.c $(CC) -c $(CFLAGS) -o $@ $< -$(BUILD_DIR)/%.o: %.s +$(BUILD_DIR)/%.o: %.s patch_mwasmarm $(AS) $(ASFLAGS) $< -o $@ $(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) -- cgit v1.2.3 From 5f1318919376ec679f5300257b41b28dc68e6f4f Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sat, 18 Apr 2020 13:51:39 -0400 Subject: update mwasmarm_patcher to get rid of libssl dependency. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 0b43fef2..3a21944c 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ O_FILES := $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \ ################### Universal Dependencies ################### # Make tools if out of date -DUMMY != make -s -C tools >&2 || echo FAIL +DUMMY != make -s -C tools/mwasmarm_patcher >&2 || echo FAIL ifeq ($(DUMMY),FAIL) $(error Failed to build tools) endif @@ -96,7 +96,7 @@ $(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) $(CPP) $(VERSION_CFLAGS) -MMD -MP -MT $@ -MF $@.d -I include/ -I . -DBUILD_DIR=$(BUILD_DIR) -o $@ $< $(ELF): $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) - $(LD) $(BUILD_DIR)/$(LD_SCRIPT) -o $(ELF) $(O_FILES) -nodead -w off + $(LD) $(BUILD_DIR)/$(LD_SCRIPT) -o $(ELF) $(O_FILES) -nodead -w off -interworking $(ROM): $(ELF) $(OBJCOPY) -O binary $< $@ -- cgit v1.2.3 From 3fdec1129fa78a5bbb1893a850e0245a6d082be9 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 19 Apr 2020 01:37:04 -0400 Subject: cleanup dependencies and add WINE and devkitARM support to Makefile --- Makefile | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3a21944c..41cd85c0 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,29 @@ # Makefile to build Pokemon Diamond image +# Try to include devkitarm if installed +TOOLCHAIN := $(DEVKITARM) + +ifneq (,$(wildcard $(TOOLCHAIN)/base_tools)) +include $(TOOLCHAIN)/base_tools +endif + ### Default target ### default: all +# If you are using WSL, it is recommended you build with NOWINE=1. +NOWINE ?= 0 + ifeq ($(OS),Windows_NT) EXE := .exe +WINE := else -EXE := +EXE := +WINE := wine +endif + +ifeq ($(NOWINE),1) +WINE := endif ################ Target Executable and Sources ############### @@ -43,7 +59,7 @@ endif MWCCVERSION := 2.0/base -CROSS := arm-linux-gnueabi- +CROSS := arm-none-eabi- MWCCARM := tools/mwccarm/$(MWCCVERSION)/mwccarm.exe # Argh... due to EABI version shenanigans, we can't use GNU LD to link together @@ -54,10 +70,10 @@ MWCCARM := tools/mwccarm/$(MWCCVERSION)/mwccarm.exe MWLDARM := tools/mwccarm/$(MWCCVERSION)/mwldarm.exe MWASMARM := tools/mwccarm/$(MWCCVERSION)/mwasmarm.exe -AS := $(MWASMARM) -CC := $(MWCCARM) +AS := $(WINE)$(MWASMARM) +CC := $(WINE)$(MWCCARM) CPP := cpp -P -LD := $(MWLDARM) +LD := $(WINE)$(MWLDARM) AR := $(CROSS)ar OBJDUMP := $(CROSS)objdump OBJCOPY := $(CROSS)objcopy @@ -96,7 +112,7 @@ $(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) $(CPP) $(VERSION_CFLAGS) -MMD -MP -MT $@ -MF $@.d -I include/ -I . -DBUILD_DIR=$(BUILD_DIR) -o $@ $< $(ELF): $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) - $(LD) $(BUILD_DIR)/$(LD_SCRIPT) -o $(ELF) $(O_FILES) -nodead -w off -interworking + $(LD) $(BUILD_DIR)/$(LD_SCRIPT) -o $(ELF) $(O_FILES) -nodead -w off $(ROM): $(ELF) $(OBJCOPY) -O binary $< $@ -- cgit v1.2.3 From 668d5ecfff5a394428fa8a59a7fb7bbbe753bc4b Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 19 Apr 2020 10:54:54 -0400 Subject: wine quotes --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 41cd85c0..71efca0f 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ EXE := .exe WINE := else EXE := -WINE := wine +WINE := "wine " endif ifeq ($(NOWINE),1) -- cgit v1.2.3 From b3306f5d5a899cae77b9a954ae2798e9b648c899 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 19 Apr 2020 11:07:15 -0400 Subject: phony targets --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 71efca0f..3b9d1431 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ # Makefile to build Pokemon Diamond image +.PHONY: clean tidy all default + # Try to include devkitarm if installed TOOLCHAIN := $(DEVKITARM) @@ -94,7 +96,10 @@ MWASMARM_PATCHER = tools/mwasmarm_patcher/mwasmarm_patcher$(EXE) all: $(ROM) @$(SHA1SUM) -c $(TARGET).sha1 -clean: +clean: tidy + make -C tools/mwasmarm_patcher clean + +tidy: $(RM) -r $(BUILD_DIR) patch_mwasmarm: -- cgit v1.2.3 From cf55512d13a434105036e1101391bd24ee682262 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Sun, 19 Apr 2020 12:08:28 -0400 Subject: wine spacing --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3b9d1431..6a43a9c8 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ EXE := .exe WINE := else EXE := -WINE := "wine " +WINE := wine endif ifeq ($(NOWINE),1) @@ -72,10 +72,10 @@ MWCCARM := tools/mwccarm/$(MWCCVERSION)/mwccarm.exe MWLDARM := tools/mwccarm/$(MWCCVERSION)/mwldarm.exe MWASMARM := tools/mwccarm/$(MWCCVERSION)/mwasmarm.exe -AS := $(WINE)$(MWASMARM) -CC := $(WINE)$(MWCCARM) +AS := $(WINE) $(MWASMARM) +CC := $(WINE) $(MWCCARM) CPP := cpp -P -LD := $(WINE)$(MWLDARM) +LD := $(WINE) $(MWLDARM) AR := $(CROSS)ar OBJDUMP := $(CROSS)objdump OBJCOPY := $(CROSS)objcopy -- cgit v1.2.3