32x: Add to main makefile

This commit is contained in:
UnknownShadow200 2024-12-28 12:58:14 +11:00
parent 2dc30e8859
commit 36a1fbbd49
2 changed files with 41 additions and 20 deletions

View file

@ -222,10 +222,12 @@ release:
# Some builds require more complex handling, so are moved to # Some builds require more complex handling, so are moved to
# separate makefiles to avoid having one giant messy makefile # separate makefiles to avoid having one giant messy makefile
dreamcast: 32x:
$(MAKE) -f misc/dreamcast/Makefile $(MAKE) -f misc/32x/Makefile
saturn: saturn:
$(MAKE) -f misc/saturn/Makefile $(MAKE) -f misc/saturn/Makefile
dreamcast:
$(MAKE) -f misc/dreamcast/Makefile
psp: psp:
$(MAKE) -f misc/psp/Makefile $(MAKE) -f misc/psp/Makefile
vita: vita:

View file

@ -30,15 +30,31 @@ MDLD = $(MDPREFIX)ld
DD = dd DD = dd
RM = rm -f RM = rm -f
TARGET = ClassiCube TARGET = ClassiCube-32x
LIBS = $(LIBPATH) -lc -lgcc -lgcc-Os-4-200 -lnosys 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)) 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 $(TARGET).bin: $(TARGET).elf
$(SHOBJC) -O binary $< temp.bin $(SHOBJC) -O binary $< temp.bin
$(DD) if=temp.bin of=$@ bs=64K conv=sync $(DD) if=temp.bin of=$@ bs=64K conv=sync
@ -46,25 +62,28 @@ $(TARGET).bin: $(TARGET).elf
$(TARGET).elf: $(OBJS) $(TARGET).elf: $(OBJS)
$(SHCC) $(SHLDFLAGS) $(OBJS) $(LIBS) -o $(TARGET).elf $(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 $(BUILD_DIR)/m68k_crt0.o: misc/32x/m68k_crt0.s
$(MDAS) $(MDASFLAGS) -o m68k_crt1.o m68k_crt1.s $(MDAS) $(MDASFLAGS) $< -o $@
$(MDLD) $(MDLDFLAGS) -o m68k_crt1.bin m68k_crt1.o
hw_32x.o: hw_32x.c m68k_crt0.bin: $(BUILD_DIR)/m68k_crt0.o
$(SHCC) $(SHHWFLAGS) $(INCPATH) $< -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 $@ $(SHCC) $(SHCCFLAGS) $(INCPATH) $< -o $@
%.o: ../../src/%.c $(BUILD_DIR)/%.o: misc/32x/%.c
$(SHCC) $(SHCCFLAGS) $(INCPATH) $< -o $@ $(SHCC) $(SHCCFLAGS) $(INCPATH) $< -o $@
%.o: %.s $(BUILD_DIR)/%.o: misc/32x/%.s
$(SHAS) $(SHASFLAGS) $(INCPATH) $< -o $@ $(SHAS) $(SHASFLAGS) $(INCPATH) $< -o $@
clean:
$(RM) *.o *.bin *.elf output.map