summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2019-09-08 21:26:46 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2019-09-08 21:26:46 -0400
commit888cbd634c746307a3992218a384139bfd5534d5 (patch)
treec93b0efe699f4cf33f7108de1b97d523fd1c70e2 /Makefile
parent306ce048ad07d62bed2028bfc8f30c03f5bc8db7 (diff)
libagbsyscall as an actual lib
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 10 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 451a28740..6869e5df1 100644
--- a/Makefile
+++ b/Makefile
@@ -82,7 +82,7 @@ endif
LDFLAGS = -Map ../../$(MAP)
-LIB := $(LIBPATH) -lgcc -lc
+LIB := $(LIBPATH) -lgcc -lc -L../../libagbsyscall -lagbsyscall
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
GFX := tools/gbagfx/gbagfx$(EXE)
@@ -111,7 +111,7 @@ MAKEFLAGS += --no-print-directory
# Secondary expansion is required for dependency variables in object rules.
.SECONDEXPANSION:
-.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix
+.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall
infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line))))
@@ -161,7 +161,7 @@ tools: $(TOOLDIRS)
$(TOOLDIRS):
@$(MAKE) -C $@ CC=$(HOSTCC) CXX=$(HOSTCXX)
-rom: berry_fix $(ROM)
+rom: $(ROM)
ifeq ($(COMPARE),1)
@$(SHA1) rom.sha1
endif
@@ -182,7 +182,9 @@ mostlyclean: tidy
rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +
rm -f $(AUTO_GEN_TARGETS)
+ rm -f $(OBJ_DIR)/libagbsyscall.a
@$(MAKE) clean -C berry_fix
+ @$(MAKE) clean -C libagbsyscall
tidy:
rm -f $(ROM) $(ELF) $(MAP)
@@ -310,7 +312,7 @@ endif
$(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS)
cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT) > ld_script.ld
-$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS)
+$(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) libagbsyscall
cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB)
$(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent
@@ -323,4 +325,7 @@ modern: ; @$(MAKE) MODERN=1
berry_fix/berry_fix.gba: berry_fix
berry_fix:
- @$(MAKE) -C berry_fix COMPARE=$(COMPARE)
+ @$(MAKE) -C berry_fix COMPARE=$(COMPARE) TOOLCHAIN=$(TOOLCHAIN)
+
+libagbsyscall:
+ @$(MAKE) -C libagbsyscall TOOLCHAIN=$(TOOLCHAIN)