Skip to content

Commit e8bed2e

Browse files
committed
Clean it up
1 parent bf9bd30 commit e8bed2e

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

.github/workflows/c.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ jobs:
1414
run: sudo apt-get update && sudo apt-get install -y clang gcc make python3
1515
- name: make test
1616
run: make test
17+
- name: Supplemental tests
18+
run: |
19+
make fetch-supplemental-data
20+
make supplemental_tests
21+
- name: make example
22+
run: make example
23+
- name: Check dirty single-header
24+
run: git diff --exit-code ffc.h
1725
- name: cmake configure
1826
run: cmake -B build
1927
- name: cmake build
2028
run: cmake --build build -j 2
2129
- name: cmake test
2230
run: ctest --test-dir build -j 2
23-
- name: make example
24-
run: make example
25-
- name: Check dirty single-header
26-
run: git diff --exit-code ffc.h

Makefile

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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
44
UNAME_S := $(shell uname -s)
@@ -9,21 +9,36 @@ endif
99
CLANG_FLAGS := -xc -Wall -Wextra -Wpedantic -O3 -g -std=c99 $(EXTRA_CFLAGS)
1010
SUPPLEMENTAL_TEST_FILES_DIR := out/supplemental_test_files
1111
SUPPLEMENTAL_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

1425
out/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

2433
out/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):
3449
out/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

Comments
 (0)