Update Makefile & transform-dep.py

This commit is contained in:
Luke Street 2022-09-11 21:07:45 -04:00
parent 228319e2a5
commit 38acae22fe
2 changed files with 15 additions and 3 deletions

View File

@ -76,6 +76,7 @@ ifeq ($(WINDOWS),1)
AS := $(DEVKITPPC)/bin/powerpc-eabi-as.exe
CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp.exe -P
PYTHON := py
SHA1SUM := sha1sum
else
WIBO := $(shell command -v wibo 2> /dev/null)
ifdef WIBO
@ -88,11 +89,11 @@ else
AS := $(DEVKITPPC)/bin/powerpc-eabi-as
CPP := $(DEVKITPPC)/bin/powerpc-eabi-cpp -P
PYTHON := python3
SHA1SUM := shasum -a 1
endif
CC = $(WINE) tools/mwcc_compiler/$(MWCC_VERSION)/mwcceppc.exe
LD := $(WINE) tools/mwcc_compiler/$(MWLD_VERSION)/mwldeppc.exe
ELF2DOL := tools/elf2dol
SHA1SUM := shasum -a 1
TRANSFORM_DEP := tools/transform-dep.py
FRANK := tools/franklite.py

View File

@ -1,12 +1,16 @@
#!/usr/bin/env python3
import argparse
import os
from platform import uname
wineprefix = os.path.join(os.environ['HOME'], '.wine')
if 'WINEPREFIX' in os.environ:
wineprefix = os.environ['WINEPREFIX']
winedevices = os.path.join(wineprefix, 'dosdevices')
def in_wsl() -> bool:
return 'microsoft-standard' in uname().release
def import_d_file(in_file) -> str:
out_text = ''
@ -26,8 +30,15 @@ def import_d_file(in_file) -> str:
path = line.strip()
# lowercase drive letter
path = path[0].lower() + path[1:]
# use $WINEPREFIX/dosdevices to resolve path
path = os.path.realpath(os.path.join(winedevices, path.replace('\\', '/')))
if path[0] == 'z':
# shortcut for z:
path = path[2:].replace('\\', '/')
elif in_wsl():
path = path[0:1] + path[2:]
path = os.path.join('/mnt', path.replace('\\', '/'))
else:
# use $WINEPREFIX/dosdevices to resolve path
path = os.path.realpath(os.path.join(winedevices, path.replace('\\', '/')))
out_text += "\t" + path + suffix + "\n"
return out_text