Add support for simultaneous build jobs (make -j)

This commit is contained in:
Ryan Dwyer 2020-12-12 21:54:19 +10:00
parent 91478a59b5
commit 084a57082d
5 changed files with 26 additions and 21 deletions

View File

@ -196,7 +196,7 @@ SEGMENT_FILES := \
$(B_DIR)/segments/mpstringsI.bin \
$(B_DIR)/segments/textureconfig.bin
test: $(SEGMENT_FILES) $(ASSET_FILES)
test: rom $(SEGMENT_FILES) $(ASSET_FILES)
@md5sum --quiet -c checksums.$(ROMID).md5
$(B_DIR)/segments/%.bin: $(B_DIR)/stage2.bin
@ -259,9 +259,7 @@ src/files/bgdata/bg_%_tiles.o: src/files/bgdata/bg_%_tiles.s
$(B_DIR)/files/bgdata/bg_%_tiles.elf: src/files/bgdata/bg_%_tiles.o
@mkdir -p $(B_DIR)/files/bgdata
cp $< build/zero.tmp.o
$(TOOLCHAIN)-ld -T ld/zero.ld -o $@
rm -f build/zero.tmp.o
TOOLCHAIN=$(TOOLCHAIN) tools/mksimpleelf $< $@
# Chrs
$(B_DIR)/files/C%Z: $(E_DIR)/files/C%Z
@ -279,9 +277,7 @@ $(B_DIR)/files/lang/L%.o: src/files/lang/$(ROMID)/%.c
$(QEMU_IRIX) -silent -L $(IRIX_ROOT) $(IRIX_ROOT)/usr/bin/cc -c $(CFLAGS) $< -o $@ -O2
$(B_DIR)/files/L%.elf: $(B_DIR)/files/lang/L%.o
cp $< build/zero.tmp.o
$(TOOLCHAIN)-ld -T ld/zero.ld -o $@
rm -f build/zero.tmp.o
TOOLCHAIN=$(TOOLCHAIN) tools/mksimpleelf $< $@
$(B_DIR)/files/L%E: $(B_DIR)/files/L%E.bin
tools/rarezip $< > $@
@ -305,9 +301,7 @@ $(B_DIR)/files/P%Z: $(E_DIR)/files/P%Z
# Stage setups
$(B_DIR)/files/U%.elf: $(B_DIR)/files/setup/%.o
@mkdir -p $(B_DIR)/files
cp $< build/zero.tmp.o
$(TOOLCHAIN)-ld -T ld/zero.ld -o $@
rm -f build/zero.tmp.o
TOOLCHAIN=$(TOOLCHAIN) tools/mksimpleelf $< $@
# General target to convert any finalised file into a raw object for ld
$(B_DIR)/files/%.o: $(B_DIR)/files/%

View File

@ -8,9 +8,14 @@ See the [Perfect Dark Decompilation Status Page](https://ryandwyer.gitlab.io/pds
## Installation Requirements
* make
* mips build tools (Debian/Ubuntu: binutils-mips-linux-gnu, Arch: mips64-elf-binutils from AUR)
* Python 3
For Arch Linux:
* Install these packages: `binutils fakeroot gcc make python vim`
* Install from AUR: `mips64-elf-binutils`
For Debian and Ubuntu:
* Install these packages: `binutils-mips-linux-gnu make`
## ROM Versions
@ -38,10 +43,10 @@ Before you do anything you need an existing ROM to extract assets from.
## Compiling
* Run `make rom` to build the ROM. The ROM will be written to `build/ntsc-final/pd.z64`.
* Run `make -j` to build the ROM. The ROM will be written to `build/ntsc-final/pd.z64`.
## How do I know the built files are matching?
Run `make` followed by `make test`. If `make test` produces no output then all compiled segments are matching.
Run `make` followed by `make test`. If `make test` produces no output then the compiled project is matching.
You can also md5sum your base ROM with the built ROM and check they have the same hash: `md5sum pd.ntsc-final.z64 build/ntsc-final/pd.z64`.

View File

@ -4,11 +4,11 @@ OUTPUT_ARCH (mips)
SECTIONS
{
.data 0x00000000 : AT(0x0000) {
build/zero.tmp.o (.data);
__FILE__ (.data);
}
.rodata : AT(SIZEOF(.data)) {
build/zero.tmp.o (.rodata);
__FILE__ (.rodata);
}
/DISCARD/ : {

View File

@ -2,9 +2,8 @@
set -e
echo -e "\n.data\n.incbin \"$1\"\n.balign 0x10" > build/$ROMID/file.s
echo -e "\n.data\n.incbin \"$1\"\n.balign 0x10" > build/$ROMID/file-$$.s
$TOOLCHAIN-as -mabi=32 -mips2 -I src/include -EB -o "$2" build/$ROMID/file.s
rm -f build/$ROMID/file.s
$TOOLCHAIN-as -mabi=32 -mips2 -I src/include -EB -o "$2" build/$ROMID/file-$$.s
rm -f build/$ROMID/file-$$.s

7
tools/mksimpleelf Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
sed "s|__FILE__|$1|g" ld/zero.ld >> build/zero-$$.ld
$TOOLCHAIN-ld -T build/zero-$$.ld -o "$2"
rm -f build/zero-$$.ld