From cf44dbba88b404228f880fbd2811a172a7caa495 Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Sun, 6 Oct 2024 10:09:21 -0500 Subject: [PATCH 1/3] workaround: Rename tool output temporarily on build --- tools/Rules.make | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tools/Rules.make b/tools/Rules.make index 06275a68ee4..9bfdca61f77 100644 --- a/tools/Rules.make +++ b/tools/Rules.make @@ -44,6 +44,8 @@ TOOLS_CXX_COMPILE = $(TOOLS_CC) $(TOOLS_CXXFLAGS) $(TOOLS_INCS) # Command for ensuring the output directory for the rule exists. DIR_GUARD = @$(MKDIR) -p $(@D) +MAKE_CURPID := $(shell printf '%s' $$PPID) + $(TOOLS_OBJS_DIR)%.o : $(TOOLS_SRC_DIR)%.c $(DIR_GUARD) $(CC) $(TOOLS_CFLAGS) $(TOOLS_INCS) -c $< -o $@ @@ -60,10 +62,20 @@ $(TOOLS_OBJS_DIR)%.o : $(TOOLS_SRC_DIR)%.s $(DIR_GUARD) $(AS) $(TOOLS_ASFLAGS) $< -o $@ -$(TOOLS_BIN) : $(TOOLS_OBJS) $(TOOLS_LIB_ARCHIVES) $(TOOLS_ADDITIONAL_DEPS) +.INTERMEDIATE:: $(TOOLS_BIN)_tmp$(MAKE_CURPID) $(TOOLS_LIB)_tmp$(MAKE_CURPID) + +$(TOOLS_BIN)_tmp$(MAKE_CURPID) : $(TOOLS_OBJS) $(TOOLS_LIB_ARCHIVES) $(TOOLS_ADDITIONAL_DEPS) + $(DIR_GUARD) + $(CC) $(TOOLS_LDFLAGS) -o $@ $(TOOLS_OBJS) $(TOOLS_LIB_ARCHIVES) $(TOOLS_LIBS) + +$(TOOLS_BIN): $(TOOLS_BIN)_tmp$(MAKE_CURPID) + $(DIR_GUARD) + mv $< $@ + +$(TOOLS_LIB)_tmp$(MAKE_CURPID) : $(TOOLS_OBJS) $(DIR_GUARD) - $(CC) $(TOOLS_LDFLAGS) -o $(TOOLS_BIN) $(TOOLS_OBJS) $(TOOLS_LIB_ARCHIVES) $(TOOLS_LIBS) + $(AR) cru $@ $< -$(TOOLS_LIB) : $(TOOLS_OBJS) +$(TOOLS_LIB): $(TOOLS_LIB)_tmp$(MAKE_CURPID) $(DIR_GUARD) - $(AR) cru $(TOOLS_LIB) $< + mv $< $@ From 81af31d2a4c293678bae6dc9d378d512484668da Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Sun, 6 Oct 2024 10:09:29 -0500 Subject: [PATCH 2/3] workaround: disable parallelism for root level directories --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5cd8725eb4f..a214103448e 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ $(subdir_release): dummy # Directory-level parallelism has been disabled due to issues with # multiple Make instances running inside a directory at once # and causing output file corruption -.NOTPARALLEL: $(subdir_list) $(subdir_clean) $(subdir_release) +.NOTPARALLEL: build $(subdir_list) $(subdir_clean) $(subdir_release) build: $(subdir_list) | env_build_check download_dependencies From a594698d937271c647fb4beb322aefe50b8cb1cf Mon Sep 17 00:00:00 2001 From: Julian Uy Date: Sun, 6 Oct 2024 10:10:09 -0500 Subject: [PATCH 3/3] workaround: Rename EE patch output temporarily on build --- ee/kernel/src/eenull/Makefile | 8 +++++++- ee/kernel/src/osdsrc/Makefile | 8 +++++++- ee/kernel/src/srcfile/Makefile | 8 +++++++- ee/kernel/src/tlbsrc/Makefile | 8 +++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ee/kernel/src/eenull/Makefile b/ee/kernel/src/eenull/Makefile index fd0f2e2ab97..d24617bd0a8 100644 --- a/ee/kernel/src/eenull/Makefile +++ b/ee/kernel/src/eenull/Makefile @@ -26,6 +26,12 @@ clean: include $(PS2SDKSRC)/Defs.make include $(PS2SDKSRC)/ee/Rules.make -$(EE_EENULL_ELF): $(EE_OBJS) +.INTERMEDIATE:: $(EE_EENULL_ELF)_tmp$(MAKE_CURPID) + +$(EE_EENULL_ELF)_tmp$(MAKE_CURPID): $(EE_OBJS) $(DIR_GUARD) $(EE_CC) $(EE_CFLAGS) -o $@ $^ -nostdlib -nostartfiles -Tlinkfile -s $(EE_LIBS) + +$(EE_EENULL_ELF): $(EE_EENULL_ELF)_tmp$(MAKE_CURPID) + $(DIR_GUARD) + mv $< $@ diff --git a/ee/kernel/src/osdsrc/Makefile b/ee/kernel/src/osdsrc/Makefile index 1c63411cfdc..b0e52815a04 100644 --- a/ee/kernel/src/osdsrc/Makefile +++ b/ee/kernel/src/osdsrc/Makefile @@ -27,6 +27,12 @@ clean: include $(PS2SDKSRC)/Defs.make include $(PS2SDKSRC)/ee/Rules.make -$(EE_OSDSRC_ELF): $(EE_OBJS) +.INTERMEDIATE:: $(EE_OSDSRC_ELF)_tmp$(MAKE_CURPID) + +$(EE_OSDSRC_ELF)_tmp$(MAKE_CURPID): $(EE_OBJS) $(DIR_GUARD) $(EE_CC) $(EE_CFLAGS) -o $@ $^ -nostdlib -nostartfiles -Tlinkfile -s $(EE_LIBS) + +$(EE_OSDSRC_ELF): $(EE_OSDSRC_ELF)_tmp$(MAKE_CURPID) + $(DIR_GUARD) + mv $< $@ diff --git a/ee/kernel/src/srcfile/Makefile b/ee/kernel/src/srcfile/Makefile index 6cc1c0258af..c3510417a76 100644 --- a/ee/kernel/src/srcfile/Makefile +++ b/ee/kernel/src/srcfile/Makefile @@ -26,6 +26,12 @@ clean: include $(PS2SDKSRC)/Defs.make include $(PS2SDKSRC)/ee/Rules.make -$(EE_SRCFILE_ELF): $(EE_OBJS) +.INTERMEDIATE:: $(EE_SRCFILE_ELF)_tmp$(MAKE_CURPID) + +$(EE_SRCFILE_ELF)_tmp$(MAKE_CURPID): $(EE_OBJS) $(DIR_GUARD) $(EE_CC) $(EE_CFLAGS) -o $@ $^ -nostdlib -nostartfiles -Tlinkfile -s $(EE_LIBS) + +$(EE_SRCFILE_ELF): $(EE_SRCFILE_ELF)_tmp$(MAKE_CURPID) + $(DIR_GUARD) + mv $< $@ diff --git a/ee/kernel/src/tlbsrc/Makefile b/ee/kernel/src/tlbsrc/Makefile index ff88895c82b..bc19eeb4cb9 100644 --- a/ee/kernel/src/tlbsrc/Makefile +++ b/ee/kernel/src/tlbsrc/Makefile @@ -27,6 +27,12 @@ clean: include $(PS2SDKSRC)/Defs.make include $(PS2SDKSRC)/ee/Rules.make -$(EE_TLBSRC_ELF): $(EE_OBJS) +.INTERMEDIATE:: $(EE_TLBSRC_ELF)_tmp$(MAKE_CURPID) + +$(EE_TLBSRC_ELF)_tmp$(MAKE_CURPID): $(EE_OBJS) $(DIR_GUARD) $(EE_CC) $(EE_CFLAGS) -o $@ $^ -nostdlib -nostartfiles -Tlinkfile -s $(EE_LIBS) + +$(EE_TLBSRC_ELF): $(EE_TLBSRC_ELF)_tmp$(MAKE_CURPID) + $(DIR_GUARD) + mv $< $@