summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.gitattributes1
-rwxr-xr-xINSTALL.md2
-rwxr-xr-xMakefile31
-rwxr-xr-xbuild_tools.sh6
4 files changed, 31 insertions, 9 deletions
diff --git a/.gitattributes b/.gitattributes
index f1ad9c5..5607075 100755
--- a/.gitattributes
+++ b/.gitattributes
@@ -8,6 +8,7 @@ Makefile text eol=lf
*.pl text eol=lf
*.inc text eol=lf
*.sha1 text eol=lf
+*.sed text eol=lf
*.png binary
*.bin binary
diff --git a/INSTALL.md b/INSTALL.md
index fa30c70..13ee643 100755
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -32,7 +32,7 @@ To set up the repository:
./install.sh ../pokepinballrs
cd ../pokepinballrs
- ./build_tools.sh
+ make tools
Place a copy of the original ROM in the `pokepinballrs` directory, and name it `baserom.gba`. This is necessary because this is an incomplete disassembly.
diff --git a/Makefile b/Makefile
index 4c47d7a..663ec2a 100755
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,12 @@ GAME_CODE := BPPE
MAKER_CODE := 01
REVISION := 0
+HOSTCC = $(CC)
+HOSTCXX = $(CXX)
+HOSTCFLAGS = $(CFLAGS)
+HOSTCXXFLAGS = $(CXXFLAGS)
+HOST_VARS := CC=$(HOSTCC) CXX=$(HOSTCXX) CFLAGS='$(HOSTCFLAGS)' CXXFLAGS='$(HOSTCXXFLAGS)'
+
SHELL := /bin/bash -o pipefail
ROM := pokepinballrs.gba
@@ -47,6 +53,19 @@ PREPROC := tools/preproc/preproc$(EXE)
RAMSCRGEN := tools/ramscrgen/ramscrgen$(EXE)
FIX := tools/gbafix/gbafix$(EXE)
+TOOLS_DIR = tools
+TOOLDIRS = $(filter-out $(TOOLS_DIR)/agbcc,$(wildcard $(TOOLS_DIR)/*))
+
+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 compare,$(MAKECMDGOALS)))
+$(call infoshell, $(HOST_VARS) $(MAKE) tools)
+else
+NODEP := 1
+endif
+
# Clear the default suffixes
.SUFFIXES:
# Don't delete intermediate files
@@ -57,7 +76,7 @@ FIX := tools/gbafix/gbafix$(EXE)
# Secondary expansion is required for dependency variables in object rules.
.SECONDEXPANSION:
-.PHONY: rom clean compare tidy
+.PHONY: rom clean compare tidy tools clean-tools $(TOOLDIRS)
$(shell mkdir -p $(C_BUILDDIR) $(ASM_BUILDDIR) $(DATA_ASM_BUILDDIR))
@@ -79,13 +98,21 @@ rom: $(ROM)
compare: $(ROM)
@$(SHA1) pokepinballrs.sha1
-clean: tidy
+clean: tidy clean-tools
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
tidy:
rm -f $(ROM) $(ELF) $(MAP)
rm -r build/*
+tools: $(TOOLDIRS)
+
+$(TOOLDIRS):
+ @$(HOST_VARS) $(MAKE) -C $@
+
+clean-tools:
+ $(foreach tool,$(TOOLDIRS),$(MAKE) clean -C $(tool);)
+
include graphics_rules.mk
%.s: ;
diff --git a/build_tools.sh b/build_tools.sh
deleted file mode 100755
index c33d864..0000000
--- a/build_tools.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-make -C tools/gbafix CXX=${1:-g++}
-make -C tools/scaninc CXX=${1:-g++}
-make -C tools/gbagfx CXX=${1:-g++}
-make -C tools/preproc CXX=${1:-g++}
-make -C tools/ramscrgen CXX=${1:-g++}