summaryrefslogtreecommitdiff
path: root/arm7/Makefile
diff options
context:
space:
mode:
authorThomas <doodrabbit@hotmail.com>2021-12-17 20:57:03 -0500
committerGitHub <noreply@github.com>2021-12-17 20:57:03 -0500
commitaf67eaffa7ab1a347a6f0e59ed7f1e107749d15a (patch)
treeb9f90f7b047b3dc5a411dbf65117bf07b237a37d /arm7/Makefile
parent3ab18655ca1311019212b3a2a9dbe32e5fbee55d (diff)
parent44cd7753b5dde323d1e8274b2dc8a5599729e83f (diff)
Merge pull request #463 from PikalaxALT/pikalax_workHEADmaster
Real-match math_util.c
Diffstat (limited to 'arm7/Makefile')
-rw-r--r--arm7/Makefile34
1 files changed, 23 insertions, 11 deletions
diff --git a/arm7/Makefile b/arm7/Makefile
index 67a07f26..0197c490 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
@@ -89,9 +96,9 @@ OBJDUMP := $(CROSS)objdump
OBJCOPY := $(CROSS)objcopy
# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm7_thumb.s -o arm7.o
-ASFLAGS = -proc arm4t -i ..
-CFLAGS = -O4,s -proc arm7tdmi -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all
-LDFLAGS = -map -nodead -w off -proc v4t -interworking -map -symtab -m _start
+MWASFLAGS = -proc arm4t -i ..
+MWCFLAGS = -O4,s -proc arm7tdmi -fp soft -lang c99 -Cpp_exceptions off -i ../include -ir ../include-mw -ir lib/include -interworking -DFS_IMPLEMENT -enum int -W all
+MWLDFLAGS = -map -nodead -w off -proc v4t -interworking -map -symtab -m _start
####################### Other Tools #########################
@@ -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
@@ -171,21 +183,21 @@ $(BUILD_DIR)/%.o: dep :=
endif
$(C_OBJS): $(BUILD_DIR)/%.o: %.c $$(dep)
- $(CC) -c $(CFLAGS) -o $@ $<
+ $(CC) -c $(MWCFLAGS) -o $@ $<
$(S_OBJS): $(BUILD_DIR)/%.o: %.s $$(dep)
- $(AS) $(ASFLAGS) -o $@ $<
+ $(AS) $(MWASFLAGS) -o $@ $<
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SPEC) $(LD_TEMPLATE)
$(MAKELSF) $< $(LD_TEMPLATE) $@
$(ROM): $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) $(BIN_FILES)
echo "$(O_FILES) $(BIN_FILES)" > $(ELF).objlist
- $(LD) $(LDFLAGS) $(BUILD_DIR)/$(LD_SCRIPT) -o $(ELF) @$(ELF).objlist
+ $(LD) $(MWLDFLAGS) $(BUILD_DIR)/$(LD_SCRIPT) -o $(ELF) @$(ELF).objlist
$(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) $< $@