mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-12-03 18:30:57 +00:00
Fix VERSION Warning When Generating Context (#1887)
Some checks are pending
Format code / format (push) Waiting to run
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
Some checks are pending
Format code / format (push) Waiting to run
Build Saturn version / build-and-test-saturn (push) Waiting to run
Build Saturn version / function-finder-saturn (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, hd) (push) Waiting to run
Build PSX and PSP version / build-and-test (pspeu, pspeu) (push) Waiting to run
Build PSX and PSP version / build-and-test (us, us) (push) Waiting to run
Build PSX and PSP version / generate-progress-report (pspeu, hd) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (pspeu, pspeu) (push) Blocked by required conditions
Build PSX and PSP version / generate-progress-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report (us, us) (push) Blocked by required conditions
Build PSX and PSP version / generate-duplicates-report-psp (pspeu, pspeu) (push) Blocked by required conditions
This updates `m2ctx` to be aware of the `VERSION` env var and sets that env var in the Makefile prior to running `m2ctx` to eliminate the: warning: #warning "Version not specified. Falling back to the US version." [-Wcpp] error caused by `common.h`. This also removes `#define __STDC_HOSTED__ 0` from the generated context. That macro causes redefinition warnings in decomp.me.
This commit is contained in:
parent
9eb2d507b9
commit
966cfae72a
2
Makefile
2
Makefile
@ -491,7 +491,7 @@ force_symbols: ##@ Extract a full list of symbols from a successful build
|
|||||||
$(PYTHON) ./tools/symbols.py elf build/us/tt_002.elf > config/symbols.us.tt_002.txt
|
$(PYTHON) ./tools/symbols.py elf build/us/tt_002.elf > config/symbols.us.tt_002.txt
|
||||||
|
|
||||||
context: ##@ create a context for decomp.me. Set the SOURCE variable prior to calling this target
|
context: ##@ create a context for decomp.me. Set the SOURCE variable prior to calling this target
|
||||||
$(M2CTX) $(SOURCE)
|
VERSION=$(VERSION) $(M2CTX) $(SOURCE)
|
||||||
@echo ctx.c has been updated.
|
@echo ctx.c has been updated.
|
||||||
|
|
||||||
extract_disk: ##@ Extract game files from a disc image.
|
extract_disk: ##@ Extract game files from a disc image.
|
||||||
|
@ -25,16 +25,21 @@ CPP_FLAGS = [
|
|||||||
"-DM2CTX",
|
"-DM2CTX",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
VERSION_DEF = []
|
||||||
|
|
||||||
|
|
||||||
def import_c_file(in_file) -> str:
|
def import_c_file(in_file) -> str:
|
||||||
in_file = os.path.relpath(in_file, root_dir)
|
in_file = os.path.relpath(in_file, root_dir)
|
||||||
cpp_command = ["gcc", "-E", "-P", "-dM", *CPP_FLAGS, in_file]
|
cpp_command = ["gcc", "-E", "-P", "-dM", *CPP_FLAGS, in_file]
|
||||||
cpp_command2 = ["gcc", "-E", "-P", *CPP_FLAGS, in_file]
|
cpp_command2 = ["gcc", "-E", "-P", *CPP_FLAGS, *VERSION_DEF, in_file]
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile(suffix=".c") as tmp:
|
with tempfile.NamedTemporaryFile(suffix=".c") as tmp:
|
||||||
stock_macros = subprocess.check_output(
|
stock_macros = subprocess.check_output(
|
||||||
["gcc", "-E", "-P", "-dM", tmp.name], cwd=root_dir, encoding="utf-8"
|
["gcc", "-E", "-P", "-dM", *VERSION_DEF, tmp.name],
|
||||||
|
cwd=root_dir,
|
||||||
|
encoding="utf-8",
|
||||||
)
|
)
|
||||||
|
stock_macros += "#define __STDC_HOSTED__ 0\n"
|
||||||
|
|
||||||
out_text = ""
|
out_text = ""
|
||||||
try:
|
try:
|
||||||
@ -69,6 +74,9 @@ def main():
|
|||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if "VERSION" in os.environ:
|
||||||
|
VERSION_DEF.append("-D_internal_version_" + os.environ["VERSION"])
|
||||||
|
|
||||||
output = import_c_file(args.c_file)
|
output = import_c_file(args.c_file)
|
||||||
|
|
||||||
with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f:
|
with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f:
|
||||||
|
Loading…
Reference in New Issue
Block a user