-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
40 lines (28 loc) · 893 Bytes
/
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
TEST = test.c levenshtein.c
EXAMPLE = example.c levenshtein.c
OBJ_TEST = $(TEST:.c=.o)
OBJ_EXAMPLE = $(EXAMPLE:.c=.o)
CFLAGS = -D_GNU_SOURCE -std=c99
LFLAGS = -Wall -Wno-format-y2k -W -Wstrict-prototypes \
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch \
-Wshadow -Wcast-align -Wbad-function-cast -Wchar-subscripts -Winline \
-Wnested-externs -Wredundant-decls
COVFLAGS = -Wall -fprofile-arcs -ftest-coverage
test: $(OBJ_TEST)
$(CC) $(OBJ_TEST) -o $@
example: $(OBJ_EXAMPLE)
$(CC) $(OBJ_EXAMPLE) -o $@
coverage: $(OBJ_TEST)
gcc $(COVFLAGS) $(TEST) -o $@
.SUFFIXES: .c .o
.c.o:
$(CC) $< $(CFLAGS) $(LFLAGS) -c -o $@
run-coverage: coverage
./coverage && gcov levenshtein
run-test: test
./test
run-example: example
./example sitting kitten
clean:
rm -f coverage test example $(OBJ_TEST) $(OBJ_EXAMPLE) *.gc{ov,da,no}
.PHONY: clean run-coverage run-test