From 86b061078b37ee039685ee568df079fb056a199b Mon Sep 17 00:00:00 2001 From: Arun Thomas Date: Tue, 9 Aug 2011 10:39:33 +0200 Subject: [PATCH] Build gcov code only if MKCOVERAGE is yes --- lib/libsys/Makefile | 7 +++++-- lib/libsys/sef.c | 4 ++++ lib/nbsd_libminlib/Makefile | 2 ++ servers/vfs/Makefile | 9 ++++++++- servers/vfs/proto.h | 3 +++ share/mk/bsd.own.mk | 1 + 6 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index 4c9923d70..1ba8c4f29 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -13,7 +13,6 @@ SRCS= \ env_parse.c \ env_prefix.c \ fkey_ctl.c \ - gcov.c \ get_randomness.c \ getidle.c \ getsysinfo.c \ @@ -50,7 +49,6 @@ SRCS= \ sched_start.c \ sched_stop.c \ sef.c \ - sef_gcov.c \ sef_init.c \ sef_liveupdate.c \ sef_ping.c \ @@ -128,6 +126,11 @@ SRCS= \ vm_yield_get_block.c \ vprintf.c \ +.if ${MKCOVERAGE} != "no" +SRCS+= gcov.c \ + sef_gcov.c +CPPFLAGS+= -DUSE_COVERAGE +.endif CPPFLAGS.sched_start.c+= -I${MINIXSRCDIR} diff --git a/lib/libsys/sef.c b/lib/libsys/sef.c index 796da4c18..400058b7a 100644 --- a/lib/libsys/sef.c +++ b/lib/libsys/sef.c @@ -24,7 +24,9 @@ FORWARD _PROTOTYPE( void sef_debug_refresh_params, (void) ); PUBLIC _PROTOTYPE( char* sef_debug_header, (void) ); /* SEF Init prototypes. */ +#ifdef USE_COVERAGE EXTERN _PROTOTYPE( int do_sef_gcov_request, (message *m_ptr) ); +#endif EXTERN _PROTOTYPE( int do_sef_rs_init, (endpoint_t old_endpoint) ); EXTERN _PROTOTYPE( int do_sef_init_request, (message *m_ptr) ); @@ -155,6 +157,7 @@ PUBLIC int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr) } #endif +#ifdef USE_COVERAGE /* Intercept GCOV data requests (sent by VFS in vfs/gcov.c). */ if(m_ptr->m_type == COMMON_REQ_GCOV_DATA && m_ptr->m_source == VFS_PROC_NR) { @@ -162,6 +165,7 @@ PUBLIC int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr) continue; } } +#endif /* If we get this far, this is not a valid SEF request, return and * let the caller deal with that. diff --git a/lib/nbsd_libminlib/Makefile b/lib/nbsd_libminlib/Makefile index 12bbfc39c..0e599a0af 100644 --- a/lib/nbsd_libminlib/Makefile +++ b/lib/nbsd_libminlib/Makefile @@ -11,7 +11,9 @@ SRCS+= fslib.c fsversion.c SRCS+= dhcp_gettag.c dhcp_settag.c # Gcov support. +.if ${MKCOVERAGE} != "no" SRCS+= gcov.c gcov_flush.c +.endif # Various utils SRCS+= itoa.c u64util.c diff --git a/servers/vfs/Makefile b/servers/vfs/Makefile index dfe9d197d..a3f08d01a 100644 --- a/servers/vfs/Makefile +++ b/servers/vfs/Makefile @@ -1,10 +1,17 @@ # Makefile for Virtual File System (VFS) +.include + PROG= vfs SRCS= main.c open.c read.c write.c pipe.c dmap.c \ path.c device.c mount.c link.c exec.c \ filedes.c stadir.c protect.c time.c \ lock.c misc.c utility.c select.c table.c \ - vnode.c vmnt.c request.c fscall.c gcov.c + vnode.c vmnt.c request.c fscall.c + +.if ${MKCOVERAGE} != "no" +SRCS+= gcov.c +CPPFLAGS+= -DUSE_COVERAGE +.endif DPADD+= ${LIBSYS} ${LIBTIMERS} ${LIBEXEC} LDADD+= -lsys -ltimers -lexec diff --git a/servers/vfs/proto.h b/servers/vfs/proto.h index be51cdc9d..e54810f12 100644 --- a/servers/vfs/proto.h +++ b/servers/vfs/proto.h @@ -282,6 +282,9 @@ _PROTOTYPE( int do_write, (void) ); /* gcov.c */ _PROTOTYPE( int do_gcov_flush, (void) ); +#if ! USE_COVERAGE +#define do_gcov_flush no_sys +#endif /* select.c */ _PROTOTYPE( int do_select, (void) ); diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index b945b4fcf..3c97108e9 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -821,6 +821,7 @@ MKWATCHDOG:= no MKACPI:= no MKAPIC:= no MKMCONTEXT:= no +MKCOVERAGE:= no .endif # -- 2.44.0