From cf1eaea7f7dbe438ab28a7949e94e9b0c453be74 Mon Sep 17 00:00:00 2001 From: Icedude907 <34080011+Icedude907@users.noreply.github.com> Date: Wed, 15 Nov 2023 13:36:35 +1300 Subject: [PATCH] Coalesced audio rules into `audio.mk` --- Makefile | 9 +-------- songs.mk => audio_rules.mk | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 9 deletions(-) rename songs.mk => audio_rules.mk (58%) diff --git a/Makefile b/Makefile index 5c073b36ca..df574e4545 100644 --- a/Makefile +++ b/Makefile @@ -86,8 +86,6 @@ DATA_SRC_SUBDIR = src/data DATA_ASM_SUBDIR = data SONG_SUBDIR = sound/songs MID_SUBDIR = sound/songs/midi -SAMPLE_SUBDIR = sound/direct_sound_samples -CRY_SUBDIR = sound/direct_sound_samples/cries C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR) GFLIB_BUILDDIR = $(OBJ_DIR)/$(GFLIB_SUBDIR) @@ -263,7 +261,7 @@ include graphics_file_rules.mk include map_data_rules.mk include spritesheet_rules.mk include json_data_rules.mk -include songs.mk +include audio_rules.mk %.s: ; %.png: ; @@ -277,8 +275,6 @@ include songs.mk %.gbapal: %.png ; $(GFX) $< $@ %.lz: % ; $(GFX) $< $@ %.rl: % ; $(GFX) $< $@ -$(CRY_SUBDIR)/%.bin: $(CRY_SUBDIR)/%.aif ; $(AIF) $< $@ --compress -sound/%.bin: sound/%.aif ; $(AIF) $< $@ ifeq ($(MODERN),0) @@ -393,9 +389,6 @@ $(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call SRC_ASM_DATA_DEP,$(patsub endif endif -$(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s - $(AS) $(ASFLAGS) -I sound -o $@ $< - $(OBJ_DIR)/sym_bss.ld: sym_bss.txt $(RAMSCRGEN) .bss $< ENGLISH > $@ diff --git a/songs.mk b/audio_rules.mk similarity index 58% rename from songs.mk rename to audio_rules.mk index feef64cf5b..69d482fdfa 100644 --- a/songs.mk +++ b/audio_rules.mk @@ -1,6 +1,28 @@ # This file contains rules for making assemblies for most music in the game. -MID_ASM_DIR = $(MID_SUBDIR) +CRY_SUBDIR := sound/direct_sound_samples/cries + +MID_ASM_DIR := $(MID_SUBDIR) +CRY_BIN_DIR := $(CRY_SUBDIR) +SOUND_BIN_DIR := sound + +SPECIAL_OUTDIRS := $(MID_ASM_DIR) $(CRY_BIN_DIR) +SPECIAL_OUTDIRS += $(SOUND_BIN_DIR) $(SOUND_BIN_DIR)/direct_sound_samples/phonemes $(SOUND_BIN_DIR)/direct_sound_samples/cries +$(shell mkdir -p $(SPECIAL_OUTDIRS) ) + +# Assembly song compilation +$(SONG_BUILDDIR)/%.o: $(SONG_SUBDIR)/%.s + $(AS) $(ASFLAGS) -I sound -o $@ $< +$(MID_BUILDDIR)/%.o: $(MID_ASM_DIR)/%.s + $(AS) $(ASFLAGS) -I sound -o $@ $< + +# Compressed cries +$(CRY_BIN_DIR)/%.bin: $(CRY_SUBDIR)/%.aif + $(AIF) $< $@ --compress + +# Uncompressed sounds +$(SOUND_BIN_DIR)/%.bin: sound/%.aif + $(AIF) $< $@ # For each line in midi.cfg, we do some trickery to convert it into a make rule for the `.mid` file described on the line # Data following the colon in said file corresponds to arguments passed into mid2agb