Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buildsystem multijob workaround 20241006 #666

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion ee/kernel/src/eenull/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $< $@
8 changes: 7 additions & 1 deletion ee/kernel/src/osdsrc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $< $@
8 changes: 7 additions & 1 deletion ee/kernel/src/srcfile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $< $@
8 changes: 7 additions & 1 deletion ee/kernel/src/tlbsrc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $< $@
20 changes: 16 additions & 4 deletions tools/Rules.make
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@
Expand All @@ -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 $< $@