1
0

bytebeat_compiler.py: add CFLAGS_EXTRA

This commit is contained in:
Intel A80486DX2-66 2024-01-09 23:09:02 +03:00
parent 0654aec5d1
commit 89bc7466ff
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -42,7 +42,7 @@ DEFAULT_PARAMETERS = {
def fetch(name: str):
if from_env := environ.get(name):
return from_env
else:
elif name != "CFLAGS_EXTRA":
return DEFAULT_PARAMETERS[name]
def read_file(path: str) -> str:
@ -82,13 +82,15 @@ CC = fetch("CC")
CFLAGS = fetch("CFLAGS")
INPUT_FILE = fetch("INPUT_FILE")
OUTPUT_FILE = fetch("OUTPUT_FILE")
if extra := fetch("CFLAGS_EXTRA"):
CFLAGS += " " + extra
if __name__ == "__main__":
parser = ArgumentParser(description=\
"Substitutes supplied C (non-JavaScript!) bytebeat into the template, "
"then attempts to compile the instance of the template. Accepts "
"environmental variables `CC`, `CFLAGS`, `INPUT_FILE`, "
"`OUTPUT_FILE`.")
"environmental variables `CC`, `CFLAGS`, `INPUT_FILE`, `OUTPUT_FILE`. "
"`CFLAGS_EXTRA` can be used to add to default `CFLAGS`.")
parser.add_argument("file", type=str,
help="bytebeat formula file (use `-` to read from stdin)")
parser.add_argument("-o", "--output", default="output.wav", type=str,