forked from kolemannix/ffc.h
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (47 loc) · 2.29 KB
/
Copy pathMakefile
File metadata and controls
69 lines (47 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.PHONY: test example exhaustive fetch-supplemental-data supplemental_tests print_version_tag
# Detect linux and define _DEFAULT_SOURCE if so
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
EXTRA_CFLAGS := -D_DEFAULT_SOURCE
endif
CLANG_FLAGS := -xc -Wall -Wextra -Wpedantic -O3 -g -std=c99 $(EXTRA_CFLAGS)
ffc.h: src/ffc.h src/common.h src/parse.h src/digit_comparison.h src/api.h src/bigint.h amalgamate.py
python3 amalgamate.py > ffc.h
out/example: ffc.h example.c | out
clang -xc -Wall -Wformat -Wpedantic -std=c99 example.c -o out/example
example: out/example
./out/example
out/print_version_tag: tools/print_version_tag.c src/api.h | out
clang $(CLANG_FLAGS) -I. tools/print_version_tag.c -o out/print_version_tag
print_version_tag: out/print_version_tag
./out/print_version_tag
out:
mkdir -p out
out/test_runner: ffc.h test_src/test.c | out
gcc -xc -Wall -Wextra -Wpedantic ffc.h -fsyntax-only
clang $(CLANG_FLAGS) -I. -Itest_src test_src/test.c -o out/test_runner -lm
test: out/test_runner out/test_int_runner
./out/test_runner
./out/test_int_runner
out/test_int_runner: ffc.h test_src/test_int.c | out
clang $(CLANG_FLAGS) -I. -Itest_src test_src/test_int.c -o out/test_int_runner -lm
# Supplemental test stuff
SUPPLEMENTAL_TEST_FILES_DIR := out/supplemental_test_files
SUPPLEMENTAL_TEST_DATA_DIR := $(SUPPLEMENTAL_TEST_FILES_DIR)/data
fetch-supplemental-data: | out
git clone --depth 1 https://github.com/fastfloat/supplemental_test_files.git $(SUPPLEMENTAL_TEST_FILES_DIR)
$(SUPPLEMENTAL_TEST_DATA_DIR):
@test -d "$(SUPPLEMENTAL_TEST_DATA_DIR)" || { \
echo "Missing supplemental test data at $(SUPPLEMENTAL_TEST_DATA_DIR)." >&2; \
echo "Run 'make fetch-supplemental-data' first." >&2; \
exit 1; \
}
out/supplemental_tests: ffc.h test_src/supplemental_tests.c $(SUPPLEMENTAL_TEST_DATA_DIR) | out
clang $(CLANG_FLAGS) -I. -Itest_src -DSUPPLEMENTAL_TEST_DATA_DIR=\"$(SUPPLEMENTAL_TEST_DATA_DIR)\" test_src/supplemental_tests.c -o out/supplemental_tests -lm
supplemental_tests: out/supplemental_tests
./out/supplemental_tests
# Exhaustive stuff
exhaustive: out/test_exhaustive_runner
./out/test_exhaustive_runner
out/test_exhaustive_runner: ffc.h test_src/test_exhaustive.c | out
clang $(CLANG_FLAGS) -pthread -I. -Itest_src test_src/test_exhaustive.c -o out/test_exhaustive_runner -lm