summaryrefslogtreecommitdiff
path: root/arm7
diff options
context:
space:
mode:
Diffstat (limited to 'arm7')
-rw-r--r--arm7/Makefile22
1 files changed, 17 insertions, 5 deletions
diff --git a/arm7/Makefile b/arm7/Makefile
index 67a07f26..882ab41c 100644
--- a/arm7/Makefile
+++ b/arm7/Makefile
@@ -3,12 +3,19 @@
.PHONY: clean tidy all default patch_mwasmarm
# Try to include devkitarm if installed
+ifdef DEVKITARM
TOOLCHAIN := $(DEVKITARM)
+endif
-ifneq (,$(wildcard $(TOOLCHAIN)/base_tools))
-include $(TOOLCHAIN)/base_tools
+ifdef TOOLCHAIN
+export PATH := $(TOOLCHAIN)/bin:$(PATH)
endif
+PREFIX := arm-none-eabi-
+
+OBJCOPY := $(PREFIX)objcopy
+AR := $(PREFIX)ar
+
### Default target ###
default: all
@@ -107,21 +114,24 @@ GFX = $(TOOLS_DIR)/nitrogfx/nitrogfx
SCANINC = $(TOOLS_DIR)/scaninc/scaninc$(EXE)
MWASMARM_PATCHER = $(TOOLS_DIR)/mwasmarm_patcher/mwasmarm_patcher$(EXE) -q
-TOOLDIRS = $(filter-out $(TOOLS_DIR)/asm_processor $(TOOLS_DIR)/mwccarm $(TOOLS_DIR)/bin,$(wildcard $(TOOLS_DIR)/*))
+TOOLDIRS = $(dir $(wildcard $(TOOLS_DIR)/*/Makefile))
TOOLBASE = $(TOOLDIRS:$(TOOLS_DIR)/%=%)
TOOLS = $(foreach tool,$(TOOLBASE),$(TOOLS_DIR)/$(tool)/$(tool)$(EXE))
+TOOLS: tools
+
export LM_LICENSE_FILE := $(TOOLS_DIR)/mwccarm/license.dat
export MWCIncludes := lib/include
######################### Targets ###########################
+######################## Targets ###########################
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
# Build tools when building the rom
# Disable dependency scanning for clean/tidy/tools
ifeq (,$(filter-out all,$(MAKECMDGOALS)))
-$(call infoshell, $(MAKE) tools patch_mwasmarm)
+$(call infoshell,$(MAKE) tools patch_mwasmarm)
else
NODEP := 1
endif
@@ -131,6 +141,8 @@ endif
MAKEFLAGS += --no-print-directory
+all: tools patch_mwasmarm
+
all: $(ROM)
ifeq ($(COMPARE),1)
@$(SHA1SUM) -c $(TARGET).sha1
@@ -185,7 +197,7 @@ $(ROM): $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) $(BIN_FILES)
$(OBJCOPY) --update-section arm7=$@ -j arm7 $(foreach ov,$(OVERLAYS),--update-section $(ov)=$(BUILD_DIR)/$(ov).sbin -j $(ov)) $(ELF) 2>/dev/null
# Make sure build directory exists before compiling anything
-DUMMY != mkdir -p $(ALL_DIRS)
+DUMMY := $(shell mkdir -p $(ALL_DIRS))
%.4bpp: %.png
$(GFX) $< $@