Update DTK; add debug configure flag

This commit is contained in:
Luke Street 2022-12-14 11:50:58 -05:00
parent 4aa8843cf5
commit 946c0da941
2 changed files with 55 additions and 41 deletions

View File

@ -1085,6 +1085,12 @@ if __name__ == "__main__":
dest="build_dtk", dest="build_dtk",
help="path to decomp-toolkit source", help="path to decomp-toolkit source",
) )
parser.add_argument(
"--debug",
dest="debug",
action="store_true",
help="build with debug info (non-matching)",
)
args = parser.parse_args() args = parser.parse_args()
# On Windows, we need this to use && in commands # On Windows, we need this to use && in commands
@ -1124,10 +1130,10 @@ if __name__ == "__main__":
n.variable("devkitppc", os.environ["DEVKITPPC"]) n.variable("devkitppc", os.environ["DEVKITPPC"])
else: else:
n.variable("devkitppc", "/opt/devkitpro/devkitPPC") n.variable("devkitppc", "/opt/devkitpro/devkitPPC")
n.variable( cflags_base = "-proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp hard -fp_contract on -O4,p -maxerrors 1 -enum int -inline auto -str reuse -nosyspath -MMD -DPRIME1 -DVERSION=$version_num -DNONMATCHING=0 -i include/ -i libc/"
"cflags_base", if args.debug:
"-proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp hard -fp_contract on -O4,p -maxerrors 1 -enum int -inline auto -str reuse -nosyspath -MMD -DPRIME1 -DVERSION=$version_num -DNONMATCHING=0 -i include/ -i libc/", cflags_base += " -sym on"
) n.variable("cflags_base", cflags_base)
n.variable( n.variable(
"cflags_retro", "cflags_retro",
"$cflags_base -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,noauto -common on", "$cflags_base -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,noauto -common on",
@ -1137,8 +1143,9 @@ if __name__ == "__main__":
"$cflags_base -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,auto", "$cflags_base -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,auto",
) )
n.variable("cflags_musyx", "$cflags_base -str reuse,pool,readonly") n.variable("cflags_musyx", "$cflags_base -str reuse,pool,readonly")
n.variable("asflags", "-mgekko -I include/ --defsym version=$version_num -W") asflags = "-mgekko -I include/ --defsym version=$version_num -W --strip-local-absolute -gdwarf-2"
ldflags = "-fp fmadd -nodefaults -lcf ldscript.lcf -w off" n.variable("asflags", asflags)
ldflags = "-fp fmadd -nodefaults -lcf ldscript.lcf"
if args.map: if args.map:
ldflags += " -map $builddir/MetroidPrime.MAP" ldflags += " -map $builddir/MetroidPrime.MAP"
n.variable("ldflags", ldflags) n.variable("ldflags", ldflags)
@ -1242,7 +1249,8 @@ if __name__ == "__main__":
n.comment("Assemble asm") n.comment("Assemble asm")
n.rule( n.rule(
name="as", name="as",
command="$devkitppc/bin/powerpc-eabi-as $asflags -o $out $in -MD $out.d", command="$devkitppc/bin/powerpc-eabi-as $asflags -o $out $in -MD $out.d"
+ " && $dtk elf fixup $out $out",
description="AS $out", description="AS $out",
depfile="$out.d", depfile="$out.d",
deps="gcc", deps="gcc",
@ -1273,6 +1281,42 @@ if __name__ == "__main__":
) )
n.newline() n.newline()
###
# Tooling
###
n.comment("decomp-toolkit")
if args.build_dtk:
n.variable("dtk", os.path.join("build", "tools", "release", "dtk$exe"))
n.rule(
name="cargo",
command="cargo build --release --manifest-path $in --bin $bin --target-dir $target",
description="CARGO $bin",
depfile="$target/release/$bin.d",
deps="gcc",
)
n.build(
outputs="$dtk",
rule="cargo",
inputs=os.path.join(args.build_dtk, "Cargo.toml"),
variables={
"bin": "dtk",
"target": os.path.join("build", "tools"),
},
)
else:
n.variable("dtk", os.path.join("build", "tools", "dtk$exe"))
n.rule(
name="download_dtk",
command="$python tools/download_dtk.py $in $out",
description="DOWNLOAD $out",
)
n.build(
outputs="$dtk",
rule="download_dtk",
inputs="dtk_version",
implicit=["tools/download_dtk.py"],
)
### ###
# Rules for source files # Rules for source files
### ###
@ -1338,6 +1382,7 @@ if __name__ == "__main__":
outputs=f"$builddir/asm/{object}.o", outputs=f"$builddir/asm/{object}.o",
rule="as", rule="as",
inputs=f"asm/{object}.s", inputs=f"asm/{object}.s",
implicit="$dtk",
) )
if completed: if completed:
inputs.append(f"$builddir/src/{object}.o") inputs.append(f"$builddir/src/{object}.o")
@ -1411,40 +1456,9 @@ if __name__ == "__main__":
n.newline() n.newline()
### ###
# Tooling # Generate DOL
### ###
n.comment("decomp-toolkit") n.comment("Generate DOL")
if args.build_dtk:
n.variable("dtk", os.path.join("build", "tools", "release", "dtk$exe"))
n.rule(
name="cargo",
command="cargo build --release --manifest-path $in --bin $bin --target-dir $target",
description="CARGO $bin",
depfile="$target/release/$bin.d",
deps="gcc",
)
n.build(
outputs="$dtk",
rule="cargo",
inputs=os.path.join(args.build_dtk, "Cargo.toml"),
variables={
"bin": "dtk",
"target": os.path.join("build", "tools"),
},
)
else:
n.variable("dtk", os.path.join("build", "tools", "dtk$exe"))
n.rule(
name="download_dtk",
command="$python tools/download_dtk.py $in $out",
description="DOWNLOAD $out",
)
n.build(
outputs="$dtk",
rule="download_dtk",
inputs="dtk_version",
implicit=["tools/download_dtk.py"],
)
n.rule( n.rule(
name="elf2dol", name="elf2dol",
command=ALLOW_CHAIN command=ALLOW_CHAIN

View File

@ -1 +1 @@
v0.1.1 v0.2.0