From 40b2d9fb269ad3bbf2e13d12f0d436add06982f2 Mon Sep 17 00:00:00 2001 From: Jaby Date: Sun, 24 Apr 2022 21:24:35 +0200 Subject: [PATCH] Support Nugget and Jaby for make --- Code/Makefile | 4 +++ Code/Wrapper.mk | 19 +++++++++++ JabyEngine.code-workspace | 12 +++---- Makefile | 66 +++++++-------------------------------- 4 files changed, 38 insertions(+), 63 deletions(-) create mode 100644 Code/Wrapper.mk diff --git a/Code/Makefile b/Code/Makefile index 36a66c4f..975f8a52 100644 --- a/Code/Makefile +++ b/Code/Makefile @@ -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 diff --git a/Code/Wrapper.mk b/Code/Wrapper.mk new file mode 100644 index 00000000..33662b6f --- /dev/null +++ b/Code/Wrapper.mk @@ -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 \ No newline at end of file diff --git a/JabyEngine.code-workspace b/JabyEngine.code-workspace index 8f8dc282..238b1ca9 100644 --- a/JabyEngine.code-workspace +++ b/JabyEngine.code-workspace @@ -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 - } + ] } } diff --git a/Makefile b/Makefile index c7af070c..e479d2f6 100644 --- a/Makefile +++ b/Makefile @@ -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 $<)