Skip to content

Commit 371c34f

Browse files
committed
e9compile: use string arrays
1 parent 479df41 commit 371c34f

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

e9compile.sh

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,33 +61,37 @@ DIRNAME=`dirname $1`
6161

6262
shift
6363

64-
CFLAGS="-fno-stack-protector -fno-builtin -fno-exceptions \
65-
-fpie -O2 -Wno-unused-function -U_FORTIFY_SOURCE \
66-
-mno-mmx -mno-sse -mno-avx -mno-avx2 -mno-avx512f -msoft-float \
67-
-mstringop-strategy=loop -fno-tree-vectorize -fomit-frame-pointer \
68-
-I examples/"
69-
COMPILE="$CC $CFLAGS -c -Wall $@ \"$DIRNAME/$BASENAME.$EXTENSION\""
64+
CFLAGS=(
65+
-fno-stack-protector -fno-builtin -fno-exceptions
66+
-fpie -O2 -Wno-unused-function -U_FORTIFY_SOURCE
67+
-mno-mmx -mno-sse -mno-avx -mno-avx2 -mno-avx512f -msoft-float
68+
-mstringop-strategy=loop -fno-tree-vectorize -fomit-frame-pointer
69+
-I examples/
70+
)
71+
COMPILE=("$CC" "${CFLAGS[@]}" -c -Wall "$@" "$DIRNAME/$BASENAME.$EXTENSION")
7072

71-
echo "$COMPILE" | xargs
72-
if ! eval "$COMPILE"
73+
echo "${COMPILE[@]}"
74+
if ! "${COMPILE[@]}"
7375
then
7476
echo >&2
7577
echo "${RED}error${OFF}: compilation of (${YELLOW}$BASENAME${OFF}) failed" >&2
7678
echo >&2
7779
exit 1
7880
fi
7981

80-
CFLAGS="-pie -nostdlib \
81-
-Wl,-z -Wl,max-page-size=4096 \
82-
-Wl,-z -Wl,norelro \
83-
-Wl,-z -Wl,stack-size=0 \
84-
-Wl,--export-dynamic \
85-
-Wl,--entry=0x0 \
86-
-Wl,--strip-all"
87-
COMPILE="$CC \"$BASENAME.o\" -o \"$BASENAME\" $CFLAGS"
82+
CFLAGS=(
83+
-pie -nostdlib
84+
-Wl,-z -Wl,max-page-size=4096
85+
-Wl,-z -Wl,norelro
86+
-Wl,-z -Wl,stack-size=0
87+
-Wl,--export-dynamic
88+
-Wl,--entry=0x0
89+
-Wl,--strip-all
90+
)
91+
COMPILE=("$CC" "$BASENAME.o" -o "$BASENAME" "${CFLAGS[@]}")
8892

89-
echo "$COMPILE" | xargs
90-
if ! eval "$COMPILE"
93+
echo "${COMPILE[@]}"
94+
if ! "${COMPILE[@]}"
9195
then
9296
echo >&2
9397
echo "${RED}error${OFF}: linking (${YELLOW}$BASENAME${OFF}) failed" >&2

0 commit comments

Comments
 (0)