Moved JabyEngine Code to a Library folder

This commit is contained in:
2022-07-10 11:36:33 +02:00
parent 977d853768
commit 3dec561262
10 changed files with 13 additions and 13 deletions

54
Library/Code/Makefile Normal file
View File

@@ -0,0 +1,54 @@
BINDIR ?= bin/
PCSX_REDUX ?= ../../../../GIT/pcsx-redux/src/mips
PSYQ_PATH ?= ../../../../PSYQ/Converted
TARGET = JabyEngine
TYPE = ps-exe
BUILD = Release
#OVERLAYSCRIPT ?= overlay.ld
#OVERLAYSECTION ?= .ovly0 .ovly1
rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2))
#Source list
SRCS = $(call rwildcard, src, c cpp)
SRCS += $(PCSX_REDUX)/common/crt0/crt0.s
CPPFLAGS += -I$(PSYQ_PATH)/Include
LDFLAGS += -L$(PSYQ_PATH)/Lib
LDFLAGS += -Wl,--start-group
LDFLAGS += -lapi
LDFLAGS += -lc
LDFLAGS += -lc2
LDFLAGS += -lcard
LDFLAGS += -lcomb
LDFLAGS += -lds
LDFLAGS += -letc
LDFLAGS += -lgpu
LDFLAGS += -lgs
LDFLAGS += -lgte
LDFLAGS += -lgun
LDFLAGS += -lhmd
LDFLAGS += -lmath
LDFLAGS += -lmcrd
LDFLAGS += -lmcx
LDFLAGS += -lpad
LDFLAGS += -lpress
LDFLAGS += -lsio
LDFLAGS += -lsnd
LDFLAGS += -lspu
LDFLAGS += -ltap
LDFLAGS += -lcd
LDFLAGS += -Wl,--end-group
ifdef USE_JABY_MAKE
include Wrapper.mk
else
include $(PCSX_REDUX)/common.mk
endif
fullclean: clean
rm -fr iso/Info/* bin/GlobalLBATable.bin
rebuild: fullclean all

19
Library/Code/Wrapper.mk Normal file
View File

@@ -0,0 +1,19 @@
#this makefile translates from NUGGET make to JabyMake
ARTIFACT = JabyEngine
BUILD_DIR = bin
ifeq ($(BUILD),Release)
BUILD_PROFILE := release
else
BUILD_PROFILE := debug
endif
CCFLAGS_all := $(CPPFLAGS)
LIBS := $(LDFLAGS)
undefine CPPFLAGS
undefine LDFLAGS
undefine BUILD
#include the real make file
include ../Makefile

View File

@@ -0,0 +1,4 @@
BOOT=cdrom:\SCES_003.90;1
TCB=4
EVENT=10
STACK=801FFFF0

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<iso_project image_name="iso/JabyEngine.bin" cue_sheet="iso/JabyEngine.cue" no_xa="0">
<track type="data">
<identifiers
system = "PLAYSTATION"
application = "PLAYSTATION"
volume = "MYDISC"
volume_set = "MYDISC"
publisher = "JABY"
data_preparer = "MKPSXISO"
copyright = "COPYLEFT"
/>
<license file="../../PSYQ/psyq/cdgen/LCNSFILE/LICENSEE.DAT"/>
<directory_tree>
<file name="SYSTEM.CNF" type="data" source="Library/Code/iso/JabyEngine.cnf"/>
<file name="SCES_003.90" type="data" source="Library/Code/bin/PSX-release/JabyEngine.psexe"/>
<dummy sectors="1024"/>
</directory_tree>
</track>
<!--<track type="audio" source="..\Ressources\fox.wav"/>-->
<!--<track type="audio" source="..\Ressources\shark.wav"/>-->
</iso_project>

View File

@@ -0,0 +1,6 @@
{
"Output":"Library/Code/bin/GlobalLBATable.bin",
"Input":"Library/Code/iso/Info/JabyEngine.lba",
"Order": [
]
}

View File

@@ -0,0 +1,8 @@
#include "JabyEngine.h"
#include <stdio.h>
int main()
{
printf("Hello Planschi!\n");
return 0;
}

View File

@@ -0,0 +1,4 @@
#ifndef JABYENGINE_H
#define JABYENGINE_H
#endif //!JABYENGINE_H

100
Library/Makefile Normal file
View File

@@ -0,0 +1,100 @@
#Build architecture/variant string, possible values: x86, armv7le, etc...
PLATFORM ?= PSX
#Build profile, possible values: release, debug, profile, coverage
BUILD_DIR ?= build
BUILD_PROFILE ?= debug
CONFIG_NAME ?= $(PLATFORM)-$(BUILD_PROFILE)
OUTPUT_DIR = $(BUILD_DIR)/$(CONFIG_NAME)
TARGET = $(OUTPUT_DIR)/$(ARTIFACT)
#Compiler definitions
HAS_LINUX_MIPS_GCC = $(shell which mipsel-linux-gnu-gcc > /dev/null 2> /dev/null && echo true || echo false)
ifeq ($(HAS_LINUX_MIPS_GCC),true)
PREFIX ?= mipsel-linux-gnu
FORMAT ?= elf32-tradlittlemips
else
PREFIX ?= mipsel-none-elf
FORMAT ?= elf32-littlemips
endif
$(info We currently only support normal linker scripts)
LDSCRIPT ?= $(PCSX_REDUX)/ps-exe.ld
LDSCRIPT := $(addprefix $(PCSX_REDUX)/default.ld , -T$(LDSCRIPT))
CC = $(PREFIX)-gcc-10
CXX = $(PREFIX)-g++-10
LD = $(CXX)
#architecture flags
ARCHFLAGS = -march=mips1 -mabi=32 -EL -fno-pic -mno-shared -mno-abicalls -mfp32
ARCHFLAGS += -fno-stack-protector -nostdlib -ffreestanding
#Compiler flags for build profiles
CCFLAGS_release += -O3
CCFLAGS_debug += -O0
CXXFLAGS += -fno-exceptions -fno-rtti
USE_FUNCTION_SECTIONS ?= true
ifeq ($(USE_FUNCTION_SECTIONS),true)
CCFLAGS_all += -ffunction-sections
endif
CCFLAGS_all += -mno-gpopt -fomit-frame-pointer
CCFLAGS_all += -fno-builtin -fno-strict-aliasing -Wno-attributes
CCFLAGS_all += $(ARCHFLAGS)
CCFLAGS_all += $(CCFLAGS_$(BUILD_PROFILE))
#Linker flags
LDFLAGS_release += -Os
LDFLAGS_all += -Wl,-Map=$(TARGET).map -nostdlib -T$(LDSCRIPT) -static -Wl,--gc-sections -Wl,--build-id=none
LDFLAGS_all += $(ARCHFLAGS) -Wl,--oformat=$(FORMAT)
LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE))
LIBS_all += $(LIBS_$(BUILD_PROFILE))
DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@
#Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp
rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2))
#Object files list
OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(subst ..,!super,$(basename $(SRCS)))))
#Compiling rule
$(OUTPUT_DIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) -c $(DEPS) -o $@ $(CCFLAGS_all) $(CCFLAGS) $<
$(OUTPUT_DIR)/%.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) -c $(DEPS) -o $@ $(CCFLAGS_all) $(CXXFLAGS) $<
.SECONDEXPANSION:
$(OUTPUT_DIR)/%.o: $$(subst !super,..,%.s)
@mkdir -p $(dir $@)
$(CC) $(ARCHFLAGS) -I$(PCSX_REDUX) -g -c -o $@ $<
#Linking rule
$(TARGET).elf: $(OBJS)
$(LD) -o $(TARGET).elf $(LDFLAGS_all) $(LDFLAGS) $(OBJS) $(LIBS_all) $(LIBS)
#Strips the psexe
$(TARGET).psexe: $(TARGET).elf
$(PREFIX)-objcopy $(addprefix -R , $(OVERLAYSECTION)) -O binary $< $@
#Rules section for default compilation and linking
all: $(TARGET).psexe
clean:
rm -fr $(OUTPUT_DIR)
rebuild:
$(MAKE) clean
$(MAKE) all
#Inclusion of dependencies (object files to source and includes)
-include $(OBJS:%.o=%.d)