Cherry pick files from the module branch

This commit is contained in:
jaby 2023-10-06 14:23:15 +02:00
parent 6994d8d05a
commit 4bab1e30fc
4 changed files with 21 additions and 9 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
# For now we ignore what is in root
**/build
**/bin
**/gcm.cache
**/iso/Info
/iso

View File

@ -1,6 +1,9 @@
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)ExportPath.mk
substitute = $(subst $(JABY_ENGINE_DIR)/include/modules,!JABYENGINEMODULES,$(subst ..,!super,$1))
desubstitute = $(subst !JABYENGINEMODULES,$(JABY_ENGINE_DIR)/include/modules,$(subst !super,..,$1))
#Build architecture/variant string, possible values: x86, armv7le, etc...
PLATFORM ?= PSX
@ -48,7 +51,7 @@ CXXFLAGS += -fno-exceptions -fno-rtti
CCFLAGS += -mno-gpopt -fomit-frame-pointer -ffunction-sections -fdata-sections
CCFLAGS += -fno-builtin -fno-strict-aliasing -Wno-attributes
CCFLAGS += -std=c++20
CCFLAGS += -std=c++20 -fmodules-ts
CCFLAGS += $(CCFLAGS_$(BUILD_PROFILE))
CCFLAGS += $(ARCHFLAGS)
CCFLAGS += $(INCLUDES)
@ -66,25 +69,30 @@ LIBS_all += $(LIBS_$(BUILD_PROFILE))
DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@
#Object files list
OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(subst ..,!super,$(basename $(SRCS)))))
MODS += $(call rwildcard,$(JABY_ENGINE_DIR)/include/modules, cxx)
SRCS := $(MODS) $(SRCS)
OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(call substitute,$(basename $(SRCS)))))
#Compiling rule
$(OUTPUT_DIR)/%.o: %.s
.SECONDEXPANSION:
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.s)
@mkdir -p $(dir $@)
$(CC) -c $(DEPS) -o $@ $(CCFLAGS) $<
$(OUTPUT_DIR)/%.o: %.c
.SECONDEXPANSION:
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.c)
@mkdir -p $(dir $@)
$(CC) -c $(DEPS) -o $@ $(CCFLAGS) $<
$(OUTPUT_DIR)/%.o: %.cpp
.SECONDEXPANSION:
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.cpp)
@mkdir -p $(dir $@)
$(CXX) -c $(DEPS) -o $@ $(CCFLAGS) $(CXXFLAGS) $<
.SECONDEXPANSION:
$(OUTPUT_DIR)/%.o: $$(subst !super,..,%.s)
$(OUTPUT_DIR)/%.o: $$(call desubstitute,%.cxx)
@mkdir -p $(dir $@)
$(CC) $(ARCHFLAGS) -I$(PCSX_REDUX) -g -c -o $@ $<
$(CXX) -c $(DEPS) -o $@ $(CCFLAGS) $(CXXFLAGS) $<
#Inclusion of dependencies (object files to source and includes)
-include $(OBJS:%.o=%.d)

View File

@ -1 +1,3 @@
rebuild: | clean all
rebuild:
$(MAKE) clean
$(MAKE) all

View File

@ -46,4 +46,5 @@ clean:
rm -fr $(SPLASH_IMAGE)
rm -fr $(SPLASH_IMAGE_NTSC)
rm -fr $(OUTPUT_DIR)
rm -fr gcm.cache
rm -fr $(LIB_DIR)/$(ARTIFACT).a