From 36a1fbbd49cb2fa98397d1f5f57e8bc304251361 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Sat, 28 Dec 2024 12:58:14 +1100 Subject: [PATCH] 32x: Add to main makefile --- Makefile | 6 ++++-- misc/32x/Makefile | 55 +++++++++++++++++++++++++++++++---------------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 118ac29c6..03227d223 100644 --- a/Makefile +++ b/Makefile @@ -222,10 +222,12 @@ release: # Some builds require more complex handling, so are moved to # separate makefiles to avoid having one giant messy makefile -dreamcast: - $(MAKE) -f misc/dreamcast/Makefile +32x: + $(MAKE) -f misc/32x/Makefile saturn: $(MAKE) -f misc/saturn/Makefile +dreamcast: + $(MAKE) -f misc/dreamcast/Makefile psp: $(MAKE) -f misc/psp/Makefile vita: diff --git a/misc/32x/Makefile b/misc/32x/Makefile index 480de1296..5dbf7a69d 100644 --- a/misc/32x/Makefile +++ b/misc/32x/Makefile @@ -30,15 +30,31 @@ MDLD = $(MDPREFIX)ld DD = dd RM = rm -f -TARGET = ClassiCube +TARGET = ClassiCube-32x LIBS = $(LIBPATH) -lc -lgcc -lgcc-Os-4-200 -lnosys +BUILD_DIR = build-32x -SOURCE_DIRS = ../../src +SOURCE_DIRS = src misc/32x C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) -OBJS = sh2_crt0.o main_32x.o hw_32x.o $(notdir $(C_FILES:%.c=%.o)) +S_FILES = misc/32x/sh2_crt0.s +OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.s=%.o))) -all: m68k_crt0.bin m68k_crt1.bin $(TARGET).bin +#--------------------------------------------------------------------------------- +# main targets +#--------------------------------------------------------------------------------- +all: $(BUILD_DIR) m68k_crt0.bin m68k_crt1.bin $(TARGET).bin + +clean: + $(RM) *.o *.bin *.elf output.map + +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) + + +#--------------------------------------------------------------------------------- +# binary generation +#--------------------------------------------------------------------------------- $(TARGET).bin: $(TARGET).elf $(SHOBJC) -O binary $< temp.bin $(DD) if=temp.bin of=$@ bs=64K conv=sync @@ -46,25 +62,28 @@ $(TARGET).bin: $(TARGET).elf $(TARGET).elf: $(OBJS) $(SHCC) $(SHLDFLAGS) $(OBJS) $(LIBS) -o $(TARGET).elf -m68k_crt0.bin: m68k_crt0.s - $(MDAS) $(MDASFLAGS) -o m68k_crt0.o m68k_crt0.s - $(MDLD) $(MDLDFLAGS) -o m68k_crt0.bin m68k_crt0.o -m68k_crt1.bin: m68k_crt1.s - $(MDAS) $(MDASFLAGS) -o m68k_crt1.o m68k_crt1.s - $(MDLD) $(MDLDFLAGS) -o m68k_crt1.bin m68k_crt1.o +$(BUILD_DIR)/m68k_crt0.o: misc/32x/m68k_crt0.s + $(MDAS) $(MDASFLAGS) $< -o $@ -hw_32x.o: hw_32x.c - $(SHCC) $(SHHWFLAGS) $(INCPATH) $< -o $@ +m68k_crt0.bin: $(BUILD_DIR)/m68k_crt0.o + $(MDLD) $(MDLDFLAGS) $< -o $@ -%.o: %.c +$(BUILD_DIR)/m68k_crt1.o: misc/32x/m68k_crt1.s + $(MDAS) $(MDASFLAGS) $< -o $@ + +m68k_crt1.bin: $(BUILD_DIR)/m68k_crt1.o + $(MDLD) $(MDLDFLAGS) $< -o $@ + + +#--------------------------------------------------------------------------------- +# object generation +#--------------------------------------------------------------------------------- +$(BUILD_DIR)/%.o: src/%.c $(SHCC) $(SHCCFLAGS) $(INCPATH) $< -o $@ -%.o: ../../src/%.c +$(BUILD_DIR)/%.o: misc/32x/%.c $(SHCC) $(SHCCFLAGS) $(INCPATH) $< -o $@ -%.o: %.s +$(BUILD_DIR)/%.o: misc/32x/%.s $(SHAS) $(SHASFLAGS) $(INCPATH) $< -o $@ - -clean: - $(RM) *.o *.bin *.elf output.map