diff --git a/colors/make.py b/colors/make.py index 8a058ec..ffd9142 100644 --- a/colors/make.py +++ b/colors/make.py @@ -21,15 +21,19 @@ add_color_attr("DESCEND", "white", "dark") add_color_attr("objtool", "yellow", "dark", "bold") add_color_attr("LD", "yellow") -for line in sys.stdin: - if line[0] == "#": - termcolor.cprint(line, "blue", attrs=["dark", "bold"], end="") - else: - for part in re.split(r'(\s+)', line): - if "/" in part or "(#" in part or os.path.exists(part): - color = "magenta" if re.match("module", part, re.I) else "white" - attrs = ["bold"] - else: - color = make_colors.get(part, "green") - attrs = make_attrs.get(part, []) - termcolor.cprint(part, color, attrs=attrs, end="") +text = "" +while c := sys.stdin.read(1): + text += c + if text[0] == "#": + if re.match("^#(.*?)\n", text): + termcolor.cprint(text, "blue", attrs=["dark", "bold"], end="") + text = "" + elif c in (" ", "\n"): + if "/" in text or "(#" in text or os.path.exists(text): + color = "magenta" if re.match("module", text, re.I) else "white" + attrs = ["bold"] + else: + color = make_colors.get(text.strip(), "green") + attrs = make_attrs.get(text.strip(), []) + termcolor.cprint(text, color, attrs=attrs, end="") + text = "" diff --git a/makelinux.zsh b/makelinux.zsh index 1b41e6e..2001412 100755 --- a/makelinux.zsh +++ b/makelinux.zsh @@ -1,13 +1,13 @@ #!/bin/zsh +source common.zsh set -eo pipefail let jobs=$(nproc)-2 -ARCH=$(uname -m) -CROSS_COMPILE= -CC= OPTS=(--clang) -zparseopts -D -K -clang+=OPTS -gcc+=OPTS -arm64+=OPTS +zparseopts -D -K -clang+=OPTS -gcc+=OPTS -arm64+=OPTS -i686+=OPTS -env+=OPTS + +[[ -z "$ARCH" ]] && ARCH=$(uname -m) case ${OPTS[-1]} in --clang) CC=clang ;; @@ -16,6 +16,9 @@ case ${OPTS[-1]} in CC=gcc CROSS_COMPILE=aarch64-linux-gnu- ;; +--i686) ARCH=i386 + CC=gcc + ;; esac if [ -f .git/config ] && [ -f .git/HEAD ]; then @@ -23,7 +26,7 @@ if [ -f .git/config ] && [ -f .git/HEAD ]; then scripts/config --set-str CONFIG_LOCALVERSION "-g$REV" fi -make -j$jobs CC=$CC ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $* | python -u /home/anna/bin/colors/make.py +make -j$jobs CC=$CC ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE $* | python -u $COLORS/make.py if [[ "$CC" == "clang" ]]; then scripts/clang-tools/gen_compile_commands.py &