Set up Makefile for MIDIs

This commit is contained in:
Diegoisawesome 2018-09-22 19:56:17 -05:00
parent 584cad6c0b
commit a63f3ce872
7 changed files with 33 additions and 1575 deletions

1
.gitignore vendored
View File

@ -16,6 +16,7 @@
*.hwjpnfont
*.fwjpnfont
sound/**/*.bin
sound/songs/midi/*.s
tools/agbcc
*.map
*.ld

View File

@ -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) $(<F)
$(C_BUILDDIR)/libc.o: CC1 := tools/agbcc/bin/old_agbcc
$(C_BUILDDIR)/libc.o: CFLAGS := -O2

View File

@ -7,3 +7,4 @@ make -C tools/rsfont CXX=${1:-g++}
make -C tools/aif2pcm CXX=${1:-g++}
make -C tools/ramscrgen CXX=${1:-g++}
make -C tools/gbafix CXX=${1:-g++}
make -C tools/mid2agb CXX=${1:-g++}

View File

@ -913,7 +913,7 @@ SECTIONS {
sound/songs/mus_hightown.o(.rodata);
sound/songs/mus_safari.o(.rodata);
sound/songs/mus_c_road.o(.rodata);
sound/songs/mus_ajito.o(.rodata);
sound/songs/midi/mus_ajito.o(.rodata);
sound/songs/mus_m_boat.o(.rodata);
sound/songs/mus_m_dungon.o(.rodata);
sound/songs/mus_finecity.o(.rodata);

7
songs.mk Normal file
View File

@ -0,0 +1,7 @@
STD_REVERB = 50
$(MID_BUILDDIR)/%.o: $(MID_SUBDIR)/%.s
$(AS) $(ASFLAGS) -I sound -o $@ $<
$(MID_SUBDIR)/mus_ajito.s: %.s: %.mid
$(MID) $< $@ -G 076 -R $(STD_REVERB)

Binary file not shown.

File diff suppressed because it is too large Load Diff