2 # Makefile for the LCOV example program.
5 # - example: compile the example program
6 # - output: run test cases on example program and create HTML output
7 # - clean: clean up directory
11 CFLAGS
:= -Wall
-I.
-fprofile-arcs
-ftest-coverage
14 GENHTML
:= ..
/bin
/genhtml
15 GENDESC
:= ..
/bin
/gendesc
16 GENPNG
:= ..
/bin
/genpng
18 # Depending on the presence of the GD.pm perl module, we can use the
19 # special option '--frames' for genhtml
20 USE_GENPNG
:= $(shell $(GENPNG
) --help
>/dev
/null
2>/dev
/null
; echo
$$?
)
22 ifeq ($(USE_GENPNG
),0)
28 .PHONY
: clean output test_noargs test_2_to_2000 test_overflow
32 example
: example.o iterate.o gauss.o
33 $(CC
) example.o iterate.o gauss.o
-o example
-lgcov
35 example.o
: example.c iterate.h gauss.h
36 $(CC
) $(CFLAGS
) -c example.c
-o example.o
38 iterate.o
: methods
/iterate.c iterate.h
39 $(CC
) $(CFLAGS
) -c methods
/iterate.c
-o iterate.o
41 gauss.o
: methods
/gauss.c gauss.h
42 $(CC
) $(CFLAGS
) -c methods
/gauss.c
-o gauss.o
44 output
: example descriptions test_noargs test_2_to_2000 test_overflow
47 @echo
'* Generating HTML output'
50 $(GENHTML
) trace_noargs.
info trace_args.
info trace_overflow.
info \
51 --output-directory output
--title
"Basic example" \
52 --show-details
--description-file descriptions
$(FRAMES
) \
56 @echo
'* See '`pwd`/output
/index.html
60 descriptions
: descriptions.txt
61 $(GENDESC
) descriptions.txt
-o descriptions
63 all_tests
: example test_noargs test_2_to_2000 test_overflow
68 @echo
'* Test case 1: running ./example without parameters'
71 $(LCOV
) --zerocounters
--directory .
73 $(LCOV
) --capture
--directory .
--output-file trace_noargs.
info --test-name test_noargs
78 @echo
'* Test case 2: running ./example 2 2000'
81 $(LCOV
) --zerocounters
--directory .
83 $(LCOV
) --capture
--directory .
--output-file trace_args.
info --test-name test_2_to_2000
88 @echo
'* Test case 3: running ./example 0 100000 (causes an overflow)'
91 $(LCOV
) --zerocounters
--directory .
92 .
/example
0 100000 || true
93 $(LCOV
) --capture
--directory .
--output-file trace_overflow.
info --test-name
"test_overflow"
96 rm -rf
*.o
*.bb
*.bbg
*.da
*.gcno
*.gcda
*.
info output example \