From 1cee71b84abff0c2d43f696798761c9be8c0d986 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Fri, 27 Oct 2017 20:34:31 -0700 Subject: [PATCH] buildlib: minor cleanup Tidy up whitespace, line continuations and minor other stuff. Also slip in set -e too. Signed-off-by: Kyle J. McKay --- buildlib | 78 ++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 41 insertions(+), 37 deletions(-) rewrite buildlib (71%) diff --git a/buildlib b/buildlib dissimilarity index 71% index 8fd1c0884..56e3478b8 100755 --- a/buildlib +++ b/buildlib @@ -1,37 +1,41 @@ -#!/bin/sh -if [ -z "$CC" ]; then - if command -v gcc > /dev/null; then - CC=gcc - elif command -v clang > /dev/null; then - CC=clang - elif command -v cc > /dev/null; then - CC=cc - else - echo "Could not guess name of compiler, please set CC" >&2 - exit 2 - fi -fi -echo "CC=$CC" -: ${AR:=ar} -echo "AR=$AR" -: ${RANLIB:=ranlib} -echo "RANLIB=$RANLIB" -if [ "${CFLAGS+set}" != "set" ]; then - case "$CC" in - *gcc*|*clang*) - CFLAGS=-O2 - ;; - *) - CFLAGS=-O - ;; - esac -fi -echo "CFLAGS=$CFLAGS" -set -v -LIB=libBlocksRuntime.a -SRC=BlocksRuntime -if test -f $LIB; then rm $LIB; fi -"$CC" -c $CFLAGS -o $SRC/data.o $SRC/data.c \ -&& "$CC" -c $CFLAGS -o $SRC/runtime.o -I . $SRC/runtime.c \ -&& "$AR" cr $LIB $SRC/data.o $SRC/runtime.o \ -&& "$RANLIB" $LIB +#!/bin/sh + +if [ -z "$CC" ]; then + if command -v gcc > /dev/null; then + CC=gcc + elif command -v clang > /dev/null; then + CC=clang + elif command -v cc > /dev/null; then + CC=cc + else + echo "Could not guess name of compiler, please set CC" >&2 + exit 2 + fi +fi + +echo "CC=$CC" +: ${AR:=ar} +echo "AR=$AR" +: ${RANLIB:=ranlib} +echo "RANLIB=$RANLIB" + +if [ "${CFLAGS+set}" != "set" ]; then + case "$CC" in + *gcc*|*clang*) + CFLAGS=-O2 + ;; + *) + CFLAGS=-O + ;; + esac +fi +echo "CFLAGS=$CFLAGS" + +set -ev +LIB=libBlocksRuntime.a +SRC=BlocksRuntime +! test -e $LIB || rm $LIB +"$CC" -c $CFLAGS -o $SRC/data.o $SRC/data.c && +"$CC" -c $CFLAGS -o $SRC/runtime.o -I . $SRC/runtime.c && +"$AR" cr $LIB $SRC/data.o $SRC/runtime.o && +"$RANLIB" $LIB -- 2.11.4.GIT