summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2020-04-15 08:58:21 -0400
committerPikalaxALT <PikalaxALT@gmail.com>2020-04-15 08:58:21 -0400
commita5332e2f9e029ca7c0003a5cd096af3c68ace5bb (patch)
treedf717f7c0590419d59e9dc246469dc6e5956b6e8 /Makefile
parentf9b7d7411b74e29e048ea7d48cf6d8302e50d2d4 (diff)
Finish filling out header
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 31 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index cb5149ba..e27daefb 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
@@ -48,15 +54,39 @@ CFLAGS = -O4,p -proc arm946e -thumb -fp soft -lang c -Cpp_exceptions off
# DS TOOLS
TOOLS_DIR = tools
SHA1SUM = sha1sum
+JSONPROC = $(TOOLS_DIR)/jsonproc/jsonproc
+
+TOOLDIRS = $(filter-out $(TOOLS_DIR)/mwccarm,$(wildcard $(TOOLS_DIR)/*))
+TOOLBASE = $(TOOLDIRS:$(TOOLS_DIR)/%=%)
+TOOLS = $(foreach tool,$(TOOLBASE),$(TOOLS_DIR)/$(tool)/$(tool)$(EXE))
######################### 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)
+else
+NODEP := 1
+endif
+
+.PHONY: all clean tools $(TOOLDIRS)
+
+MAKEFLAGS += --no-print-directory
+
all: $(ROM)
@$(SHA1SUM) -c $(TARGET).sha1
clean:
$(RM) -r $(BUILD_DIR)
+tools: $(TOOLDIRS)
+
+$(TOOLDIRS):
+ @$(MAKE) -C $@
+
ALL_DIRS := $(BUILD_DIR) $(addprefix $(BUILD_DIR)/,$(SRC_DIRS) $(ASM_DIRS))
$(BUILD_DIR)/%.o: %.c
@@ -72,7 +102,7 @@ $(ELF): $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) undefined_syms.txt
$(LD) -T undefined_syms.txt -T $(BUILD_DIR)/$(LD_SCRIPT) -o $(ELF) -Map $(BUILD_DIR)/$(TARGET).map
$(ROM): $(ELF)
- $(OBJCOPY) -O binary $< $@
+ $(OBJCOPY) -O binary --gap-fill=0xFF $< $@
# Make sure build directory exists before compiling anything
DUMMY != mkdir -p $(ALL_DIRS)