bytebeat_compiler.py: add CFLAGS_EXTRA
This commit is contained in:
parent
0654aec5d1
commit
89bc7466ff
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user