1CFLAGS=-O
2
3puff: puff.o pufftest.o
4
5puff.o: puff.h
6
7pufftest.o: puff.h
8
9test: puff
10	puff zeros.raw
11
12puft: puff.c puff.h pufftest.o
13	cc -fprofile-arcs -ftest-coverage -o puft puff.c pufftest.o
14
15# puff full coverage test (should say 100%)
16cov: puft
17	@rm -f *.gcov *.gcda
18	@puft -w zeros.raw 2>&1 | cat > /dev/null
19	@echo '04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
20	@echo '00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
21	@echo '00 00 00 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 254
22	@echo '00 01 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
23	@echo '01 01 00 fe ff 0a' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
24	@echo '02 7e ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
25	@echo '02' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
26	@echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 2
27	@echo '04 80 49 92 24 49 92 24 71 ff ff 93 11 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 249
28	@echo '04 c0 81 08 00 00 00 00 20 7f eb 0b 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
29	@echo '0b 00 00' | xxd -r -p | puft -f 2>&1 | cat > /dev/null
30	@echo '1a 07' | xxd -r -p | puft 2> /dev/null || test $$? -eq 246
31	@echo '0c c0 81 00 00 00 00 00 90 ff 6b 04' | xxd -r -p | puft 2> /dev/null || test $$? -eq 245
32	@puft -f zeros.raw 2>&1 | cat > /dev/null
33	@echo 'fc 00 00' | xxd -r -p | puft 2> /dev/null || test $$? -eq 253
34	@echo '04 00 fe ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 252
35	@echo '04 00 24 49' | xxd -r -p | puft 2> /dev/null || test $$? -eq 251
36	@echo '04 80 49 92 24 49 92 24 0f b4 ff ff c3 84' | xxd -r -p | puft 2> /dev/null || test $$? -eq 248
37	@echo '04 00 24 e9 ff ff' | xxd -r -p | puft 2> /dev/null || test $$? -eq 250
38	@echo '04 00 24 e9 ff 6d' | xxd -r -p | puft 2> /dev/null || test $$? -eq 247
39	@gcov -n puff.c
40
41clean:
42	rm -f puff puft *.o *.gc*
43