From 71326bbea3a2fb5061150593fb96efc2269ff156 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Wed, 30 Jan 2019 23:30:24 -0500 Subject: [PATCH] refactored header generation --- acc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/acc b/acc index d632baf..c541c89 100755 --- a/acc +++ b/acc @@ -23,14 +23,15 @@ done # generate the autolib include file gendir="/tmp/$USER" genfile="autolib.h" +genmacro="#define AUTOLIB(n) static int __autolib_##n = 1" if [[ ! -f "$gendir/$genfile" ]]; then mkdir -p "$gendir" - printf '%s' "#define AUTOLIB(n) int __autolib_##n = 1" > "/tmp/$USER/autobuild.h" + printf '%s' "$genmacro" > "$gendir/$genfile" fi # execute the compiler if $compile; then - echo cc -include "$gendir/$genfile" "$@" + cc -include "$gendir/$genfile" "$@" else echo cc "$@" fi -- 2.52.0