1- .PHONY : test example fetch-supplemental-data
1+ .PHONY : test example fetch-supplemental-data supplemental_tests
22
33# Detect linux and define _DEFAULT_SOURCE if so
44UNAME_S := $(shell uname -s)
99CLANG_FLAGS := -xc -Wall -Wextra -Wpedantic -O3 -g -std=c99 $(EXTRA_CFLAGS )
1010SUPPLEMENTAL_TEST_FILES_DIR := out/supplemental_test_files
1111SUPPLEMENTAL_TEST_DATA_DIR := $(SUPPLEMENTAL_TEST_FILES_DIR ) /data
12- SUPPLEMENTAL_TEST_FILES_REPO := https://github.com/fastfloat/supplemental_test_files.git
12+
13+ ffc.h : src/ffc.h src/common.h src/parse.h src/digit_comparison.h src/api.h src/bigint.h amalgamate.py
14+ python3 amalgamate.py > ffc.h
15+
16+ out/example : ffc.h example.c | out
17+ clang -xc -Wall -Wformat -Wpedantic -std=c99 example.c -o out/example
18+
19+ example : out/example
20+ ./out/example
21+
22+ out :
23+ mkdir -p out
1324
1425out/test_runner : ffc.h test_src/test.c | out
1526 gcc -xc -Wall -Wextra -Wpedantic ffc.h -fsyntax-only
1627 clang $(CLANG_FLAGS ) -I. -Itest_src test_src/test.c -o out/test_runner -lm
1728
18- test : out/test_runner out/test_int_runner out/supplemental_tests out/supplemental_tests_src
29+ test : out/test_runner out/test_int_runner out/supplemental_tests
1930 ./out/test_runner
2031 ./out/test_int_runner
21- ./out/supplemental_tests
22- ./out/supplemental_tests_src
2332
2433out/test_int_runner : ffc.h test_src/test_int.c | out
2534 clang $(CLANG_FLAGS ) -I. -Itest_src test_src/test_int.c -o out/test_int_runner -lm
2635
36+
37+ # Supplemental test stuff
38+
39+ fetch-supplemental-data : | out
40+ git clone --depth 1 https://github.com/fastfloat/supplemental_test_files.git $(SUPPLEMENTAL_TEST_FILES_DIR )
41+
2742$(SUPPLEMENTAL_TEST_DATA_DIR ) :
2843 @test -d " $( SUPPLEMENTAL_TEST_DATA_DIR) " || { \
2944 echo " Missing supplemental test data at $( SUPPLEMENTAL_TEST_DATA_DIR) ." >&2 ; \
@@ -34,20 +49,5 @@ $(SUPPLEMENTAL_TEST_DATA_DIR):
3449out/supplemental_tests : ffc.h test_src/supplemental_tests.c $(SUPPLEMENTAL_TEST_DATA_DIR ) | out
3550 clang $(CLANG_FLAGS ) -I. -Itest_src -DSUPPLEMENTAL_TEST_DATA_DIR=\" $(SUPPLEMENTAL_TEST_DATA_DIR ) \" test_src/supplemental_tests.c -o out/supplemental_tests -lm
3651
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-
43- ffc.h : src/ffc.h src/common.h src/parse.h src/digit_comparison.h src/api.h src/bigint.h amalgamate.py
44- python3 amalgamate.py > ffc.h
45-
46- out/example : ffc.h example.c | out
47- clang -xc -Wall -Wformat -Wpedantic -std=c99 example.c -o out/example
48-
49- example : out/example
50- ./out/example
51-
52- out :
53- mkdir -p out
52+ supplemental_tests : out/supplemental_tests
53+ ./out/supplemental_tests
0 commit comments