Skip to content

Commit

Permalink
Move copied libultra archive to the libultra build folder (#47)
Browse files Browse the repository at this point in the history
* Combine makefile defines to avoid duplication

* Move copied libultra archive to the libultra build folder
  • Loading branch information
hensldm authored Jul 19, 2024
1 parent 5b659f0 commit f27e4cf
Show file tree
Hide file tree
Showing 3 changed files with 184 additions and 187 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ CFLAGS += -G 0 -non_shared -Xcpluscomm -nostdinc -Wab,-r4300_mul

WARNINGS := -fullwarn -verbose -woff 624,649,838,712,516,513,596,564,594
ASFLAGS := -march=vr4300 -32 -G0
COMMON_DEFINES := -D_MIPS_SZLONG=32
GBI_DEFINES := -DF3DEX_GBI
RELEASE_DEFINES := -DNDEBUG -D_FINALROM
AS_DEFINES := -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_ULTRA64
C_DEFINES := -DLANGUAGE_C -D_LANGUAGE_C
LIBULTRA_DEFINES := -DBUILD_VERSION=VERSION_$(ULTRALIB_VERSION)
COMMON_DEFINES := -D_MIPS_SZLONG=32 $(GBI_DEFINES) $(RELEASE_DEFINES) $(LIBULTRA_DEFINES)
AS_DEFINES := -DMIPSEB -D_LANGUAGE_ASSEMBLY -D_ULTRA64 $(COMMON_DEFINES)
C_DEFINES := -DLANGUAGE_C -D_LANGUAGE_C $(COMMON_DEFINES)
ENDIAN := -EB

OPTFLAGS := -O2 -g3
Expand All @@ -171,7 +171,7 @@ OBJDUMP_FLAGS := --disassemble --reloc --disassemble-zeroes -Mreg-names=32 -Mno-
ifneq ($(OBJDUMP_BUILD), 0)
OBJDUMP_CMD = $(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s)
OBJCOPY_BIN = $(OBJCOPY) -O binary $@ $@.bin
LIBDUMP_CMD = $(AR) xo --output $(@:.a=) $@
LIBDUMP_CMD = $(AR) xo --output $(@D) $@
else
OBJDUMP_CMD = @:
OBJCOPY_BIN = @:
Expand All @@ -190,12 +190,12 @@ $(shell mkdir -p asm/$(VERSION) assets/$(VERSION) linker_scripts/$(VERSION)/auto
ULTRALIB_DIR := lib/ultralib
ULTRALIB_LIB := $(ULTRALIB_DIR)/build/$(ULTRALIB_VERSION)/$(ULTRALIB_TARGET)/$(ULTRALIB_TARGET).a
LIBULTRA_DIR := lib/libultra
LIBULTRA_LIB := $(BUILD_DIR)/$(LIBULTRA_DIR).a
LIBULTRA_LIB := $(BUILD_DIR)/$(LIBULTRA_DIR)/libultra.a

SRC_DIRS := $(shell find src -type d)
ASM_DIRS := $(shell find asm/$(VERSION) -type d -not -path "asm/$(VERSION)/nonmatchings/*")
BIN_DIRS := $(shell find assets/$(VERSION) -type d)
LIB_DIRS := $(foreach f, $(LIBULTRA_DIR), $f)
LIB_DIRS := $(foreach f,$(LIBULTRA_DIR),$f)

C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))
S_FILES := $(foreach dir,$(ASM_DIRS) $(SRC_DIRS),$(wildcard $(dir)/*.s))
Expand Down Expand Up @@ -318,8 +318,8 @@ $(BUILD_DIR)/%.o: %.s
$(OBJDUMP_CMD)

$(BUILD_DIR)/%.o: %.c
$(CC_CHECK) $(CC_CHECK_FLAGS) $(IINC) -I $(dir $*) $(CHECK_WARNINGS) $(BUILD_DEFINES) $(COMMON_DEFINES) $(RELEASE_DEFINES) $(GBI_DEFINES) $(LIBULTRA_DEFINES) $(C_DEFINES) $(MIPS_BUILTIN_DEFS) -o $@ $<
$(CC) -c $(CFLAGS) $(BUILD_DEFINES) $(IINC) $(WARNINGS) $(MIPS_VERSION) $(ENDIAN) $(COMMON_DEFINES) $(RELEASE_DEFINES) $(GBI_DEFINES) $(LIBULTRA_DEFINES) $(C_DEFINES) $(OPTFLAGS) -o $@ $<
$(CC_CHECK) $(CC_CHECK_FLAGS) $(IINC) -I $(dir $*) $(CHECK_WARNINGS) $(BUILD_DEFINES) $(C_DEFINES) $(MIPS_BUILTIN_DEFS) -o $@ $<
$(CC) -c $(CFLAGS) $(BUILD_DEFINES) $(IINC) $(WARNINGS) $(MIPS_VERSION) $(ENDIAN) $(C_DEFINES) $(OPTFLAGS) -o $@ $<
$(OBJDUMP_CMD)
$(RM_MDEBUG)

Expand Down
3 changes: 0 additions & 3 deletions tools/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ def getProgressFromMapFile(mapFile: mapfile_parser.MapFile, asmPath: Path, nonma
else:
folder = fileparts[pathIndex]

if ".a" in folder:
folder = folder.split('.a')[0]

if folder in aliases:
folder = aliases[folder]

Expand Down
Loading

0 comments on commit f27e4cf

Please sign in to comment.