diff --git a/misc/32x/Makefile b/misc/32x/Makefile index 464beabd8..0936c2ca1 100644 --- a/misc/32x/Makefile +++ b/misc/32x/Makefile @@ -4,14 +4,31 @@ else ROOTDIR = /opt/toolchains/sega endif + +#--------------------------------------------------------------------------------- +# Configurable options +#--------------------------------------------------------------------------------- +TARGET = ClassiCube-32x +BUILD_DIR = build/32x +SOURCE_DIRS = src src/32x misc/32x + + +#--------------------------------------------------------------------------------- +# Code generation +#--------------------------------------------------------------------------------- +C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) +S_FILES = misc/32x/sh2_crt0.s +OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.s=%.o))) + LDSCRIPTSDIR = $(ROOTDIR)/ldscripts +LIBS = $(LIBPATH) -lc -lgcc -lgcc-Os-4-200 -lnosys LIBPATH = -L$(ROOTDIR)/sh-elf/lib -L$(ROOTDIR)/sh-elf/lib/gcc/sh-elf/4.6.2 -L$(ROOTDIR)/sh-elf/sh-elf/lib -INCPATH = -I. -I../include -I$(ROOTDIR)/sh-elf/include -I$(ROOTDIR)/sh-elf/sh-elf/include +INCPATH = -I$(ROOTDIR)/sh-elf/include -I$(ROOTDIR)/sh-elf/sh-elf/include SHCCFLAGS = -m2 -mb -Ofast -Wall -g -c -fomit-frame-pointer -DPLAT_32X -ffunction-sections -fdata-sections SHHWFLAGS = -m2 -mb -O1 -Wall -g -c -fomit-frame-pointer -SHLDFLAGS = -T $(LDSCRIPTSDIR)/mars.ld -Wl,-Map=output.map -nostdlib -Wl,--gc-sections +SHLDFLAGS = -T $(LDSCRIPTSDIR)/mars.ld -nostdlib -Wl,--gc-sections SHASFLAGS = --big MDLDFLAGS = -T $(LDSCRIPTSDIR)/md.ld --oformat binary @@ -27,26 +44,18 @@ MDPREFIX = $(ROOTDIR)/m68k-elf/bin/m68k-elf- MDAS = $(MDPREFIX)as MDLD = $(MDPREFIX)ld -DD = dd -RM = rm -f - -TARGET = ClassiCube-32x -LIBS = $(LIBPATH) -lc -lgcc -lgcc-Os-4-200 -lnosys -BUILD_DIR = build/32x - -SOURCE_DIRS = src misc/32x -C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) -S_FILES = misc/32x/sh2_crt0.s -OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.s=%.o))) +# Dependency tracking +DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d +DEPFILES := $(OBJS:%.o=%.d) #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- -all: $(BUILD_DIR) m68k_crt0.bin m68k_crt1.bin $(TARGET).bin +all: $(BUILD_DIR) $(BUILD_DIR)/m68k_crt0.bin $(BUILD_DIR)/m68k_crt1.bin $(TARGET).bin clean: - $(RM) *.o *.bin *.elf output.map + rm -f $(BUILD_DIR)/*.o $(BUILD_DIR)/*.bin $(TARGET).bin $(TARGET).elf $(BUILD_DIR): mkdir -p $(BUILD_DIR) @@ -56,8 +65,8 @@ $(BUILD_DIR): # binary generation #--------------------------------------------------------------------------------- $(TARGET).bin: $(TARGET).elf - $(SHOBJC) -O binary $< temp.bin - $(DD) if=temp.bin of=$@ bs=64K conv=sync + $(SHOBJC) -O binary $< $(BUILD_DIR)/temp.bin + dd if=$(BUILD_DIR)/temp.bin of=$@ bs=64K conv=sync $(TARGET).elf: $(OBJS) $(SHCC) $(SHLDFLAGS) $(OBJS) $(LIBS) -o $(TARGET).elf @@ -66,13 +75,13 @@ $(TARGET).elf: $(OBJS) $(BUILD_DIR)/m68k_crt0.o: misc/32x/m68k_crt0.s $(MDAS) $(MDASFLAGS) $< -o $@ -m68k_crt0.bin: $(BUILD_DIR)/m68k_crt0.o +$(BUILD_DIR)/m68k_crt0.bin: $(BUILD_DIR)/m68k_crt0.o $(MDLD) $(MDLDFLAGS) $< -o $@ $(BUILD_DIR)/m68k_crt1.o: misc/32x/m68k_crt1.s $(MDAS) $(MDASFLAGS) $< -o $@ -m68k_crt1.bin: $(BUILD_DIR)/m68k_crt1.o +$(BUILD_DIR)/m68k_crt1.bin: $(BUILD_DIR)/m68k_crt1.o $(MDLD) $(MDLDFLAGS) $< -o $@ @@ -80,10 +89,21 @@ m68k_crt1.bin: $(BUILD_DIR)/m68k_crt1.o # object generation #--------------------------------------------------------------------------------- $(BUILD_DIR)/%.o: src/%.c - $(SHCC) $(SHCCFLAGS) $(INCPATH) $< -o $@ + $(SHCC) $(SHCCFLAGS) $(INCPATH) $(DEPFLAGS) $< -o $@ + +$(BUILD_DIR)/%.o: src/32x/%.c + $(SHCC) $(SHCCFLAGS) $(INCPATH) $(DEPFLAGS) $< -o $@ $(BUILD_DIR)/%.o: misc/32x/%.c - $(SHCC) $(SHCCFLAGS) $(INCPATH) $< -o $@ + $(SHCC) $(SHCCFLAGS) $(INCPATH) $(DEPFLAGS) $< -o $@ $(BUILD_DIR)/%.o: misc/32x/%.s $(SHAS) $(SHASFLAGS) $(INCPATH) $< -o $@ + + +#--------------------------------------------------------------------------------- +# Dependency tracking +#--------------------------------------------------------------------------------- +$(DEPFILES): + +include $(wildcard $(DEPFILES)) diff --git a/misc/32x/sh2_crt0.s b/misc/32x/sh2_crt0.s index 0367bda3d..020718f72 100644 --- a/misc/32x/sh2_crt0.s +++ b/misc/32x/sh2_crt0.s @@ -6,11 +6,11 @@ ! Standard MD Header at 0x000 - .incbin "m68k_crt0.bin", 0, 0x3C0 + .incbin "build/32x/m68k_crt0.bin", 0, 0x3C0 ! Standard Mars Header at 0x3C0 - .ascii "32X Example " /* module name (16 chars) */ + .ascii "ClassiCube 32X " /* module name (16 chars) */ .long 0x00000000 /* version */ .long __text_end-0x02000000 /* Source (in ROM) */ .long 0x00000000 /* Destination (in SDRAM) */ @@ -22,7 +22,7 @@ ! Standard MD startup code at 0x3F0 - .incbin "m68k_crt1.bin" + .incbin "build/32x/m68k_crt1.bin" .data diff --git a/misc/3ds/Makefile b/misc/3ds/Makefile index d46685466..f7ae03b45 100644 --- a/misc/3ds/Makefile +++ b/misc/3ds/Makefile @@ -2,8 +2,6 @@ ifeq ($(strip $(DEVKITPRO)),) $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro) endif -include $(DEVKITPRO)/devkitARM/base_tools - #--------------------------------------------------------------------------------- # Configurable options @@ -55,6 +53,20 @@ DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d DEPFILES := $(OBJS:%.o=%.d) +#--------------------------------------------------------------------------------- +# Compiler tools +#--------------------------------------------------------------------------------- +PREFIX := $(DEVKITPRO)/devkitARM/bin/arm-none-eabi- +ARM_AS := $(PREFIX)as +ARM_CC := $(PREFIX)gcc +ARM_CXX := $(PREFIX)g++ + +_DSXTOOL := $(DEVKITPRO)/tools/bin/3dsxtool +SMDHTOOL := $(DEVKITPRO)/tools/bin/smdhtool +PICASSO := $(DEVKITPRO)/tools/bin/picasso +BIN2S := $(DEVKITPRO)/tools/bin/bin2s + + #--------------------------------------------------------------------------------- # Main targets #--------------------------------------------------------------------------------- @@ -71,13 +83,13 @@ $(BUILD_DIR): # Executable generation #--------------------------------------------------------------------------------- $(TARGET).elf: $(OBJS) - $(CC) $(LDFLAGS) $^ -o $@ $(LIBS) + $(ARM_CC) $(LDFLAGS) $^ -o $@ $(LIBS) $(BUILD_DIR).smdh: $(APP_ICON) - smdhtool --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@ + $(SMDHTOOL) --create "$(APP_TITLE)" "$(APP_DESCRIPTION)" "$(APP_AUTHOR)" $(APP_ICON) $@ $(TARGET).3dsx: $(TARGET).elf $(BUILD_DIR).smdh - 3dsxtool $< $@ --smdh=$(BUILD_DIR).smdh + $(_DSXTOOL) $< $@ --smdh=$(BUILD_DIR).smdh $(BUILD_DIR)/makerom: wget https://github.com/3DSGuy/Project_CTR/releases/download/makerom-v0.18.3/makerom-v0.18.3-ubuntu_x86_64.zip -O $(BUILD_DIR)/makerom.zip @@ -92,19 +104,19 @@ $(TARGET).cia : $(TARGET).3dsx $(BUILD_DIR)/makerom # Object generation #--------------------------------------------------------------------------------- $(BUILD_DIR)/%.o: src/%.c - $(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ + $(ARM_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o: src/3ds/%.c - $(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ + $(ARM_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o: third_party/bearssl/src/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(ARM_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ $(BUILD_DIR)/%.shbin: misc/3ds/%.v.pica - picasso $< -o $@ + $(PICASSO) $< -o $@ $(BUILD_DIR)/%.shbin.o: $(BUILD_DIR)/%.shbin - bin2s $< | $(AS) -o $@ + $(BIN2S) $< | $(ARM_AS) -o $@ #--------------------------------------------------------------------------------- diff --git a/misc/gc/Makefile b/misc/gc/Makefile index aebe32174..3718c46d4 100644 --- a/misc/gc/Makefile +++ b/misc/gc/Makefile @@ -2,8 +2,6 @@ ifeq ($(strip $(DEVKITPRO)),) $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro) endif -include $(DEVKITPRO)/devkitPPC/base_tools - #--------------------------------------------------------------------------------- # Configurable options @@ -37,6 +35,17 @@ DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d DEPFILES := $(OBJS:%.o=%.d) +#--------------------------------------------------------------------------------- +# Compiler tools +#--------------------------------------------------------------------------------- +PREFIX := $(DEVKITPRO)/devkitPPC/bin/powerpc-eabi- +PPC_AS := $(PREFIX)as +PPC_CC := $(PREFIX)gcc +PPC_CXX := $(PREFIX)g++ + +ELF2DOL := $(DEVKITPRO)/tools/bin/elf2dol + + #--------------------------------------------------------------------------------- # Main targets #--------------------------------------------------------------------------------- @@ -53,23 +62,23 @@ $(BUILD_DIR): # Executable generation #--------------------------------------------------------------------------------- $(TARGET).elf: $(OBJS) - $(CC) $(LDFLAGS) $^ -o $@ $(LIBS) + $(PPC_CC) $(LDFLAGS) $^ -o $@ $(LIBS) $(TARGET).dol: $(TARGET).elf - elf2dol $< $@ + $(ELF2DOL) $< $@ #--------------------------------------------------------------------------------- # Object generation #--------------------------------------------------------------------------------- $(BUILD_DIR)/%.o: src/%.c - $(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ + $(PPC_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o: src/gcwii/%.c - $(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ + $(PPC_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o: third_party/bearssl/src/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(PPC_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ #--------------------------------------------------------------------------------- diff --git a/misc/ps1/Makefile b/misc/ps1/Makefile index 9d5e17725..9690dceac 100644 --- a/misc/ps1/Makefile +++ b/misc/ps1/Makefile @@ -37,7 +37,7 @@ PS1LIBS := libpsxgpu libpsxgte libpsxspu libpsxcd libpsxpress libpsxsio libpsxet PS1LIBS := $(addprefix $(PSN00BSDK_ROOT)/lib/libpsn00b/debug/, $(PS1LIBS)) PS1LIBS := $(addsuffix _exe_gprel.a, $(PS1LIBS)) -LDFLAGS = -g -T$(PSN00BSDK_ROOT)/lib/libpsn00b/ldscripts/exe.ld -nostdlib -Wl,-gc-sections -G8 -static \ +LDFLAGS = -g -T$(PSN00BSDK_ROOT)/lib/libpsn00b/ldscripts/exe.ld -nostdlib -Wl,-gc-sections -G8 -static LIBS = -lgcc $(PS1LIBS) #--------------------------------------------------------------------------------- diff --git a/misc/ps2/Makefile b/misc/ps2/Makefile index b68e36dfa..fcd7a3c20 100644 --- a/misc/ps2/Makefile +++ b/misc/ps2/Makefile @@ -6,9 +6,12 @@ endif #--------------------------------------------------------------------------------- # Configurable options #--------------------------------------------------------------------------------- -SOURCE_DIRS := src src/ps2 third_party/bearssl/src -BUILD_DIR = build/ps2 +# Name of the final output TARGET = ClassiCube-ps2 +# List of directories containing source code +SOURCE_DIRS := src src/ps2 third_party/bearssl/src +# Directory where object files are placed +BUILD_DIR = build/ps2 #--------------------------------------------------------------------------------- @@ -18,10 +21,6 @@ S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S)) C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o))) -# Dependency tracking -DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d -DEPFILES := $(OBJS:%.o=%.d) - IOP_MODS := DEV9_irx.o NETMAN_irx.o SMAP_irx.o USBD_irx.o BDM_irx.o BDMFS_FATFS_irx.o USBMASS_BD_irx.o USBHDFSD_irx.o USBMOUSE_irx.o USBKBD_irx.o EE_OBJS = $(OBJS) $(patsubst %.o, $(BUILD_DIR)/%.o, $(IOP_MODS)) @@ -32,6 +31,17 @@ EE_CFLAGS := -D_EE -G0 -O2 -Wall -gdwarf-2 -gz -DPLAT_PS2 EE_LDFLAGS := -L$(PS2SDK)/ee/lib -Wl,-zmax-page-size=128 EE_LINKFILE := $(PS2SDK)/ee/startup/linkfile +# Dependency tracking +DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d +DEPFILES := $(OBJS:%.o=%.d) + + +#--------------------------------------------------------------------------------- +# Compiler tools +#--------------------------------------------------------------------------------- +EE_CC = mips64r5900el-ps2-elf-gcc +EE_STRIP = mips64r5900el-ps2-elf-strip + #--------------------------------------------------------------------------------- # main targets @@ -44,8 +54,6 @@ clean: $(BUILD_DIR): mkdir -p $@ -include $(PS2SDK)/samples/Makefile.pref - #--------------------------------------------------------------------------------- # IRX modules diff --git a/misc/psp/Makefile b/misc/psp/Makefile index e7d10cc6d..73dd5a810 100644 --- a/misc/psp/Makefile +++ b/misc/psp/Makefile @@ -7,13 +7,20 @@ $(warning export PSPSDK=$$(shell psp-config --pspsdk-path)) $(error Failed to find PSPSDK installation) endif +# Name of the final output TARGET = ClassiCube-psp +# List of directories containing source code +SOURCE_DIRS = src third_party/bearssl/src +# Directory where object files are placed +BUILD_DIR = build/psp + PSP_EBOOT_TITLE = ClassiCube PSP_EBOOT_ICON = misc/psp/ICON0.png -BUILD_DIR := build/psp -SOURCE_DIRS := src third_party/bearssl/src +#--------------------------------------------------------------------------------- +# Code generation +#--------------------------------------------------------------------------------- C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o))) @@ -36,17 +43,22 @@ include $(PSPSDK)/lib/build.mak #--------------------------------------------------------------------------------- -# object generation +# main targets #--------------------------------------------------------------------------------- $(BUILD_DIR): mkdir -p $(BUILD_DIR) + +#--------------------------------------------------------------------------------- +# object generation +#--------------------------------------------------------------------------------- $(BUILD_DIR)/%.o : src/%.c $(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o : third_party/bearssl/src/%.c $(CC) $(CFLAGS) -c $< -o $@ + # Dependency tracking $(DEPFILES): diff --git a/misc/switch/Makefile b/misc/switch/Makefile index e095baeb8..b12d7d2fa 100644 --- a/misc/switch/Makefile +++ b/misc/switch/Makefile @@ -2,8 +2,6 @@ ifeq ($(strip $(DEVKITPRO)),) $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro) endif -include $(DEVKITPRO)/devkitA64/base_tools - #--------------------------------------------------------------------------------- # Configurable options @@ -41,7 +39,7 @@ LIBNX = $(DEVKITPRO)/libnx INCLUDES += $(foreach dir, $(LIBNX), -I$(dir)/include) LDFLAGS += $(foreach dir, $(LIBNX), -L$(dir)/lib) -PORTLIBS = $(PORTLIBS_PATH)/switch +PORTLIBS = $(DEVKITPRO)/portlibs/switch INCLUDES += $(foreach dir, $(PORTLIBS), -I$(dir)/include) LDFLAGS += $(foreach dir, $(PORTLIBS), -L$(dir)/lib) @@ -50,6 +48,18 @@ DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d DEPFILES := $(OBJS:%.o=%.d) +#--------------------------------------------------------------------------------- +# Compiler tools +#--------------------------------------------------------------------------------- +PREFIX := $(DEVKITPRO)/devkitA64/bin/aarch64-none-elf- +A64_AS := $(PREFIX)as +A64_CC := $(PREFIX)gcc +A64_CXX := $(PREFIX)g++ + +ELF2NRO := $(DEVKITPRO)/tools/bin/elf2nro +NACPTOOL := $(DEVKITPRO)/tools/bin/nacptool + + #--------------------------------------------------------------------------------- # Main targets #--------------------------------------------------------------------------------- @@ -66,26 +76,26 @@ $(BUILD_DIR): # Executable generation #--------------------------------------------------------------------------------- $(TARGET).elf: $(OBJS) - $(CXX) $(LDFLAGS) $^ -o $@ $(LIBS) + $(A64_CXX) $(LDFLAGS) $^ -o $@ $(LIBS) $(BUILD_DIR)/$(TARGET).nacp: - nacptool --create "$(APP_TITLE)" "$(APP_AUTHOR)" "$(APP_VERSION)" $@ --titleid=$(APP_TITLEID) + $(NACPTOOL) --create "$(APP_TITLE)" "$(APP_AUTHOR)" "$(APP_VERSION)" $@ --titleid=$(APP_TITLEID) $(TARGET).nro: $(TARGET).elf $(BUILD_DIR)/$(TARGET).nacp - elf2nro $< $@ --icon=$(APP_ICON) --nacp=$(BUILD_DIR)/$(TARGET).nacp + $(ELF2NRO) $< $@ --icon=$(APP_ICON) --nacp=$(BUILD_DIR)/$(TARGET).nacp #--------------------------------------------------------------------------------- # Object generation #--------------------------------------------------------------------------------- $(BUILD_DIR)/%.o: src/%.c - $(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ + $(A64_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o: src/switch/%.c - $(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ + $(A64_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o: third_party/bearssl/src/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(A64_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ #--------------------------------------------------------------------------------- diff --git a/misc/vita/Makefile b/misc/vita/Makefile index fb01177ca..eb2666bc1 100644 --- a/misc/vita/Makefile +++ b/misc/vita/Makefile @@ -1,33 +1,63 @@ ifeq ($(strip $(VITASDK)),) $(warning "Please set VITASDK variables in your environment. For example:") $(warning export VITASDK=/usr/local/vitasdk) -$(warning export PATH=$$VITASDK/bin:$$PATH) $(error Failed to find VitaSDK installation) endif + +#--------------------------------------------------------------------------------- +# Configurable options +#--------------------------------------------------------------------------------- +# Name of the final output +TARGET := ClassiCube-vita +# List of directories containing source code +SOURCE_DIRS := src src/psvita third_party/bearssl/src +# Directory where object files are placed +BUILD_DIR := build/vita + PROJECT_TITLE := ClassiCube PROJECT_TITLEID := CUBE00200 -TARGET := ClassiCube-vita -BUILD_DIR := build/vita -SOURCE_DIRS := src third_party/bearssl/src -CFLAGS += -Wl,-q -Ithird_party/bearssl/inc -O1 -C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) -OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o))) +#--------------------------------------------------------------------------------- +# Code generation +#--------------------------------------------------------------------------------- +C_FILES = $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c)) +OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o))) -LIBS += -lm -lSceDisplay_stub -lSceCtrl_stub -lSceTouch_stub -lSceGxm_stub -lSceCommonDialog_stub -lSceAppUtil_stub +CFLAGS = -Ithird_party/bearssl/inc -O1 + +LDFLAGS = -Wl,-q +LIBS = -lm -lSceDisplay_stub -lSceCtrl_stub -lSceTouch_stub -lSceGxm_stub -lSceCommonDialog_stub -lSceAppUtil_stub # Dependency tracking DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d DEPFILES := $(OBJS:%.o=%.d) +#--------------------------------------------------------------------------------- +# Compiler tools +#--------------------------------------------------------------------------------- +PREFIX := $(VITASDK)/bin/arm-vita-eabi- +VITA_AS := $(PREFIX)as +VITA_CC := $(PREFIX)gcc +VITA_CXX:= $(PREFIX)g++ +VITA_STRIP := $(PREFIX)strip + +PACK_VPK := $(VITASDK)/bin/vita-pack-vpk +MAKE_FSELF := $(VITASDK)/bin/vita-make-fself +MKSOFEX := $(VITASDK)/bin/vita-mksfoex +ELF_CREATE := $(VITASDK)/bin/vita-elf-create + + #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- default: $(BUILD_DIR) $(TARGET).vpk +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) + clean: rm $(TARGET).velf $(TARGET).elf $(TARGET).vpk param.sfo eboot.bin $(OBJS) @@ -36,34 +66,35 @@ clean: # executable generation #--------------------------------------------------------------------------------- $(TARGET).vpk: eboot.bin param.sfo - vita-pack-vpk -s param.sfo -b eboot.bin -a misc/vita/sce_sys/ICON0.png=sce_sys/ICON0.png $(TARGET).vpk + $(PACK_VPK) -s param.sfo -b eboot.bin -a misc/vita/sce_sys/ICON0.png=sce_sys/ICON0.png $(TARGET).vpk eboot.bin: $(TARGET).velf - vita-make-fself $(TARGET).velf eboot.bin + $(MAKE_FSELF) $(TARGET).velf eboot.bin param.sfo: - vita-mksfoex -s TITLE_ID="$(PROJECT_TITLEID)" "$(PROJECT_TITLE)" param.sfo + $(MKSOFEX) -s TITLE_ID="$(PROJECT_TITLEID)" "$(PROJECT_TITLE)" param.sfo $(TARGET).velf: $(TARGET).elf - arm-vita-eabi-strip -g $< - vita-elf-create $< $@ + $(VITA_STRIP) -g $< + $(ELF_CREATE) $< $@ $(TARGET).elf: $(OBJS) - arm-vita-eabi-gcc $(CFLAGS) $^ $(LIBS) -o $@ + $(VITA_CC) $(LDFLAGS) $^ $(LIBS) -o $@ #--------------------------------------------------------------------------------- # object generation #--------------------------------------------------------------------------------- -$(BUILD_DIR): - mkdir -p $(BUILD_DIR) - $(BUILD_DIR)/%.o : src/%.c - arm-vita-eabi-gcc $(CFLAGS) $(DEPFLAGS) -c $< -o $@ + $(VITA_CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o : third_party/bearssl/src/%.c - arm-vita-eabi-gcc $(CFLAGS) -c $< -o $@ + $(VITA_CC) $(CFLAGS) -c $< -o $@ + +#--------------------------------------------------------------------------------- +# Dependency tracking +#--------------------------------------------------------------------------------- # Dependency tracking $(DEPFILES): diff --git a/misc/wii/Makefile b/misc/wii/Makefile index 6423eeab5..400872fd4 100644 --- a/misc/wii/Makefile +++ b/misc/wii/Makefile @@ -2,8 +2,6 @@ ifeq ($(strip $(DEVKITPRO)),) $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=devkitPro) endif -include $(DEVKITPRO)/devkitPPC/base_tools - #--------------------------------------------------------------------------------- # Configurable options @@ -37,6 +35,17 @@ DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d DEPFILES := $(OBJS:%.o=%.d) +#--------------------------------------------------------------------------------- +# Compiler tools +#--------------------------------------------------------------------------------- +PREFIX := $(DEVKITPRO)/devkitPPC/bin/powerpc-eabi- +PPC_AS := $(PREFIX)as +PPC_CC := $(PREFIX)gcc +PPC_CXX := $(PREFIX)g++ + +ELF2DOL := $(DEVKITPRO)/tools/bin/elf2dol + + #--------------------------------------------------------------------------------- # Main targets #--------------------------------------------------------------------------------- @@ -53,23 +62,23 @@ $(BUILD_DIR): # Executable generation #--------------------------------------------------------------------------------- $(TARGET).elf: $(OBJS) - $(CC) $(LDFLAGS) $^ -o $@ $(LIBS) + $(PPC_CC) $(LDFLAGS) $^ -o $@ $(LIBS) $(TARGET).dol: $(TARGET).elf - elf2dol $< $@ + $(ELF2DOL) $< $@ #--------------------------------------------------------------------------------- # Object generation #--------------------------------------------------------------------------------- $(BUILD_DIR)/%.o: src/%.c - $(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ + $(PPC_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o: src/gcwii/%.c - $(CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ + $(PPC_CC) $(CFLAGS) $(INCLUDES) $(DEPFLAGS) -c $< -o $@ $(BUILD_DIR)/%.o: third_party/bearssl/src/%.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ + $(PPC_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ #--------------------------------------------------------------------------------- diff --git a/misc/wiiu/Makefile b/misc/wiiu/Makefile index 10f2dc13d..53ab0da4b 100644 --- a/misc/wiiu/Makefile +++ b/misc/wiiu/Makefile @@ -13,9 +13,9 @@ TOPDIR ?= $(CURDIR) # APP_SHORTNAME sets the short name of the application # APP_AUTHOR sets the author of the application #------------------------------------------------------------------------------- -#APP_NAME := Application Name -#APP_SHORTNAME := App Name -#APP_AUTHOR := Built with devkitPPC & wut +APP_NAME := ClassiCube +APP_SHORTNAME := ClassiCube +APP_AUTHOR := ClassiCube team include $(DEVKITPRO)/wut/share/wut_rules diff --git a/src/Platform_32x.c b/src/32x/Platform_32x.c similarity index 92% rename from src/Platform_32x.c rename to src/32x/Platform_32x.c index f7037d7db..2c7cc43b6 100644 --- a/src/Platform_32x.c +++ b/src/32x/Platform_32x.c @@ -1,24 +1,23 @@ -#include "Core.h" -#if defined PLAT_32X - #define OVERRIDE_MEM_FUNCTIONS -#include "_PlatformBase.h" -#include "Stream.h" -#include "ExtMath.h" -#include "Funcs.h" -#include "Window.h" -#include "Utils.h" -#include "Errors.h" -#include "Options.h" -#include "PackedCol.h" +#include "../_PlatformBase.h" +#include "../Stream.h" +#include "../ExtMath.h" +#include "../Funcs.h" +#include "../Window.h" +#include "../Utils.h" +#include "../Errors.h" +#include "../Options.h" +#include "../PackedCol.h" + #include #include #include #include -#include "_PlatformConsole.h" -#include "../misc/32x/32x.h" -#include "../misc/32x/hw_32x.h" -#include "../third_party/tinyalloc/tinyalloc.c" +#include "../_PlatformConsole.h" + +#include "../../misc/32x/32x.h" +#include "../../misc/32x/hw_32x.h" +#include "../../third_party/tinyalloc/tinyalloc.c" const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = 99999; @@ -276,5 +275,4 @@ cc_result Platform_Encrypt(const void* data, int len, cc_string* dst) { cc_result Platform_Decrypt(const void* data, int len, cc_string* dst) { return ERR_NOT_SUPPORTED; } -#endif diff --git a/src/Window_32x.c b/src/32x/Window_32x.c similarity index 91% rename from src/Window_32x.c rename to src/32x/Window_32x.c index fab424d35..6273424c1 100644 --- a/src/Window_32x.c +++ b/src/32x/Window_32x.c @@ -1,21 +1,20 @@ -#include "Core.h" -#if defined CC_BUILD_32X -#include "Window.h" -#include "Platform.h" -#include "Input.h" -#include "Event.h" -#include "Graphics.h" -#include "String.h" -#include "Funcs.h" -#include "Bitmap.h" -#include "Errors.h" -#include "ExtMath.h" -#include "Logger.h" +#include "../Window.h" +#include "../Platform.h" +#include "../Input.h" +#include "../Event.h" +#include "../Graphics.h" +#include "../String.h" +#include "../Funcs.h" +#include "../Bitmap.h" +#include "../Errors.h" +#include "../ExtMath.h" +#include "../Logger.h" + #include #include #include -#include "../misc/32x/32x.h" -#include "../misc/32x/hw_32x.h" +#include "../../misc/32x/32x.h" +#include "../../misc/32x/hw_32x.h" // framebuffer only 128 kb #define SCREEN_WIDTH 320 @@ -163,4 +162,4 @@ cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) { cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) { return ERR_NOT_SUPPORTED; } -#endif + diff --git a/src/3ds/Audio_3DS.c b/src/3ds/Audio_3DS.c index fbf1776b2..8f4bb6d1a 100644 --- a/src/3ds/Audio_3DS.c +++ b/src/3ds/Audio_3DS.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../Audio.h" #include <3ds.h> diff --git a/src/3ds/Graphics_3DS.c b/src/3ds/Graphics_3DS.c index a020711ab..7e0e4e922 100644 --- a/src/3ds/Graphics_3DS.c +++ b/src/3ds/Graphics_3DS.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../_GraphicsBase.h" #include "../Errors.h" #include "../Logger.h" diff --git a/src/3ds/Platform_3DS.c b/src/3ds/Platform_3DS.c index 7db38c6cb..dec2bfb58 100644 --- a/src/3ds/Platform_3DS.c +++ b/src/3ds/Platform_3DS.c @@ -1,4 +1,3 @@ -#include "../Core.h" #define CC_XTEA_ENCRYPTION #include "../_PlatformBase.h" #include "../Stream.h" diff --git a/src/3ds/Window_3DS.c b/src/3ds/Window_3DS.c index ee0ee10d4..75d2e9cfc 100644 --- a/src/3ds/Window_3DS.c +++ b/src/3ds/Window_3DS.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../Window.h" #include "../Platform.h" #include "../Input.h" diff --git a/src/gba/Platform_GBA.c b/src/gba/Platform_GBA.c index 5eea3c540..aa0f25656 100644 --- a/src/gba/Platform_GBA.c +++ b/src/gba/Platform_GBA.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../_PlatformBase.h" #include "../Stream.h" #include "../ExtMath.h" diff --git a/src/gba/Window_GBA.c b/src/gba/Window_GBA.c index cce168a44..bb613c0ac 100644 --- a/src/gba/Window_GBA.c +++ b/src/gba/Window_GBA.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../Window.h" #include "../Platform.h" #include "../Input.h" diff --git a/src/gcwii/Audio_GCWii.c b/src/gcwii/Audio_GCWii.c index d6d3d65ea..b3c9731f8 100644 --- a/src/gcwii/Audio_GCWii.c +++ b/src/gcwii/Audio_GCWii.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../Audio.h" #include diff --git a/src/gcwii/Graphics_GCWii.c b/src/gcwii/Graphics_GCWii.c index ec73f3dd4..cd4fdfd96 100644 --- a/src/gcwii/Graphics_GCWii.c +++ b/src/gcwii/Graphics_GCWii.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../_GraphicsBase.h" #include "../Errors.h" #include "../Logger.h" diff --git a/src/gcwii/Platform_GCWii.c b/src/gcwii/Platform_GCWii.c index 930089fe5..11d73737e 100644 --- a/src/gcwii/Platform_GCWii.c +++ b/src/gcwii/Platform_GCWii.c @@ -1,4 +1,3 @@ -#include "../Core.h" #define CC_XTEA_ENCRYPTION #include "../_PlatformBase.h" #include "../Stream.h" diff --git a/src/gcwii/Window_GCWii.c b/src/gcwii/Window_GCWii.c index 243238da8..ee414eb71 100644 --- a/src/gcwii/Window_GCWii.c +++ b/src/gcwii/Window_GCWii.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../Window.h" #include "../Platform.h" #include "../Input.h" diff --git a/src/ps1/Graphics_PS1.c b/src/ps1/Graphics_PS1.c index 65d52c786..ac73191e4 100644 --- a/src/ps1/Graphics_PS1.c +++ b/src/ps1/Graphics_PS1.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../_GraphicsBase.h" #include "../Errors.h" #include "../Window.h" diff --git a/src/ps1/Platform_PS1.c b/src/ps1/Platform_PS1.c index 1a9124a29..0f96bc8d7 100644 --- a/src/ps1/Platform_PS1.c +++ b/src/ps1/Platform_PS1.c @@ -1,4 +1,3 @@ -#include "../Core.h" #define CC_XTEA_ENCRYPTION #include "../_PlatformBase.h" #include "../Stream.h" diff --git a/src/ps1/Window_PS1.c b/src/ps1/Window_PS1.c index 6d82d8171..71f69ab90 100644 --- a/src/ps1/Window_PS1.c +++ b/src/ps1/Window_PS1.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../Window.h" #include "../Platform.h" #include "../Input.h" diff --git a/src/ps2/Graphics_PS2.c b/src/ps2/Graphics_PS2.c index 6899b8128..f5a18d0c7 100644 --- a/src/ps2/Graphics_PS2.c +++ b/src/ps2/Graphics_PS2.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../_GraphicsBase.h" #include "../Errors.h" #include "../Window.h" diff --git a/src/ps2/Platform_PS2.c b/src/ps2/Platform_PS2.c index 54395961b..1e43b9dce 100644 --- a/src/ps2/Platform_PS2.c +++ b/src/ps2/Platform_PS2.c @@ -1,4 +1,3 @@ -#include "../Core.h" #define CC_XTEA_ENCRYPTION #include "../_PlatformBase.h" #include "../Stream.h" diff --git a/src/ps2/Window_PS2.c b/src/ps2/Window_PS2.c index 77ee5fe5f..c51039a20 100644 --- a/src/ps2/Window_PS2.c +++ b/src/ps2/Window_PS2.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../Window.h" #include "../Platform.h" #include "../Input.h" @@ -25,7 +24,7 @@ #include static cc_bool launcherMode, mouseSupported, kbdSupported; -#include "VirtualCursor.h" +#include "../VirtualCursor.h" struct _DisplayData DisplayInfo; struct cc_window WindowInfo; diff --git a/src/Graphics_PSVita.c b/src/psvita/Graphics_PSVita.c similarity index 96% rename from src/Graphics_PSVita.c rename to src/psvita/Graphics_PSVita.c index c17d4dab4..c80c249cf 100644 --- a/src/Graphics_PSVita.c +++ b/src/psvita/Graphics_PSVita.c @@ -1,9 +1,8 @@ -#include "Core.h" -#if defined CC_BUILD_PSVITA -#include "_GraphicsBase.h" -#include "Errors.h" -#include "Logger.h" -#include "Window.h" +#include "../_GraphicsBase.h" +#include "../Errors.h" +#include "../Logger.h" +#include "../Window.h" + #include // TODO track last frame used on @@ -1186,4 +1185,4 @@ void Gfx_ClearBuffers(GfxBuffers buffers) { Gfx_SetDepthTest(true); } -#endif + diff --git a/src/Platform_PSVita.c b/src/psvita/Platform_PSVita.c similarity index 95% rename from src/Platform_PSVita.c rename to src/psvita/Platform_PSVita.c index d46478bbc..1bd5b9103 100644 --- a/src/Platform_PSVita.c +++ b/src/psvita/Platform_PSVita.c @@ -1,20 +1,17 @@ -#include "Core.h" -#if defined CC_BUILD_PSVITA - #define CC_XTEA_ENCRYPTION -#include "_PlatformBase.h" -#include "Stream.h" -#include "ExtMath.h" -#include "Funcs.h" -#include "Window.h" -#include "Utils.h" -#include "Errors.h" +#include "../_PlatformBase.h" +#include "../Stream.h" +#include "../ExtMath.h" +#include "../Funcs.h" +#include "../Window.h" +#include "../Utils.h" +#include "../Errors.h" #include #include #include #include -#include "_PlatformConsole.h" +#include "../_PlatformConsole.h" const cc_result ReturnCode_FileShareViolation = 1000000000; // not used const cc_result ReturnCode_FileNotFound = ENOENT; @@ -452,4 +449,4 @@ static cc_result GetMachineID(cc_uint32* key) { Mem_Copy(key, MACHINE_KEY, sizeof(MACHINE_KEY) - 1); return 0; } -#endif + diff --git a/src/Window_PSVita.c b/src/psvita/Window_PSVita.c similarity index 94% rename from src/Window_PSVita.c rename to src/psvita/Window_PSVita.c index 26c4dbd05..e0824e818 100644 --- a/src/Window_PSVita.c +++ b/src/psvita/Window_PSVita.c @@ -1,17 +1,16 @@ -#include "Core.h" -#if defined CC_BUILD_PSVITA -#include "Window.h" -#include "Platform.h" -#include "Input.h" -#include "Event.h" -#include "Graphics.h" -#include "String.h" -#include "Funcs.h" -#include "Bitmap.h" -#include "Errors.h" -#include "ExtMath.h" -#include "Logger.h" -#include "VirtualKeyboard.h" +#include "../Window.h" +#include "../Platform.h" +#include "../Input.h" +#include "../Event.h" +#include "../Graphics.h" +#include "../String.h" +#include "../Funcs.h" +#include "../Bitmap.h" +#include "../Errors.h" +#include "../ExtMath.h" +#include "../Logger.h" +#include "../VirtualKeyboard.h" + #include static cc_bool launcherMode; @@ -308,4 +307,4 @@ void OnscreenKeyboard_SetText(const cc_string* text) { void OnscreenKeyboard_Close(void) { VirtualKeyboard_Close(); } -#endif + diff --git a/src/switch/Audio_Switch.c b/src/switch/Audio_Switch.c index 0d6829513..61180112a 100644 --- a/src/switch/Audio_Switch.c +++ b/src/switch/Audio_Switch.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../Audio.h" #include diff --git a/src/switch/Platform_Switch.c b/src/switch/Platform_Switch.c index 71b7fb9f4..7cabda845 100644 --- a/src/switch/Platform_Switch.c +++ b/src/switch/Platform_Switch.c @@ -1,4 +1,3 @@ -#include "../Core.h" #define CC_XTEA_ENCRYPTION #include "../_PlatformBase.h" #include "../Stream.h" diff --git a/src/switch/Window_Switch.c b/src/switch/Window_Switch.c index cc4a4a2ec..4521cb94a 100644 --- a/src/switch/Window_Switch.c +++ b/src/switch/Window_Switch.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../_WindowBase.h" #include "../Window.h" #include "../Platform.h" diff --git a/src/xbox/Graphics_Xbox.c b/src/xbox/Graphics_Xbox.c index 77f86258c..e4c577b04 100644 --- a/src/xbox/Graphics_Xbox.c +++ b/src/xbox/Graphics_Xbox.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../_GraphicsBase.h" #include "../Errors.h" #include "../Logger.h" diff --git a/src/xbox/Platform_Xbox.c b/src/xbox/Platform_Xbox.c index c5aab40b8..ca1929076 100644 --- a/src/xbox/Platform_Xbox.c +++ b/src/xbox/Platform_Xbox.c @@ -1,4 +1,3 @@ -#include "../Core.h" #define CC_XTEA_ENCRYPTION #include "../_PlatformBase.h" #include "../Stream.h" diff --git a/src/xbox/Window_Xbox.c b/src/xbox/Window_Xbox.c index 4dc63e4fb..f974f9a8a 100644 --- a/src/xbox/Window_Xbox.c +++ b/src/xbox/Window_Xbox.c @@ -1,4 +1,3 @@ -#include "../Core.h" #include "../Window.h" #include "../Platform.h" #include "../Input.h"