mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 09:01:35 +01:00
Let build scripts take "example/*" arguments
This commit is contained in:
1 parent
c1af1e2c82
commit
10ae70448f
3 files changed
+56
-12
No files matched your search
@@ -37,6 +37,11 @@
|
|||||||
# gcc zcat.c
|
# gcc zcat.c
|
||||||
# ./a.out < ../../test/data/romeo.txt.gz
|
# ./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 install github.com/google/wuffs/cmd/...
|
||||||
go test github.com/google/wuffs/...
|
go test github.com/google/wuffs/...
|
||||||
wuffs gen
|
wuffs gen
|
||||||
|
|||||||
+29
-9
@@ -17,21 +17,41 @@
|
|||||||
|
|
||||||
# See build-all.sh for commentary.
|
# See build-all.sh for commentary.
|
||||||
|
|
||||||
for f in example/*; do
|
if [ ! -e release/c/wuffs-unsupported-snapshot.h ]; then
|
||||||
echo "Building $f"
|
echo "$0 should be run from the Wuffs root directory."
|
||||||
if [ "$f" = "example/crc32" ]; then
|
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.
|
# example/crc32 is unusual in that it's C++, not C.
|
||||||
g++ -O3 $f/*.cc -o $f/a.out
|
g++ -O3 example/$f/*.cc -o gen/bin/example-$f
|
||||||
elif [ "$f" = "example/library" ]; then
|
elif [ $f = library ]; then
|
||||||
# example/library is unusual in that it uses separately compiled libraries
|
# example/library is unusual in that it uses separately compiled libraries
|
||||||
# (built by "wuffs genlib", e.g. by running build-all.sh) instead of
|
# (built by "wuffs genlib", e.g. by running build-all.sh) instead of
|
||||||
# directly #include'ing Wuffs' .c files.
|
# directly #include'ing Wuffs' .c files.
|
||||||
if [ -e gen/lib/c/gcc-static/libwuffs.a ]; then
|
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
|
else
|
||||||
echo " Skipping example/library; run \"wuffs genlib\" first"
|
echo "Skipping gen/bin/example-$f; run \"wuffs genlib\" first"
|
||||||
fi
|
fi
|
||||||
elif [ -e $f/*.c ]; then
|
elif [ -e example/$f/*.c ]; then
|
||||||
gcc -O3 $f/*.c -o $f/a.out
|
echo "Building gen/bin/example-$f"
|
||||||
|
gcc -O3 example/$f/*.c -o gen/bin/example-$f
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
+22
-3
@@ -17,7 +17,26 @@
|
|||||||
|
|
||||||
# See build-all.sh for commentary.
|
# See build-all.sh for commentary.
|
||||||
|
|
||||||
for f in fuzz/c/std/*_fuzzer.c; do
|
if [ ! -e release/c/wuffs-unsupported-snapshot.h ]; then
|
||||||
echo "Building $f"
|
echo "$0 should be run from the Wuffs root directory."
|
||||||
gcc -DWUFFS_CONFIG__FUZZLIB_MAIN $f -o ${f%.c}.out
|
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
|
done
|
||||||
Reference in new issue
Block a user