mirror of
https://github.com/SeekyCt/spm-decomp.git
synced 2024-11-26 23:00:34 +00:00
Fix makectx and diff
This commit is contained in:
parent
6c81bd9c8d
commit
db1be3ec85
38
common.py
38
common.py
@ -153,9 +153,6 @@ DOL_SRCDIR = "src"
|
||||
# Directory for decompiled rel code
|
||||
REL_SRCDIR = "rel"
|
||||
|
||||
# Include directory
|
||||
INCDIR = "include"
|
||||
|
||||
# Build artifacts directory
|
||||
BUILDDIR = "build"
|
||||
|
||||
@ -279,20 +276,30 @@ REL_FULL = f"{OUTDIR}/rel.s"
|
||||
|
||||
ASFLAGS = ' '.join([
|
||||
"-m gekko",
|
||||
f"-I {INCDIR}",
|
||||
f"-I {PPCDIS_INCDIR}",
|
||||
f"-I orig"
|
||||
])
|
||||
|
||||
INCDIRS = [
|
||||
PPCDIS_INCDIR,
|
||||
BUILD_INCDIR,
|
||||
f"{SPM_HEADERS}/decomp",
|
||||
f"{SPM_HEADERS}/include"
|
||||
]
|
||||
MWCC_INCLUDES = ' '.join(f"-i {d}" for d in INCDIRS)
|
||||
GCC_INCLUDES = ' '.join(f"-I {d}" for d in INCDIRS)
|
||||
|
||||
DEFINES = [
|
||||
"DECOMP",
|
||||
"SPM_EU0"
|
||||
]
|
||||
MWCC_DEFINES = ' '.join(f"-d {d}" for d in DEFINES)
|
||||
GCC_DEFINES = ' '.join(f"-D {d}" for d in DEFINES)
|
||||
|
||||
CPPFLAGS = ' '.join([
|
||||
"-nostdinc",
|
||||
"-DDECOMP",
|
||||
"-DSPM_EU0",
|
||||
f"-I {INCDIR}",
|
||||
f"-I {PPCDIS_INCDIR}",
|
||||
f"-I {BUILD_INCDIR}",
|
||||
f"-I {SPM_HEADERS}/decomp",
|
||||
f"-I {SPM_HEADERS}/include"
|
||||
GCC_DEFINES,
|
||||
GCC_INCLUDES
|
||||
])
|
||||
|
||||
DOL_SDATA2_SIZE = 4
|
||||
@ -310,8 +317,7 @@ CFLAGS = [
|
||||
"-rostr",
|
||||
"-sym dwarf-2",
|
||||
"-ipa file",
|
||||
"-d DECOMP",
|
||||
"-d SPM_EU0",
|
||||
MWCC_DEFINES
|
||||
]
|
||||
BASE_DOL_CFLAGS = CFLAGS + [
|
||||
"-inline all",
|
||||
@ -330,11 +336,7 @@ LOCAL_CFLAGS = [
|
||||
"-proc gekko",
|
||||
"-maxerrors 1",
|
||||
"-I-",
|
||||
f"-i {INCDIR}",
|
||||
f"-i {PPCDIS_INCDIR}",
|
||||
f"-i {BUILD_INCDIR}",
|
||||
f"-i {SPM_HEADERS}/decomp",
|
||||
f"-i {SPM_HEADERS}/include",
|
||||
MWCC_INCLUDES
|
||||
]
|
||||
DOL_CFLAGS = ' '.join(BASE_DOL_CFLAGS + LOCAL_CFLAGS)
|
||||
REL_CFLAGS = ' '.join(BASE_REL_CFLAGS + LOCAL_CFLAGS)
|
||||
|
@ -6,12 +6,12 @@ def apply(config, args: Namespace):
|
||||
config["mapfile"] = c.REL_MAP
|
||||
config["myimg"] = c.REL_PLF
|
||||
config["baseimg"] = c.REL_EXPECTED
|
||||
config["source_directories"] = [c.REL_SRCDIR, c.INCDIR]
|
||||
config["source_directories"] = [c.REL_SRCDIR, *c.INCDIRS]
|
||||
else:
|
||||
config["mapfile"] = c.DOL_MAP
|
||||
config["myimg"] = c.DOL_ELF
|
||||
config["baseimg"] = c.DOL_EXPECTED
|
||||
config["source_directories"] = [c.DOL_SRCDIR, c.INCDIR]
|
||||
config["source_directories"] = [c.DOL_SRCDIR, *c.INCDIRS]
|
||||
config["make_command"] = ["ninja"]
|
||||
config["makeflags"] = []
|
||||
config["arch"] = "ppc"
|
||||
|
@ -45,4 +45,4 @@ def makectx(bases: List[str]):
|
||||
ret += process_header(header, bases)
|
||||
return ret
|
||||
|
||||
print(makectx([c.INCDIR, c.PPCDIS_INCDIR]))
|
||||
print(makectx(c.INCDIRS))
|
||||
|
@ -20,7 +20,7 @@ def make_includes(dirnames: List[str]) -> str:
|
||||
)
|
||||
|
||||
# Find all headers
|
||||
includes = make_includes([c.INCDIR, c.PPCDIS_INCDIR])
|
||||
includes = make_includes(c.INCDIRS)
|
||||
|
||||
# Run mwcc preprocessor
|
||||
with NamedTemporaryFile(suffix=".c", delete=False) as tmp:
|
||||
@ -28,7 +28,7 @@ with NamedTemporaryFile(suffix=".c", delete=False) as tmp:
|
||||
tmp.write(includes.encode())
|
||||
tmp.close()
|
||||
out = c.get_cmd_stdout(
|
||||
f"{c.CC} -I- -i {c.INCDIR} -i {c.PPCDIS}/include -DM2C -stderr -E {tmp.name}"
|
||||
f"{c.CC} -I- {c.MWCC_INCLUDES} {c.MWCC_DEFINES} -d M2C -stderr -E {tmp.name}"
|
||||
)
|
||||
finally:
|
||||
unlink(tmp.name)
|
||||
|
Loading…
Reference in New Issue
Block a user