Skip to content

Commit

Permalink
Fix Windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
cadmic committed Sep 5, 2024
1 parent 80110ba commit bdbd854
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 3 additions & 1 deletion tools/asm_processor/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ CC="$1"
shift
AS="$1"
shift
OBJCOPY="$1"
shift
IN="$1"
shift
OUT="$1"
Expand All @@ -29,6 +31,6 @@ $PYTHON tools/asm_processor/asm_processor.py "$IN" > "$TEMP/$STEM.c"
$CC "$TEMP/$STEM.c" -c -o "$TEMP"
$PYTHON tools/asm_processor/asm_processor.py "$IN" --post-process "$TEMP/$STEM.o" --assembler "$AS" --asm-prelude include/macros.inc
# Remove sections that don't work with our reloc hacks
${BINUTILS_PATH:-build/binutils}/powerpc-eabi-objcopy --remove-section .mwcats.text --remove-section .comment "$TEMP/$STEM.o" "$OUT"
$OBJCOPY --remove-section .mwcats.text --remove-section .comment "$TEMP/$STEM.o" "$OUT"
# Copy depfile, replacing the first line with the correct input/output files
( echo "$OUT: $IN \\"; tail -n +2 "$TEMP/$STEM.d" ) > "${OUT%.*}.d"
12 changes: 5 additions & 7 deletions tools/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ def write_cargo_rule():
gnu_as_implicit = [binutils_implicit or gnu_as, dtk]

# MWCC with asm_processor
mwcc_asm_processor_cmd = f'tools/asm_processor/compile.sh "{wrapper_cmd} {mwcc} $cflags -MMD" "{gnu_as} $asflags" $in $out'
objcopy = binutils / f"powerpc-eabi-objcopy{EXE}"
mwcc_asm_processor_cmd = f'tools/asm_processor/compile.sh "{wrapper_cmd} {mwcc} $cflags -MMD" "{gnu_as} $asflags" {objcopy} $in $out'
mwcc_asm_processor_implicit: List[Optional[Path]] = [
*mwcc_implicit,
binutils_implicit or gnu_as,
Expand All @@ -530,7 +531,7 @@ def write_cargo_rule():
]

# MWCC with asm_processor and UTF-8 to Shift JIS wrapper
mwcc_asm_processor_sjis_cmd = f'tools/asm_processor/compile.sh "{wrapper_cmd}{sjiswrap} {mwcc} $cflags -MMD" "{gnu_as} $asflags" $in $out'
mwcc_asm_processor_sjis_cmd = f'tools/asm_processor/compile.sh "{wrapper_cmd}{sjiswrap} {mwcc} $cflags -MMD" "{gnu_as} $asflags" {objcopy} $in $out'
mwcc_asm_processor_sjis_implicit: List[Optional[Path]] = [
*mwcc_asm_processor_implicit,
sjiswrap,
Expand All @@ -548,12 +549,9 @@ def write_cargo_rule():
mwcc_sjis_implicit.append(transform_dep)
mwcc_asm_processor_implicit.append(transform_dep)
mwcc_asm_processor_sjis_implicit.append(transform_dep)

mwcc_asm_processor_cmd = f'env "BINUTILS_PATH={binutils}" ' + mwcc_asm_processor_cmd
mwcc_asm_processor_sjis_cmd = f'env "BINUTILS_PATH={binutils}" ' + mwcc_asm_processor_sjis_cmd
else:
mwcc_asm_processor_cmd = f'set "BINUTILS_PATH={binutils}" && sh ' + mwcc_asm_processor_cmd
mwcc_asm_processor_sjis_cmd = f'set "BINUTILS_PATH={binutils}" && sh ' + mwcc_asm_processor_sjis_cmd
mwcc_asm_processor_cmd = "sh " + mwcc_asm_processor_cmd
mwcc_asm_processor_sjis_cmd = "sh " + mwcc_asm_processor_sjis_cmd

n.comment("Link ELF file")
n.rule(
Expand Down

0 comments on commit bdbd854

Please sign in to comment.