1# Build and run the unit tests (or speed tests) on linux 2# 3# Should work with recent versions of both gcc and clang. (To compile with 4# clang use "make CXX=clang++".) 5 6CXXFLAGS?=-Wall -Werror 7CXX11FLAGS?=-std=c++11 8 9test: tinyformat_test_cxx98 tinyformat_test_cxx11 10 @echo running tests... 11 @./tinyformat_test_cxx98 && \ 12 ./tinyformat_test_cxx11 && \ 13 ! $(CXX) $(CXXFLAGS) -std=c++98 -DTINYFORMAT_NO_VARIADIC_TEMPLATES \ 14 -DTEST_WCHAR_T_COMPILE tinyformat_test.cpp 2> /dev/null && \ 15 echo "No errors" || echo "Tests failed" 16 17doc: tinyformat.html 18 19speed_test: tinyformat_speed_test 20 @echo running speed tests... 21 @echo printf timings: 22 @time -p ./tinyformat_speed_test printf > /dev/null 23 @echo iostreams timings: 24 @time -p ./tinyformat_speed_test iostreams > /dev/null 25 @echo tinyformat timings: 26 @time -p ./tinyformat_speed_test tinyformat > /dev/null 27 @echo boost timings: 28 @time -p ./tinyformat_speed_test boost > /dev/null 29 30tinyformat_test_cxx98: tinyformat.h tinyformat_test.cpp Makefile 31 $(CXX) $(CXXFLAGS) -std=c++98 -DTINYFORMAT_NO_VARIADIC_TEMPLATES tinyformat_test.cpp -o tinyformat_test_cxx98 32 33tinyformat_test_cxx11: tinyformat.h tinyformat_test.cpp Makefile 34 $(CXX) $(CXXFLAGS) $(CXX11FLAGS) -DTINYFORMAT_USE_VARIADIC_TEMPLATES tinyformat_test.cpp -o tinyformat_test_cxx11 35 36tinyformat.html: README.rst 37 @echo building docs... 38 rst2html.py README.rst > tinyformat.html 39 40tinyformat_speed_test: tinyformat.h tinyformat_speed_test.cpp Makefile 41 $(CXX) $(CXXFLAGS) -O3 -DNDEBUG tinyformat_speed_test.cpp -o tinyformat_speed_test 42 43bloat_test: 44 @for opt in '' '-O3 -DNDEBUG' ; do \ 45 for use in '' '-DUSE_IOSTREAMS' '-DUSE_TINYFORMAT' '-DUSE_TINYFORMAT $(CXX11FLAGS)' '-DUSE_BOOST' ; do \ 46 echo ; \ 47 echo ./bloat_test.sh $(CXX) $$opt $$use ; \ 48 ./bloat_test.sh $(CXX) $$opt $$use ; \ 49 done ; \ 50 done 51 52 53clean: 54 rm -f tinyformat_test_cxx98 tinyformat_test_cxx11 tinyformat_speed_test 55 rm -f tinyformat.html 56 rm -f _bloat_test_tmp_* 57