From 89bc7466ffbc3cc6b66a0ee6b1563c4c4b6722a9 Mon Sep 17 00:00:00 2001 From: Intel A80486DX2-66 Date: Tue, 9 Jan 2024 23:09:02 +0300 Subject: [PATCH] bytebeat_compiler.py: add `CFLAGS_EXTRA` --- bytebeat_compiler.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bytebeat_compiler.py b/bytebeat_compiler.py index fa78b7b..f3ffcb7 100644 --- a/bytebeat_compiler.py +++ b/bytebeat_compiler.py @@ -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,