Support Nugget and Jaby for make

This commit is contained in:
jaby 2022-04-24 21:24:35 +02:00
parent 61340f66c6
commit 0cadc7ff99
4 changed files with 38 additions and 63 deletions

View File

@ -42,7 +42,11 @@ 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

19
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

@ -28,7 +28,7 @@
"problemMatcher": [],
},
{
"label": "make project",
"label": "nugget make",
"type": "shell",
"dependsOrder": "sequence",
"dependsOn": ["make", "finalize"],
@ -38,9 +38,9 @@
}
},
{
"label": "new make",
"label": "jaby make",
"type": "shell",
"command": "wsl make ${input:target} -f ../Makefile BUILD_PROFILE=${input:build_profile}",
"command": "wsl make ${input:target} BUILD=${input:build} USE_JABY_MAKE=true",
"options": {
"cwd": "Code"
},
@ -100,10 +100,6 @@
"C_Cpp.default.compilerArgs": [
],
"C_Cpp.default.defines": [
],
"files.exclude": {
"**/*.o": true,
"**/*.dep": true
}
]
}
}

View File

@ -1,13 +1,12 @@
ARTIFACT = JabyEngine
#Build architecture/variant string, possible values: x86, armv7le, etc...
PLATFORM ?= x86_64
PLATFORM ?= PSX
#Build profile, possible values: release, debug, profile, coverage
BUILD_DIR ?= build
BUILD_PROFILE ?= debug
CONFIG_NAME ?= $(PLATFORM)-$(BUILD_PROFILE)
OUTPUT_DIR = build/$(CONFIG_NAME)
OUTPUT_DIR = $(BUILD_DIR)/$(CONFIG_NAME)
TARGET = $(OUTPUT_DIR)/$(ARTIFACT)
#Compiler definitions
@ -20,19 +19,17 @@ PREFIX ?= mipsel-none-elf
FORMAT ?= elf32-littlemips
endif
ROOTDIR = ../../../GIT/pcsx-redux/src/mips
LDSCRIPT ?= $(ROOTDIR)/ps-exe.ld
LDSCRIPT := $(addprefix $(ROOTDIR)/default.ld , -T$(LDSCRIPT))
$(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)
LIB_DEPS_NAMES = Qt_Obj
LIB_DEPS_PATHES = ../QtXTObj/build/$(CONFIG_NAME)-Qt_Obj
#LIBS += -lsocket
#LIBS += -liconv
#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
@ -40,11 +37,6 @@ CCFLAGS_debug += -O0 -fno-builtin
CXXFLAGS += -fno-exceptions -fno-rtti
#Generic compiler flags (which include build type flags)
ARCHFLAGS = -march=mips1 -mabi=32 -EL -fno-pic -mno-shared -mno-abicalls -mfp32
ARCHFLAGS += -fno-stack-protector -nostdlib -ffreestanding
USE_FUNCTION_SECTIONS ?= true
ifeq ($(USE_FUNCTION_SECTIONS),true)
CCFLAGS_all += -ffunction-sections
@ -55,42 +47,10 @@ CCFLAGS_all += $(ARCHFLAGS)
CCFLAGS_all += $(CCFLAGS_$(BUILD_PROFILE))
################################################################
PSYQ_PATH ?= ../../../PSYQ/Converted
CCFLAGS_all += -I$(PSYQ_PATH)/Include
LIBS += -L$(PSYQ_PATH)/Lib
LIBS += -Wl,--start-group
LIBS += -lapi
LIBS += -lc
LIBS += -lc2
LIBS += -lcard
LIBS += -lcomb
LIBS += -lds
LIBS += -letc
LIBS += -lgpu
LIBS += -lgs
LIBS += -lgte
LIBS += -lgun
LIBS += -lhmd
LIBS += -lmath
LIBS += -lmcrd
LIBS += -lmcx
LIBS += -lpad
LIBS += -lpress
LIBS += -lsio
LIBS += -lsnd
LIBS += -lspu
LIBS += -ltap
LIBS += -lcd
LIBS += -Wl,--end-group
################################################################
#Linker flags
LDFLAGS_release += -Os
LDFLAGS_all += -Wl,-Map=$(BINDIR)$(TARGET).map -nostdlib -T$(LDSCRIPT) -static -Wl,--gc-sections
LDFLAGS_all += -Wl,-Map=$(TARGET).map -nostdlib -T$(LDSCRIPT) -static -Wl,--gc-sections
LDFLAGS_all += $(ARCHFLAGS) -Wl,--oformat=$(FORMAT)
LDFLAGS_all += $(LDFLAGS_$(BUILD_PROFILE))
@ -101,10 +61,6 @@ 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))
#Source list
SRCS += $(ROOTDIR)/common/crt0/crt0.s
SRCS += $(call rwildcard, src, c cpp)
#Object files list
OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(subst ..,super,$(basename $(SRCS)))))
@ -120,7 +76,7 @@ $(OUTPUT_DIR)/%.o: %.cpp
.SECONDEXPANSION:
$(OUTPUT_DIR)/%.o: $$(subst super,..,%.s)
@mkdir -p $(dir $@)
$(CC) $(ARCHFLAGS) -I$(ROOTDIR) -g -c -o $@ $<
$(CC) $(ARCHFLAGS) -I$(PCSX_REDUX) -g -c -o $@ $<
$(info at is $@)
$(info dollar is $<)