Add $CC and $CXX variables to build-*.sh

This commit is contained in:
Nigel Tao committed 2018-12-26 12:38:15 +11:00
1 parent eb108af98a
commit b2d598aac5
3 files changed
+19 -10

No files matched your search

+8 -5
View File
@@ -33,25 +33,28 @@
# having to separately configure, build or install a library:
#
# git clone https://github.com/google/wuffs.git
# cd wuffs/example/zcat
# gcc zcat.c
# ./a.out < ../../test/data/romeo.txt.gz
# cd wuffs
# gcc ./example/zcat/zcat.c
# ./a.out < ./test/data/romeo.txt.gz
if [ ! -e release/c/wuffs-unsupported-snapshot.c ]; then
echo "$0 should be run from the Wuffs root directory."
exit 1
fi
CC=${CC:-gcc}
CXX=${CXX:-g++}
go install github.com/google/wuffs/cmd/...
go test github.com/google/wuffs/...
wuffs gen
echo "Checking snapshot compiles cleanly (as C)"
gcc -c -Wall -Werror -DWUFFS_IMPLEMENTATION -std=c99 \
$CC -c -Wall -Werror -DWUFFS_IMPLEMENTATION -std=c99 \
release/c/wuffs-unsupported-snapshot.c -o /dev/null
echo "Checking snapshot compiles cleanly (as C++)"
g++ -c -Wall -Werror -DWUFFS_IMPLEMENTATION -std=c++11 \
$CXX -c -Wall -Werror -DWUFFS_IMPLEMENTATION -std=c++11 \
release/c/wuffs-unsupported-snapshot.c -o /dev/null
wuffs genlib -skipgen
+7 -4
View File
@@ -22,6 +22,9 @@ if [ ! -e release/c/wuffs-unsupported-snapshot.c ]; then
exit 1
fi
CC=${CC:-gcc}
CXX=${CXX:-g++}
mkdir -p gen/bin
sources=$@
@@ -39,19 +42,19 @@ for f in $sources; do
if [ $f = crc32 ]; then
echo "Building gen/bin/example-$f"
# example/crc32 is unusual in that it's C++, not C.
g++ -O3 example/$f/*.cc -o gen/bin/example-$f
$CXX -O3 example/$f/*.cc -o gen/bin/example-$f
elif [ $f = library ]; then
# example/library is unusual in that it uses separately compiled libraries
# (built by "wuffs genlib", e.g. by running build-all.sh) instead of
# directly #include'ing Wuffs' .c files.
if [ -e gen/lib/c/gcc-static/libwuffs.a ]; then
if [ -e gen/lib/c/$CC-static/libwuffs.a ]; then
echo "Building gen/bin/example-$f"
gcc -O3 -static -I.. example/$f/*.c gen/lib/c/gcc-static/libwuffs.a -o gen/bin/example-$f
$CC -O3 -static -I.. example/$f/*.c gen/lib/c/$CC-static/libwuffs.a -o gen/bin/example-$f
else
echo "Skipping gen/bin/example-$f; run \"wuffs genlib\" first"
fi
elif [ -e example/$f/*.c ]; then
echo "Building gen/bin/example-$f"
gcc -O3 example/$f/*.c -o gen/bin/example-$f
$CC -O3 example/$f/*.c -o gen/bin/example-$f
fi
done
+4 -1
View File
@@ -22,6 +22,9 @@ if [ ! -e release/c/wuffs-unsupported-snapshot.c ]; then
exit 1
fi
CC=${CC:-gcc}
CXX=${CXX:-g++}
mkdir -p gen/bin
sources=$@
@@ -38,5 +41,5 @@ for f in $sources; do
fi
echo "Building gen/bin/fuzz-$f"
gcc -DWUFFS_CONFIG__FUZZLIB_MAIN fuzz/c/std/${f}_fuzzer.c -o gen/bin/fuzz-$f
$CC -DWUFFS_CONFIG__FUZZLIB_MAIN fuzz/c/std/${f}_fuzzer.c -o gen/bin/fuzz-$f
done