1- .PHONY : test example
1+ .PHONY : test example fetch-supplemental-data
22
33# Detect linux and define _DEFAULT_SOURCE if so
44UNAME_S := $(shell uname -s)
@@ -7,18 +7,39 @@ ifeq ($(UNAME_S),Linux)
77endif
88
99CLANG_FLAGS := -xc -Wall -Wextra -Wpedantic -O3 -g -std=c99 $(EXTRA_CFLAGS )
10+ SUPPLEMENTAL_TEST_FILES_DIR := out/supplemental_test_files
11+ SUPPLEMENTAL_TEST_DATA_DIR := $(SUPPLEMENTAL_TEST_FILES_DIR ) /data
12+ SUPPLEMENTAL_TEST_FILES_REPO := https://github.com/fastfloat/supplemental_test_files.git
1013
1114out/test_runner : ffc.h test_src/test.c | out
1215 gcc -xc -Wall -Wextra -Wpedantic ffc.h -fsyntax-only
1316 clang $(CLANG_FLAGS ) -I. -Itest_src test_src/test.c -o out/test_runner -lm
1417
15- test : out/test_runner out/test_int_runner
18+ test : out/test_runner out/test_int_runner out/supplemental_tests out/supplemental_tests_src
1619 ./out/test_runner
1720 ./out/test_int_runner
21+ ./out/supplemental_tests
22+ ./out/supplemental_tests_src
1823
1924out/test_int_runner : ffc.h test_src/test_int.c | out
2025 clang $(CLANG_FLAGS ) -I. -Itest_src test_src/test_int.c -o out/test_int_runner -lm
2126
27+ $(SUPPLEMENTAL_TEST_DATA_DIR ) :
28+ @test -d " $( SUPPLEMENTAL_TEST_DATA_DIR) " || { \
29+ echo " Missing supplemental test data at $( SUPPLEMENTAL_TEST_DATA_DIR) ." >&2 ; \
30+ echo " Run 'make fetch-supplemental-data' first." >&2 ; \
31+ exit 1; \
32+ }
33+
34+ out/supplemental_tests : ffc.h test_src/supplemental_tests.c $(SUPPLEMENTAL_TEST_DATA_DIR ) | out
35+ clang $(CLANG_FLAGS ) -I. -Itest_src -DSUPPLEMENTAL_TEST_DATA_DIR=\" $(SUPPLEMENTAL_TEST_DATA_DIR ) \" test_src/supplemental_tests.c -o out/supplemental_tests -lm
36+
37+ out/supplemental_tests_src : src/ffc.h test_src/supplemental_tests.c $(SUPPLEMENTAL_TEST_DATA_DIR ) | out
38+ clang $(CLANG_FLAGS ) -Isrc -Itest_src -DSUPPLEMENTAL_TEST_DATA_DIR=\" $(SUPPLEMENTAL_TEST_DATA_DIR ) \" test_src/supplemental_tests.c -o out/supplemental_tests_src -lm
39+
40+ fetch-supplemental-data : | out
41+ git clone --depth 1 $(SUPPLEMENTAL_TEST_FILES_REPO ) $(SUPPLEMENTAL_TEST_FILES_DIR )
42+
2243ffc.h : src/ffc.h src/common.h src/parse.h src/digit_comparison.h src/api.h src/bigint.h amalgamate.py
2344 python3 amalgamate.py > ffc.h
2445
0 commit comments