Skip to content

Commit

Permalink
Merge pull request #666 from uyjulian/buildsystem_multijob_workaround…
Browse files Browse the repository at this point in the history
…_20241006

Buildsystem multijob workaround 20241006
  • Loading branch information
fjtrujy authored Nov 6, 2024
2 parents 9447536 + a594698 commit 7ccee55
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 9 deletions.
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 $< $@

0 comments on commit 7ccee55

Please sign in to comment.