mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-10 16:03:15 -04:00
Slightly tidy up some console makefiles
This commit is contained in:
parent
b72d7027f5
commit
af3b4ed6d3
@ -1,48 +1,39 @@
|
|||||||
BUILD_DIR := build-dc
|
BUILD_DIR := build-dc
|
||||||
SOURCE_DIRS := src third_party/bearssl/src misc/dreamcast
|
SOURCE_DIRS := src third_party/bearssl/src misc/dreamcast
|
||||||
|
TARGET := ClassiCube-dc
|
||||||
|
|
||||||
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
S_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.S))
|
||||||
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
C_FILES := $(foreach dir,$(SOURCE_DIRS),$(wildcard $(dir)/*.c))
|
||||||
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o) $(S_FILES:%.S=%.o)))
|
||||||
CFLAGS :=-g -O2 -pipe -fno-math-errno -Ithird_party/bearssl/inc
|
CFLAGS := -g -O2 -pipe -fno-math-errno -Ithird_party/bearssl/inc
|
||||||
|
|
||||||
# Dependency tracking
|
# Dependency tracking
|
||||||
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
||||||
DEPFILES := $(OBJS:%.o=%.d)
|
DEPFILES := $(OBJS:%.o=%.d)
|
||||||
|
|
||||||
GLDC_LIB=third_party/gldc/libGLdc.a
|
GLDC_LIB = third_party/gldc/libGLdc.a
|
||||||
LDFLAGS=-g
|
LDFLAGS = -g
|
||||||
LIBS=-lm $(GLDC_LIB) -lppp -lkosfat
|
LIBS = -lm $(GLDC_LIB) -lppp -lkosfat
|
||||||
|
|
||||||
TARGET := ClassiCube-dc
|
|
||||||
CC_TEXTURES = misc/dreamcast/classicube.zip
|
|
||||||
|
|
||||||
ifeq ($(strip $(KOS_BASE)),)
|
ifeq ($(strip $(KOS_BASE)),)
|
||||||
$(error "Please set KOS variables in your environment.")
|
$(warning Please set KOS variables in your environment. For example:)
|
||||||
|
$(warning source /opt/toolchains/dc/kos/environ.sh)
|
||||||
|
$(error Failed to find KallistiOS installation)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
default: $(CC_TEXTURES) $(GLDC_LIB) $(BUILD_DIR) $(TARGET).cdi
|
|
||||||
|
|
||||||
$(BUILD_DIR):
|
#---------------------------------------------------------------------------------
|
||||||
mkdir -p $(BUILD_DIR)
|
# main targets
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
default: $(GLDC_LIB) $(BUILD_DIR) $(TARGET).cdi
|
||||||
|
|
||||||
$(GLDC_LIB): FORCE
|
clean:
|
||||||
$(MAKE) -C third_party/gldc
|
rm $(TARGET).cdi $(TARGET).iso $(TARGET).elf $(TARGET)-scr.bin $(TARGET).bin $(OBJS)
|
||||||
FORCE: ;
|
|
||||||
|
|
||||||
# TODO add textures to misc folder ?
|
|
||||||
$(CC_TEXTURES):
|
|
||||||
curl http://www.classicube.net/static/default.zip -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: src/%.c
|
|
||||||
kos-cc $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: misc/dreamcast/%.S
|
|
||||||
kos-cc -c $< -o $@
|
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
|
||||||
kos-cc $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# executable generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
$(TARGET).elf: $(OBJS)
|
$(TARGET).elf: $(OBJS)
|
||||||
kos-cc $(LDFLAGS) $^ -o $@ $(LIBS)
|
kos-cc $(LDFLAGS) $^ -o $@ $(LIBS)
|
||||||
|
|
||||||
@ -60,14 +51,34 @@ $(TARGET).iso: $(TARGET)-scr.bin
|
|||||||
mkdir -p ISO_FILES/maps
|
mkdir -p ISO_FILES/maps
|
||||||
mkdir -p ISO_FILES/texpacks
|
mkdir -p ISO_FILES/texpacks
|
||||||
mkdir -p ISO_FILES/texturecache
|
mkdir -p ISO_FILES/texturecache
|
||||||
cp $(CC_TEXTURES) ISO_FILES/texpacks/default.zip
|
cp misc/dreamcast/classicube.zip ISO_FILES/texpacks/default.zip
|
||||||
cp misc/dreamcast/IP.BIN IP.BIN
|
cp misc/dreamcast/IP.BIN IP.BIN
|
||||||
mkisofs -G IP.BIN -C 0,11702 -J -l -r -o $(TARGET).iso ISO_FILES
|
mkisofs -G IP.BIN -C 0,11702 -J -l -r -quiet -o $(TARGET).iso ISO_FILES
|
||||||
# genisoimage -V ClassiCube -G IP.BIN -joliet -rock -l -o $(TARGET).iso ISO_FILES
|
# genisoimage -V ClassiCube -G IP.BIN -joliet -rock -l -o $(TARGET).iso ISO_FILES
|
||||||
|
|
||||||
$(TARGET).cdi: $(TARGET).iso
|
$(TARGET).cdi: $(TARGET).iso
|
||||||
cdi4dc $(TARGET).iso $(TARGET).cdi
|
cdi4dc $(TARGET).iso $(TARGET).cdi
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# object generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(GLDC_LIB): FORCE
|
||||||
|
$(MAKE) -C third_party/gldc
|
||||||
|
FORCE: ;
|
||||||
|
|
||||||
|
$(BUILD_DIR):
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: src/%.c
|
||||||
|
kos-cc $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: third_party/bearssl/src/%.c
|
||||||
|
kos-cc $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(BUILD_DIR)/%.o: misc/dreamcast/%.S
|
||||||
|
kos-cc -c $< -o $@
|
||||||
|
|
||||||
# Dependency tracking
|
# Dependency tracking
|
||||||
$(DEPFILES):
|
$(DEPFILES):
|
||||||
|
|
||||||
|
@ -1,26 +1,27 @@
|
|||||||
all: ClassiCube-n64.z64
|
|
||||||
|
|
||||||
BUILD_DIR = build-n64
|
BUILD_DIR = build-n64
|
||||||
SOURCE_DIR = src
|
SOURCE_DIR = src
|
||||||
N64_ROM_TITLE = "ClassiCube"
|
N64_ROM_TITLE = "ClassiCube"
|
||||||
N64_ROM_RTC = true
|
N64_ROM_RTC = true
|
||||||
|
TARGET := ClassiCube-n64
|
||||||
|
|
||||||
CFILES := $(notdir $(wildcard src/*.c))
|
CFILES := $(notdir $(wildcard src/*.c))
|
||||||
OFILES := $(CFILES:.c=.o)
|
OFILES := $(CFILES:.c=.o)
|
||||||
OBJS := $(addprefix $(BUILD_DIR)/,$(OFILES))
|
OBJS := $(addprefix $(BUILD_DIR)/,$(OFILES))
|
||||||
CFLAGS := -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=incompatible-pointer-types -Wno-error=maybe-uninitialized
|
CFLAGS := -Wno-error=missing-braces -Wno-error=strict-aliasing -Wno-error=incompatible-pointer-types -Wno-error=maybe-uninitialized
|
||||||
|
|
||||||
|
default: $(TARGET).z64
|
||||||
|
|
||||||
include $(N64_INST)/include/n64.mk
|
include $(N64_INST)/include/n64.mk
|
||||||
|
|
||||||
ClassiCube-n64.z64: N64_ROM_TITLE = "ClassiCube"
|
$(TARGET).z64: N64_ROM_TITLE = "ClassiCube"
|
||||||
ClassiCube-n64.z64: $(BUILD_DIR)/filesystem.dfs
|
$(TARGET).z64: $(BUILD_DIR)/filesystem.dfs
|
||||||
|
|
||||||
$(BUILD_DIR)/filesystem.dfs: misc/n64/default.zip
|
$(BUILD_DIR)/filesystem.dfs: misc/n64/default.zip
|
||||||
|
|
||||||
$(BUILD_DIR)/ClassiCube-n64.elf: $(OBJS)
|
$(BUILD_DIR)/ClassiCube-n64.elf: $(OBJS)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILD_DIR) *.z64
|
rm -rf $(BUILD_DIR) $(TARGET).z64
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
|
||||||
-include $(wildcard $(BUILD_DIR)/*.d)
|
-include $(wildcard $(BUILD_DIR)/*.d)
|
||||||
|
@ -11,15 +11,30 @@ OBJS := $(addprefix $(BUILD_DIR)/, $(notdir $(C_FILES:%.c=%.o)))
|
|||||||
|
|
||||||
LIBS += -lm -lSceDisplay_stub -lSceCtrl_stub -lSceTouch_stub -lSceGxm_stub -lSceCommonDialog_stub
|
LIBS += -lm -lSceDisplay_stub -lSceCtrl_stub -lSceTouch_stub -lSceGxm_stub -lSceCommonDialog_stub
|
||||||
|
|
||||||
|
# Dependency tracking
|
||||||
|
DEPFLAGS = -MT $@ -MMD -MP -MF $(BUILD_DIR)/$*.d
|
||||||
|
DEPFILES := $(OBJS:%.o=%.d)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
# main targets
|
# main targets
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
default: $(BUILD_DIR) $(TARGET).vpk
|
default: $(BUILD_DIR) $(TARGET).vpk
|
||||||
|
|
||||||
$(BUILD_DIR):
|
clean:
|
||||||
mkdir -p $(BUILD_DIR)
|
rm $(TARGET).velf $(TARGET).elf $(TARGET).vpk param.sfo eboot.bin $(OBJS)
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# executable generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
$(TARGET).vpk: eboot.bin param.sfo
|
$(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
|
vita-pack-vpk -s param.sfo -b eboot.bin -a misc/vita/sce_sys/ICON0.png=sce_sys/ICON0.png $(TARGET).vpk
|
||||||
|
|
||||||
@ -36,13 +51,20 @@ $(TARGET).velf: $(TARGET).elf
|
|||||||
$(TARGET).elf: $(OBJS)
|
$(TARGET).elf: $(OBJS)
|
||||||
arm-vita-eabi-gcc $(CFLAGS) $^ $(LIBS) -o $@
|
arm-vita-eabi-gcc $(CFLAGS) $^ $(LIBS) -o $@
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# object generation
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
$(BUILD_DIR):
|
||||||
|
mkdir -p $(BUILD_DIR)
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o : src/%.c
|
$(BUILD_DIR)/%.o : src/%.c
|
||||||
arm-vita-eabi-gcc -c $(CFLAGS) -o $@ $<
|
arm-vita-eabi-gcc $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o : third_party/bearssl/src/%.c
|
$(BUILD_DIR)/%.o : third_party/bearssl/src/%.c
|
||||||
arm-vita-eabi-gcc -c $(CFLAGS) -o $@ $<
|
arm-vita-eabi-gcc $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
# TODO: There's gotta be a better way of .o to .c than this
|
# Dependency tracking
|
||||||
|
$(DEPFILES):
|
||||||
|
|
||||||
clean:
|
include $(wildcard $(DEPFILES))
|
||||||
rm $(TARGET).velf $(TARGET).elf $(TARGET).vpk param.sfo eboot.bin $(OBJS)
|
|
||||||
|
2
third_party/gldc/src/state.c
vendored
2
third_party/gldc/src/state.c
vendored
@ -40,6 +40,8 @@ void _glInitContext() {
|
|||||||
/* Depth Testing */
|
/* Depth Testing */
|
||||||
void glClearDepth(float depth) {
|
void glClearDepth(float depth) {
|
||||||
/* We reverse because using invW means that farther Z == lower number */
|
/* We reverse because using invW means that farther Z == lower number */
|
||||||
|
float D = MIN(1.0f - depth, PVR_MIN_Z);
|
||||||
|
Platform_Log2("DEPTH: %f3, %x", &D, &D);
|
||||||
pvr_set_zclip(MIN(1.0f - depth, PVR_MIN_Z));
|
pvr_set_zclip(MIN(1.0f - depth, PVR_MIN_Z));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user