From 52c2728ff6d07a5d8d420cbe39c08365aa1ca01e Mon Sep 17 00:00:00 2001 From: Kurausukun Date: Wed, 18 Sep 2024 10:37:34 -0400 Subject: [PATCH] remove gflib --- Makefile | 13 ++------- {gflib => include}/bg.h | 0 {gflib => include}/blit.h | 0 {gflib => include/constants}/characters.h | 0 {gflib => include}/dma3.h | 0 {gflib => include}/gpu_regs.h | 0 {gflib => include}/io_reg.h | 0 {gflib => include}/malloc.h | 0 {gflib => include}/sprite.h | 0 {gflib => include}/string_util.h | 0 {gflib => include}/text.h | 2 +- {gflib => include}/window.h | 0 ld_script.ld | 34 ++++++++++------------- ld_script_modern.ld | 5 ---- {gflib => src}/bg.c | 0 {gflib => src}/blit.c | 0 {gflib => src}/dma3_manager.c | 0 {gflib => src}/gpu_regs.c | 0 {gflib => src}/io_reg.c | 0 {gflib => src}/malloc.c | 0 src/mini_printf.c | 2 +- {gflib => src}/sprite.c | 0 {gflib => src}/string_util.c | 0 {gflib => src}/text.c | 0 {gflib => src}/window.c | 0 sym_bss.txt | 12 ++++---- sym_common.txt | 8 +++--- sym_ewram.txt | 10 +++---- tools/preproc/asm_file.cpp | 2 +- 29 files changed, 36 insertions(+), 52 deletions(-) rename {gflib => include}/bg.h (100%) rename {gflib => include}/blit.h (100%) rename {gflib => include/constants}/characters.h (100%) rename {gflib => include}/dma3.h (100%) rename {gflib => include}/gpu_regs.h (100%) rename {gflib => include}/io_reg.h (100%) rename {gflib => include}/malloc.h (100%) rename {gflib => include}/sprite.h (100%) rename {gflib => include}/string_util.h (100%) rename {gflib => include}/text.h (99%) rename {gflib => include}/window.h (100%) rename {gflib => src}/bg.c (100%) rename {gflib => src}/blit.c (100%) rename {gflib => src}/dma3_manager.c (100%) rename {gflib => src}/gpu_regs.c (100%) rename {gflib => src}/io_reg.c (100%) rename {gflib => src}/malloc.c (100%) rename {gflib => src}/sprite.c (100%) rename {gflib => src}/string_util.c (100%) rename {gflib => src}/text.c (100%) rename {gflib => src}/window.c (100%) diff --git a/Makefile b/Makefile index ce868f06bd..9082680c8c 100644 --- a/Makefile +++ b/Makefile @@ -90,7 +90,6 @@ SYM := $(ROM:.gba=.sym) # Commonly used directories C_SUBDIR = src -GFLIB_SUBDIR = gflib ASM_SUBDIR = asm DATA_SRC_SUBDIR = src/data DATA_ASM_SUBDIR = data @@ -98,7 +97,6 @@ SONG_SUBDIR = sound/songs MID_SUBDIR = sound/songs/midi C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR) -GFLIB_BUILDDIR = $(OBJ_DIR)/$(GFLIB_SUBDIR) ASM_BUILDDIR = $(OBJ_DIR)/$(ASM_SUBDIR) DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR) SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR) @@ -114,7 +112,7 @@ INCLUDE_CPP_ARGS := $(INCLUDE_DIRS:%=-iquote %) INCLUDE_SCANINC_ARGS := $(INCLUDE_DIRS:%=-I %) O_LEVEL ?= 2 -CPPFLAGS := $(INCLUDE_CPP_ARGS) -iquote $(GFLIB_SUBDIR) -Wno-trigraphs -DMODERN=$(MODERN) +CPPFLAGS := $(INCLUDE_CPP_ARGS) -Wno-trigraphs -DMODERN=$(MODERN) ifeq ($(MODERN),0) CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef CC1 := tools/agbcc/bin/agbcc$(EXE) @@ -192,9 +190,6 @@ C_SRCS_IN := $(wildcard $(C_SUBDIR)/*.c $(C_SUBDIR)/*/*.c $(C_SUBDIR)/*/*/*.c) C_SRCS := $(foreach src,$(C_SRCS_IN),$(if $(findstring .inc.c,$(src)),,$(src))) C_OBJS := $(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(C_SRCS)) -GFLIB_SRCS := $(wildcard $(GFLIB_SUBDIR)/*.c) -GFLIB_OBJS := $(patsubst $(GFLIB_SUBDIR)/%.c,$(GFLIB_BUILDDIR)/%.o,$(GFLIB_SRCS)) - C_ASM_SRCS := $(wildcard $(C_SUBDIR)/*.s $(C_SUBDIR)/*/*.s $(C_SUBDIR)/*/*/*.s) C_ASM_OBJS := $(patsubst $(C_SUBDIR)/%.s,$(C_BUILDDIR)/%.o,$(C_ASM_SRCS)) @@ -213,7 +208,7 @@ 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) $(GFLIB_OBJS) $(C_ASM_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS) +OBJS := $(C_OBJS) $(C_ASM_OBJS) $(ASM_OBJS) $(DATA_ASM_OBJS) $(SONG_OBJS) $(MID_OBJS) OBJS_REL := $(patsubst $(OBJ_DIR)/%,%,$(OBJS)) SUBDIRS := $(sort $(dir $(OBJS))) @@ -326,7 +321,7 @@ define C_SCANINC ifneq ($(NODEP),1) $1.o: $1.d $1.d: $2 - $(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I tools/agbcc/include -I gflib $2 + $(SCANINC) -M $1.d $(INCLUDE_SCANINC_ARGS) -I tools/agbcc/include $2 include $1.d endif endef @@ -334,10 +329,8 @@ endef # Create generic rules if no dependency scanning, else create the real rules ifeq ($(NODEP),1) $(eval $(call C_DEP,$(C_BUILDDIR)/%,$(C_SUBDIR)/%.c)) -$(eval $(call C_DEP,$(GFLIB_BUILDDIR)/%,$(GFLIB_SUBDIR)/%.c)) else $(foreach src,$(C_SRCS),$(eval $(call C_DEP,$(OBJ_DIR)/$(basename $(src)),$(src)))) -$(foreach src,$(GFLIB_SRCS),$(eval $(call C_DEP,$(OBJ_DIR)/$(basename $(src)),$(src)))) endif # Similar methodology for Assembly files diff --git a/gflib/bg.h b/include/bg.h similarity index 100% rename from gflib/bg.h rename to include/bg.h diff --git a/gflib/blit.h b/include/blit.h similarity index 100% rename from gflib/blit.h rename to include/blit.h diff --git a/gflib/characters.h b/include/constants/characters.h similarity index 100% rename from gflib/characters.h rename to include/constants/characters.h diff --git a/gflib/dma3.h b/include/dma3.h similarity index 100% rename from gflib/dma3.h rename to include/dma3.h diff --git a/gflib/gpu_regs.h b/include/gpu_regs.h similarity index 100% rename from gflib/gpu_regs.h rename to include/gpu_regs.h diff --git a/gflib/io_reg.h b/include/io_reg.h similarity index 100% rename from gflib/io_reg.h rename to include/io_reg.h diff --git a/gflib/malloc.h b/include/malloc.h similarity index 100% rename from gflib/malloc.h rename to include/malloc.h diff --git a/gflib/sprite.h b/include/sprite.h similarity index 100% rename from gflib/sprite.h rename to include/sprite.h diff --git a/gflib/string_util.h b/include/string_util.h similarity index 100% rename from gflib/string_util.h rename to include/string_util.h diff --git a/gflib/text.h b/include/text.h similarity index 99% rename from gflib/text.h rename to include/text.h index ff13efa9a8..db9f4db873 100644 --- a/gflib/text.h +++ b/include/text.h @@ -1,7 +1,7 @@ #ifndef GUARD_TEXT_H #define GUARD_TEXT_H -#include "characters.h" +#include "constants/characters.h" // Given as a text speed when all the text should be // loaded at once but not copied to vram yet. diff --git a/gflib/window.h b/include/window.h similarity index 100% rename from gflib/window.h rename to include/window.h diff --git a/ld_script.ld b/ld_script.ld index c4abf075f8..1e08a8d61c 100644 --- a/ld_script.ld +++ b/ld_script.ld @@ -23,7 +23,6 @@ SECTIONS { { INCLUDE "sym_ewram.ld" src/*.o(ewram_data); - gflib/*.o(ewram_data); *libc.a:impure.o(.data); *libc.a:locale.o(.data); @@ -36,7 +35,6 @@ SECTIONS { /* .bss starts at 0x3000000 */ INCLUDE "sym_bss.ld" src/*.o(.bss); - gflib/*.o(.bss); data/*.o(.bss); /* .bss.code starts at 0x3001AA8 */ @@ -57,15 +55,15 @@ SECTIONS { src/rom_header_gf.o(.text.*); src/crt0.o(.text); src/main.o(.text); - gflib/malloc.o(.text); - gflib/dma3_manager.o(.text); - gflib/gpu_regs.o(.text); - gflib/bg.o(.text); - gflib/blit.o(.text); - gflib/window.o(.text); - gflib/text.o(.text); - gflib/sprite.o(.text); - gflib/string_util.o(.text); + src/malloc.o(.text); + src/dma3_manager.o(.text); + src/gpu_regs.o(.text); + src/bg.o(.text); + src/blit.o(.text); + src/window.o(.text); + src/text.o(.text); + src/sprite.o(.text); + src/string_util.o(.text); src/link.o(.text); src/AgbRfu_LinkManager.o(.text); src/link_rfu_3.o(.text); @@ -446,12 +444,12 @@ SECTIONS { src/rom_header.o(.rodata); src/rom_header_gf.o(.rodata); src/main.o(.rodata); - gflib/bg.o(.rodata); - gflib/window.o(.rodata); - gflib/text.o(.rodata); - gflib/sprite.o(.rodata); - gflib/io_reg.o(.rodata); - gflib/string_util.o(.rodata); + src/bg.o(.rodata); + src/window.o(.rodata); + src/text.o(.rodata); + src/sprite.o(.rodata); + src/io_reg.o(.rodata); + src/string_util.o(.rodata); src/link.o(.rodata); src/link.o(.rodata.str1.4); src/AgbRfu_LinkManager.o(.rodata); @@ -1317,9 +1315,7 @@ SECTIONS { ALIGN(4) { src/*.o(.text); - gflib/*.o(.text); src/*.o(.rodata); - gflib/*.o(.rodata); data/*.o(.rodata); } > ROM = 0 diff --git a/ld_script_modern.ld b/ld_script_modern.ld index 4ccbfbaa0f..fac4a134c3 100644 --- a/ld_script_modern.ld +++ b/ld_script_modern.ld @@ -16,14 +16,12 @@ SECTIONS { ALIGN(4) { src/*.o(ewram_data); - gflib/*.o(ewram_data); } > EWRAM iwram 0x3000000 (NOLOAD) : ALIGN(4) { src/*.o(.bss); - gflib/*.o(.bss); data/*.o(.bss); *libc.a:*.o(.bss*); *libnosys.a:*.o(.bss*); @@ -31,7 +29,6 @@ SECTIONS { src/m4a.o(.bss.code); src/*.o(COMMON); - gflib/*.o(COMMON); *libc.a:*.o(COMMON); *libnosys.a:*.o(COMMON); } > IWRAM @@ -46,7 +43,6 @@ SECTIONS { src/rom_header_gf.o(.text.*); src/crt0.o(.text); src/main.o(.text); - gflib/*.o(.text*); src/*.o(.text*); asm/*.o(.text*); } > ROM =0 @@ -82,7 +78,6 @@ SECTIONS { ALIGN(4) { src/*.o(.rodata*); - gflib/*.o(.rodata*); data/*.o(.rodata*); } > ROM =0 diff --git a/gflib/bg.c b/src/bg.c similarity index 100% rename from gflib/bg.c rename to src/bg.c diff --git a/gflib/blit.c b/src/blit.c similarity index 100% rename from gflib/blit.c rename to src/blit.c diff --git a/gflib/dma3_manager.c b/src/dma3_manager.c similarity index 100% rename from gflib/dma3_manager.c rename to src/dma3_manager.c diff --git a/gflib/gpu_regs.c b/src/gpu_regs.c similarity index 100% rename from gflib/gpu_regs.c rename to src/gpu_regs.c diff --git a/gflib/io_reg.c b/src/io_reg.c similarity index 100% rename from gflib/io_reg.c rename to src/io_reg.c diff --git a/gflib/malloc.c b/src/malloc.c similarity index 100% rename from gflib/malloc.c rename to src/malloc.c diff --git a/src/mini_printf.c b/src/mini_printf.c index cab78d7611..ac8a0ef127 100644 --- a/src/mini_printf.c +++ b/src/mini_printf.c @@ -36,7 +36,7 @@ #include "gba/types.h" #include "gba/defines.h" #include "config.h" -#include "characters.h" +#include "constants/characters.h" #include "string_util.h" #ifndef NDEBUG diff --git a/gflib/sprite.c b/src/sprite.c similarity index 100% rename from gflib/sprite.c rename to src/sprite.c diff --git a/gflib/string_util.c b/src/string_util.c similarity index 100% rename from gflib/string_util.c rename to src/string_util.c diff --git a/gflib/text.c b/src/text.c similarity index 100% rename from gflib/text.c rename to src/text.c diff --git a/gflib/window.c b/src/window.c similarity index 100% rename from gflib/window.c rename to src/window.c diff --git a/sym_bss.txt b/sym_bss.txt index 3a23e74789..0520e0b5b0 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -1,10 +1,10 @@ .include "src/main.o" - .include "gflib/malloc.o" - .include "gflib/dma3_manager.o" - .include "gflib/gpu_regs.o" - .include "gflib/bg.o" - .include "gflib/text.o" - .include "gflib/sprite.o" + .include "src/malloc.o" + .include "src/dma3_manager.o" + .include "src/gpu_regs.o" + .include "src/bg.o" + .include "src/text.o" + .include "src/sprite.o" .include "src/link.o" .include "src/AgbRfu_LinkManager.o" .include "src/link_rfu_3.o" diff --git a/sym_common.txt b/sym_common.txt index 7eebcac74e..bffabfbdf3 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -1,17 +1,17 @@ .space 0x8 .include "main.o" - @ ../gflib/bg.o + @ ../src/bg.o .align 2 gWindowTileAutoAllocEnabled: .space 4 - @ ../gflib/window.o + @ ../src/window.o .align 4 gTransparentTileNumber: .space 1 .align 4 gWindowBgTilemapBuffers: .space 16 - @ ../gflib/text.o + @ ../src/text.o .align 4 gFonts: .space 4 @@ -24,7 +24,7 @@ gCurGlyph: .align 2 gTextFlags: .space 4 - @ ../gflib/sprite.o + @ ../src/sprite.o .align 2 gOamMatrixAllocBitmap: .space 4 diff --git a/sym_ewram.txt b/sym_ewram.txt index 31c507ee9b..92a69cc4c9 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1,10 +1,10 @@ - .include "gflib/malloc.o" + .include "src/malloc.o" .include "src/decompress.o" .include "src/main.o" - .include "gflib/window.o" - .include "gflib/text.o" - .include "gflib/sprite.o" - .include "gflib/string_util.o" + .include "src/window.o" + .include "src/text.o" + .include "src/sprite.o" + .include "src/string_util.o" .include "src/link.o" .include "src/AgbRfu_LinkManager.o" .include "src/link_rfu_3.o" diff --git a/tools/preproc/asm_file.cpp b/tools/preproc/asm_file.cpp index 36b6c7ed06..4eda54a3aa 100644 --- a/tools/preproc/asm_file.cpp +++ b/tools/preproc/asm_file.cpp @@ -26,7 +26,7 @@ #include "char_util.h" #include "utf8.h" #include "string_parser.h" -#include "../../gflib/characters.h" +#include "../../include/constants/characters.h" #include "io.h" AsmFile::AsmFile(std::string filename, bool isStdin, bool doEnum) : m_filename(filename)