summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiegoisawesome <Diegoisawesome@users.noreply.github.com>2018-11-15 14:25:21 -0600
committerGitHub <noreply@github.com>2018-11-15 14:25:21 -0600
commit09d09122bc27aeae337bca90d1a076a8de2f24bd (patch)
tree7517d3ce24e7de1c2c418a3a131f1824809e26d0
parent39f54b346d8121849250b18e4af2855e1d34c22d (diff)
parent87ec71f71b41c3e7ac7e4c4048f9ff8777b7b041 (diff)
Merge pull request #384 from garakmon/subdirs
Subdirectories in build
-rw-r--r--Makefile10
1 files changed, 6 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index b523ef320..002eb790d 100644
--- a/Makefile
+++ b/Makefile
@@ -65,9 +65,7 @@ FIX := tools/gbafix/gbafix$(EXE)
.PHONY: rom clean compare tidy
-$(shell mkdir -p $(C_BUILDDIR) $(ASM_BUILDDIR) $(DATA_ASM_BUILDDIR) $(SONG_BUILDDIR) $(MID_BUILDDIR))
-
-C_SRCS := $(wildcard $(C_SUBDIR)/*.c)
+C_SRCS := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c)
C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS))
ASM_SRCS := $(wildcard $(ASM_SUBDIR)/*.s)
@@ -82,9 +80,13 @@ SONG_OBJS := $(patsubst $(SONG_SUBDIR)/%.s,$(SONG_BUILDDIR)/%.o,$(SONG_SRCS))
MID_SRCS := $(wildcard $(MID_SUBDIR)/*.mid)
MID_OBJS := $(patsubst $(MID_SUBDIR)/%.mid,$(MID_BUILDDIR)/%.o,$(MID_SRCS))
-OBJS := $(C_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS)
+OBJS := $(C_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS)
OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS))
+SUBDIRS := $(sort $(dir $(OBJS)))
+
+$(shell mkdir -p $(SUBDIRS))
+
rom: $(ROM)
# For contributors to make sure a change didn't affect the contents of the ROM.