[build] Detect compiler; force color output in clang

This commit is contained in:
Kevin Lange 2011-10-27 18:19:39 -05:00
parent 1f4b7c68b6
commit fe9b4d5cbb
3 changed files with 20 additions and 4 deletions

View File

@ -1,5 +1,6 @@
#CC = gcc-4.3
CC = clang
# ToAruOS Primary Build Script
# This script will pull either clang (with -fcolor-diagnostics), gcc (with no extra options), or cc
CC = `util/compiler`
# Sometimes we just have to use GCC
GCC = gcc
# CFLAGS for core components
@ -21,8 +22,8 @@ DD = dd conv=notrunc
BEG = util/mk-beg
END = util/mk-end
INFO = util/mk-info
ERRORS = 2>>/tmp/.build-errors
ERRORSS = >>/tmp/.build-errors
ERRORS = 2>>/tmp/.build-errors || util/mk-error
ERRORSS = >>/tmp/.build-errors || util/mk-error
BEGRM = util/mk-beg-rm
ENDRM = util/mk-end-rm

9
util/compiler Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
if [[ -n `which clang` ]] ; then
echo "clang -fcolor-diagnostics"
elif [[ -n `which gcc` ]] ; then
echo "gcc"
else
echo "cc"
fi

6
util/mk-error Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
echo -e "\033[1;31m! Fatal error encountered.\033[0m"
cat /tmp/.build-errors
exit 1