etc/services - sync with NetBSD-8
[minix.git] / share / mk / minix.gcov.mk
blob42ae988e3d67e99c682cac7f0090447bad4b5226
1 LCOV=lcov.$(PROG)
2 CLEANFILES+= *.gcno *.gcda $(LCOV)
4 # Right now we support obtaining coverage information for system services only,
5 # and for their main program code (not including their libraries) only.
7 # Why not userland as well: because we do not care as much, and it should be
8 # possible to produce coverage information for system services without
9 # recompiling the entire system with coverage support. Moreover, as of writing
10 # we do not have libprofile_rt, making it impossible to compile regular
11 # programs with coverage support altogether.
13 # Why not system service libraries (eg libsys) as well: practical concerns..
14 # 1) As of writing, even for such libraries we make a regular and a PIC
15 # version, both producing a .gcno file for each object. The PIC version is
16 # compiled last, while the regular version is used for the library archive.
17 # The result is a potential mismatch between the compile-time coverage
18 # metadata and the run-time coverage counts.
19 # 2) The kernel has no coverage support, and with its self-relocation it would
20 # be tricky to add support for it. As a result, libraries used by the
21 # kernel would have to be excluded from being compiled with coverage support
22 # so as not to create problems. One could argue that that is a good thing
23 # because eg libminc and libsys create too many small result units (see also
24 # the current hardcoded limit in libsys/llvm_gcov.c).
25 # 3) gcov-pull(8) strips paths, which results in lots of manual work to figure
26 # out what file belongs to which library, even ignoring object name
27 # conflicts, for example between libraries.
28 # 4) In order to produce practically useful results ("how much of libsockevent
29 # is covered by the combination of LWIP and UDS" etc), gcov-pull(8) would
30 # have to be extended with support for merging .gcda files. The standard
31 # LLVM libprofile_rt implementation supports this, but we do not.
32 # All of these issues are solvable, but for now anyone interested in coverage
33 # for a particular system service library will have to mess with individual
34 # makefiles themselves.
36 .if ${MKCOVERAGE:Uno} == "yes"
37 .if ${ACTIVE_CC} == "gcc"
38 # Leftovers for GCC. It is not clear whether these still work at all.
39 COVCPPFLAGS?= -fno-builtin -fprofile-arcs -ftest-coverage
40 COVLDADD?= -lgcov
41 .else # ${ACTIVE_CC} != "gcc"
42 # We assume LLVM/clang here. For other compilers this will likely break the
43 # MKCOVERAGE compilation, which is a good indication that support for them
44 # should be added here.
45 COVCPPFLAGS?= --coverage -g -O0
46 COVLDADD?=
47 .endif # ${ACTIVE_CC} != "gcc"
48 .endif # ${MKCOVERAGE:Uno} == "yes"
50 lcov:
51 lcov -c -d . >$(LCOV)