forked from kmowery/libfixedtimefixedpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (63 loc) · 2.53 KB
/
Makefile
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
70
71
72
73
74
75
76
77
78
79
80
81
82
SHELL := /bin/bash
CC := gcc
OPTFLAGS := -O
CFLAGS := $(OPTFLAGS) -std=c99 -Wall -Werror -Wno-unused-function -Wno-strict-aliasing -fPIC
LDFLAGS := -lcmocka -lm -lftfp
LD_LIBRARY_PATH=.
progs := test perf_test generate_test_helper
libs := libftfp.so
ftfp_src := ftfp.c autogen.c internal.c cordic.c power.c debug.c
ftfp_inc := ftfp.h internal.h base.h lut.h
ftfp_obj := $(ftfp_src:.c=.o)
ftfp_pre := $(ftfp_src:.c=.pre)
autogens := base.h lut.h autogen.c base.pyc
test_ftfp_src := test.c
test_ftfp_obj := $(test_ftfp_src:.c=.o)
test_ftfp_pre := $(test_ftfp_src:.c=.pre)
perf_ftfp_src := perf_test.c
perf_ftfp_obj := $(perf_ftfp_src:.c=.o)
perf_ftfp_pre := $(perf_ftfp_src:.c=.pre)
gen_test_src := generate_test_helper.c
gen_test_obj := $(gen_test_src:.c=.o)
gen_test_pre := $(gen_test_src:.c=.pre)
.PHONY: all clean depend alltest
all: $(libs)
base.h : generate_base.py
python generate_base.py --file base.h
base.py : generate_base.py
python generate_base.py --pyfile base.py
autogen.c : generate_print.py base.py
python generate_print.py --file autogen.c
lut.h : generate_base.py
python generate_base.py --lutfile lut.h
%.o: %.c ${ftfp_inc} Makefile
$(CC) -c -o $@ $(CFLAGS) $<
libftfp.so: $(ftfp_obj)
$(CC) ${CFLAGS} -shared -o $@ $+
perf_test: $(perf_ftfp_obj) $(libs)
$(CC) -lftfp -L . -o $@ $(CFLAGS) $<
test: $(test_ftfp_obj) $(libs)
$(CC) -L . ${CFLAGS} -o $@ $< ${LDFLAGS}
generate_test_helper: $(gen_test_obj) $(libs)
$(CC) -L . ${CFLAGS} -o $@ $< ${LDFLAGS}
pre: $(test_ftfp_pre) $(ftfp_pre) $(perf_ftfp_pre) $(gen_test_pre)
%.pre: %.c Makefile
$(CC) -c -E -o $@ $(CFLAGS) $<
clean:
$(RM) -r $(progs) $(libs) $(ftfp_obj) $(test_ftfp_obj) $(test_ftfp_pre) ${perf_ftfp_obj} ${perf_ftfp_pre} ${gen_test_obj} ${gen_test_pre} ${autogens}
run_tests:
set -x ; \
number=1 ; while [[ $$number -le 61 ]] ; do \
echo "Testing" $$number "int bits..." && make clean && python -B generate_base.py --file base.h --pyfile base.py --intbits $$number && make test && ./test || exit 1; \
((number = number + 1)) ; \
done
run_generate_test_helper:
set -x ; \
echo "#ifndef TEST_HELPER_H" > test_helper.h ; \
echo "#define TEST_HELPER_H" >> test_helper.h ; \
number=1 ; while [[ $$number -le 61 ]] ; do \
make clean && python -B generate_base.py --file base.h --pyfile base.py --intbits $$number && make generate_test_helper && ./generate_test_helper; \
((number = number + 1)) ; \
done ; \
echo >> test_helper.h ; \
echo "#endif" >> test_helper.h ;