Skip to content

Commit

Permalink
Fix unnecessary dependency scanning for test build and test rom names (
Browse files Browse the repository at this point in the history
  • Loading branch information
hedara90 authored Oct 27, 2024
2 parents 2ccc91e + a2c64b0 commit 1a1270a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ ELF_NAME := $(ROM_NAME:.gba=.elf)
MAP_NAME := $(ROM_NAME:.gba=.map)
MODERN_ELF_NAME := $(MODERN_ROM_NAME:.gba=.elf)
MODERN_MAP_NAME := $(MODERN_ROM_NAME:.gba=.map)
TESTELF = $(ROM_NAME:.gba=-test.elf)
HEADLESSELF = $(ROM_NAME:.gba=-test-headless.elf)
TESTELF = $(MODERN_ROM_NAME:.gba=-test.elf)
HEADLESSELF = $(MODERN_ROM_NAME:.gba=-test-headless.elf)

# Pick our active variables
ifeq ($(MODERN),0)
Expand Down Expand Up @@ -407,6 +407,13 @@ ifneq ($(NODEP),1)
-include $(addprefix $(OBJ_DIR)/,$(C_SRCS:.c=.d))
endif

$(TEST_BUILDDIR)/%.o: $(TEST_SUBDIR)/%.c
@echo "$(CC1) <flags> -o $@ $<"
@$(CPP) $(CPPFLAGS) $< | $(PREPROC) -i $< charmap.txt | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ -

$(TEST_BUILDDIR)/%.d: $(TEST_SUBDIR)/%.c
$(SCANINC) -M $@ $(INCLUDE_SCANINC_ARGS) -I tools/agbcc/include $<

$(ASM_BUILDDIR)/%.o: $(ASM_SUBDIR)/%.s
$(AS) $(ASFLAGS) -o $@ $<

Expand Down Expand Up @@ -450,14 +457,6 @@ $(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt
$(DATA_SRC_SUBDIR)/pokemon/teachable_learnsets.h: $(DATA_ASM_BUILDDIR)/event_scripts.o
python3 $(TOOLS_DIR)/learnset_helpers/teachable.py

# NOTE: Based on C_DEP above, but without NODEP and KEEP_TEMPS handling.
define TEST_DEP
$1: $2 $$(shell $(SCANINC) -I include -I $(TOOLS_DIR)/agbcc/include $2)
@echo "$$(CC1) <flags> -o $$@ $$<"
@$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) -i $$< charmap.txt | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ -
endef
$(foreach src, $(TEST_SRCS), $(eval $(call TEST_DEP,$(patsubst $(TEST_SUBDIR)/%.c,$(TEST_BUILDDIR)/%.o,$(src)),$(src),$(patsubst $(TEST_SUBDIR)/%.c,%,$(src)))))

# Linker script
ifeq ($(MODERN),0)
LD_SCRIPT := ld_script.ld
Expand Down

0 comments on commit 1a1270a

Please sign in to comment.