diff --git a/.gitignore b/.gitignore index 81813f5b8..dc782899d 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ *.hwjpnfont *.fwjpnfont sound/**/*.bin +sound/songs/midi/*.s tools/agbcc *.map *.ld diff --git a/Makefile b/Makefile index d9f3ec4c7..a088f8541 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,12 @@ include $(DEVKITARM)/base_tools export CPP := $(PREFIX)cpp export LD := $(PREFIX)ld +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + TITLE := POKEMON EMER GAME_CODE := BPEE MAKER_CODE := 01 @@ -19,15 +25,17 @@ C_SUBDIR = src ASM_SUBDIR = asm DATA_ASM_SUBDIR = data SONG_SUBDIR = sound/songs +MID_SUBDIR = sound/songs/midi C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR) ASM_BUILDDIR = $(OBJ_DIR)/$(ASM_SUBDIR) DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR) SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR) +MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR) ASFLAGS := -mcpu=arm7tdmi -CC1 := tools/agbcc/bin/agbcc +CC1 := tools/agbcc/bin/agbcc$(EXE) override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm CPPFLAGS := -I tools/agbcc/include -I tools/agbcc -iquote include -nostdinc -undef @@ -37,13 +45,13 @@ LDFLAGS = -Map ../../$(MAP) LIB := -L ../../tools/agbcc/lib -lgcc -lc SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c -GFX := tools/gbagfx/gbagfx -AIF := tools/aif2pcm/aif2pcm -MID := $(abspath tools/mid2agb/mid2agb) -SCANINC := tools/scaninc/scaninc -PREPROC := tools/preproc/preproc -RAMSCRGEN := tools/ramscrgen/ramscrgen -FIX := tools/gbafix/gbafix +GFX := tools/gbagfx/gbagfx$(EXE) +AIF := tools/aif2pcm/aif2pcm$(EXE) +MID := $(abspath tools/mid2agb/mid2agb)$(EXE) +SCANINC := tools/scaninc/scaninc$(EXE) +PREPROC := tools/preproc/preproc$(EXE) +RAMSCRGEN := tools/ramscrgen/ramscrgen$(EXE) +FIX := tools/gbafix/gbafix$(EXE) # Clear the default suffixes .SUFFIXES: @@ -57,7 +65,7 @@ FIX := tools/gbafix/gbafix .PHONY: rom clean compare tidy -$(shell mkdir -p $(C_BUILDDIR) $(ASM_BUILDDIR) $(DATA_ASM_BUILDDIR) $(SONG_BUILDDIR)) +$(shell mkdir -p $(C_BUILDDIR) $(ASM_BUILDDIR) $(DATA_ASM_BUILDDIR) $(SONG_BUILDDIR) $(MID_BUILDDIR)) C_SRCS := $(wildcard $(C_SUBDIR)/*.c) C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS)) @@ -71,7 +79,10 @@ DATA_ASM_OBJS := $(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o,$(DA SONG_SRCS := $(wildcard $(SONG_SUBDIR)/*.s) SONG_OBJS := $(patsubst $(SONG_SUBDIR)/%.s,$(SONG_BUILDDIR)/%.o,$(SONG_SRCS)) -OBJS := $(C_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) +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_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS)) rom: $(ROM) @@ -82,7 +93,7 @@ compare: $(ROM) clean: tidy rm -f sound/direct_sound_samples/*.bin - rm -f $(SONG_OBJS) + rm -f $(SONG_OBJS) $(MID_OBJS) 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: @@ -91,6 +102,7 @@ tidy: include graphics_file_rules.mk include spritesheet_rules.mk +include songs.mk %.s: ; %.png: ; @@ -106,8 +118,6 @@ include spritesheet_rules.mk %.rl: % ; $(GFX) $< $@ sound/direct_sound_samples/cry_%.bin: sound/direct_sound_samples/cry_%.aif ; $(AIF) $< $@ --compress sound/%.bin: sound/%.aif ; $(AIF) $< $@ -sound/songs/%.s: sound/songs/%.mid - cd $(@D) && ../../$(MID) $(