Let build scripts take "example/*" arguments

This commit is contained in:
Nigel Tao committed 2018-08-18 12:13:36 +10:00
1 parent c1af1e2c82
commit 10ae70448f
3 files changed
+56 -12

No files matched your search

+5
View File
@@ -37,6 +37,11 @@
# gcc zcat.c
# ./a.out < ../../test/data/romeo.txt.gz
if [ ! -e release/c/wuffs-unsupported-snapshot.h ]; then
echo "$0 should be run from the Wuffs root directory."
exit 1
fi
go install github.com/google/wuffs/cmd/...
go test github.com/google/wuffs/...
wuffs gen
+29 -9
View File
@@ -17,21 +17,41 @@
# See build-all.sh for commentary.
for f in example/*; do
echo "Building $f"
if [ "$f" = "example/crc32" ]; then
if [ ! -e release/c/wuffs-unsupported-snapshot.h ]; then
echo "$0 should be run from the Wuffs root directory."
exit 1
fi
mkdir -p gen/bin
sources=$@
if [ $# -eq 0 ]; then
sources=example/*
fi
for f in $sources; do
f=${f%/}
f=${f##*/}
if [ -z $f ]; then
continue
fi
if [ $f = crc32 ]; then
echo "Building gen/bin/example-$f"
# example/crc32 is unusual in that it's C++, not C.
g++ -O3 $f/*.cc -o $f/a.out
elif [ "$f" = "example/library" ]; then
g++ -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
gcc -O3 -static -I.. $f/*.c gen/lib/c/gcc-static/libwuffs.a -o $f/a.out
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
else
echo " Skipping example/library; run \"wuffs genlib\" first"
echo "Skipping gen/bin/example-$f; run \"wuffs genlib\" first"
fi
elif [ -e $f/*.c ]; then
gcc -O3 $f/*.c -o $f/a.out
elif [ -e example/$f/*.c ]; then
echo "Building gen/bin/example-$f"
gcc -O3 example/$f/*.c -o gen/bin/example-$f
fi
done
+22 -3
View File
@@ -17,7 +17,26 @@
# See build-all.sh for commentary.
for f in fuzz/c/std/*_fuzzer.c; do
echo "Building $f"
gcc -DWUFFS_CONFIG__FUZZLIB_MAIN $f -o ${f%.c}.out
if [ ! -e release/c/wuffs-unsupported-snapshot.h ]; then
echo "$0 should be run from the Wuffs root directory."
exit 1
fi
mkdir -p gen/bin
sources=$@
if [ $# -eq 0 ]; then
sources=fuzz/c/std/*_fuzzer.c
fi
for f in $sources; do
f=${f%_fuzzer.c}
f=${f%/}
f=${f##*/}
if [ -z $f ]; then
continue
fi
echo "Building gen/bin/fuzz-$f"
gcc -DWUFFS_CONFIG__FUZZLIB_MAIN fuzz/c/std/${f}_fuzzer.c -o gen/bin/fuzz-$f
done