1#	$NetBSD: Makefile.inc,v 1.16 2021/08/29 16:44:16 rillig Exp $
2#	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
3
4# gmon sources
5.PATH: ${.CURDIR}/gmon ${ARCHDIR}/gmon
6
7.-include "${ARCHDIR}/gmon/Makefile.inc"
8
9SRCS+=	gmon.c mcount.c
10MAN+=	moncontrol.3
11MLINKS+=moncontrol.3 monstartup.3
12
13.if (${MACHINE_CPU} == "mips")
14# Turn off as(1) warnings on MIPS, since warnings are fatal with WARNS>0
15# and mcount.c causes warnings from as(1).
16# mcount.c should be fixed and this test removed.
17#
18COPTS.mcount.c+=${${ACTIVE_CXX} == "gcc":? -Wa,--no-warn :}
19.endif
20
21.if ${MACHINE_CPU} == "i386"
22# lint1 says:
23# mcount.c(285): warning: function '_mcount' implicitly declared to return int
24#
25# lint2 says:
26# _mcount used( common/lib/libc/gmon/mcount.c(285) ), but not defined
27#
28# The correct fix is probably to have a consistent underscore in both places.
29LINTFLAGS.mcount.c+=	-X 215
30.endif
31
32.if (${MACHINE_CPU} == "i386" || ${MACHINE_CPU} == "x86_64") && \
33    ${HAVE_GCC:U0} >= 6
34# The usage of __builtin_frame_address(1) should be OK.
35COPTS.mcount.c+=${${ACTIVE_CXX} == "gcc":? -Wno-error=frame-address :}
36.endif
37COPTS.mcount.c+=${${ACTIVE_CC} == "clang":? -Wno-error=frame-address :}
38
39
40# mcount and gmon cannot be compiled with profiling
41GMONOBJEXT=${${MKPIC} != "no":?pico:o}
42mcount.po: mcount.${GMONOBJEXT}
43	cp mcount.${GMONOBJEXT} mcount.po
44
45gmon.po: gmon.${GMONOBJEXT}
46	cp gmon.${GMONOBJEXT} gmon.po
47