diff --git a/amalgamate.sh b/amalgamate.sh index 796ee02..415e2ba 100755 --- a/amalgamate.sh +++ b/amalgamate.sh @@ -8,24 +8,6 @@ OUTPUT_PREFIX=_build/amalgamation cmake -H. -B_build -DAMALGAMATE_SOURCES=ON -G"Unix Makefiles" -echo "int main() { return 0; }" > main.c -echo "Test compile with GCC..." -gcc -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -echo "Test compile with GCC ANSI..." -gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -if command -v clang -then - echo "Test compile with clang..." - clang -Wall -Wpedantic -fsanitize=unsigned-integer-overflow -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -fi -for def in MINIZ_NO_STDIO MINIZ_NO_TIME MINIZ_NO_ARCHIVE_APIS MINIZ_NO_ARCHIVE_WRITING_APIS MINIZ_NO_ZLIB_APIS MINIZ_NO_ZLIB_COMPATIBLE_NAMES MINIZ_NO_MALLOC -do - echo "Test compile with GCC and define $def..." - gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -D${def} -done -rm test.out -rm main.c - cp $OUTPUT_PREFIX/miniz.* amalgamation/ cp ChangeLog.md amalgamation/ cp LICENSE amalgamation/ diff --git a/amalgamate_and_verify.sh b/amalgamate_and_verify.sh new file mode 100755 index 0000000..62cf05b --- /dev/null +++ b/amalgamate_and_verify.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +source ./amalgamate.sh + +echo "int main() { return 0; }" > main.c +echo "Test compile with GCC..." +gcc -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out +echo "Test compile with GCC ANSI..." +gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out +if command -v clang +then + echo "Test compile with clang..." + clang -Wall -Wpedantic -fsanitize=unsigned-integer-overflow -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out +fi +for def in MINIZ_NO_STDIO MINIZ_NO_TIME MINIZ_NO_ARCHIVE_APIS MINIZ_NO_ARCHIVE_WRITING_APIS MINIZ_NO_ZLIB_APIS MINIZ_NO_ZLIB_COMPATIBLE_NAMES MINIZ_NO_MALLOC +do + echo "Test compile with GCC and define $def..." + gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -D${def} +done +rm test.out +rm main.c + +echo "Amalgamation verified." + + +