xref: /freebsd/lib/libpmc/Makefile (revision d5be41beb7c44119730791d92782d8e77174d312)
1# $FreeBSD$
2
3LIB=	pmc
4
5SRCS=	libpmc.c pmclog.c libpmc_pmu_util.c libpmc_json.cc
6INCS=	pmc.h pmclog.h pmcformat.h
7
8CFLAGS+= -I${SRCTOP}/${RELDIR:H}/libpmcstat
9LDADD+=	-lc++
10
11.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_ARCH} == "amd64" || \
12    ${MACHINE_ARCH} == "i386"
13
14.if ${MACHINE_CPUARCH} == "aarch64"
15EVENT_ARCH="arm64"
16.elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
17EVENT_ARCH="x86"
18.elif ${MACHINE_ARCH} == "powerpc"
19EVENT_ARCH="powerpc"
20.endif
21
22.if ${MK_DIRDEPS_BUILD} == "yes"
23# avoid circular dependency
24GENDIRDEPS_FILTER+= N${RELDIR:H}/libpmcstat
25JEVENTS?= ${HOST_OBJTOP}/${RELDIR}/pmu-events/jevents
26.else
27JEVENTS= ${BTOOLSPATH:U.}/pmu-events/jevents
28
29# This file is built in a subdirectory so never try to rebuild it here.
30${JEVENTS}: .PHONY
31.if make(*clean*)
32SUBDIR+= pmu-events
33.endif
34.endif
35
36libpmc_events.c: ${JEVENTS} .META
37	${JEVENTS} ${EVENT_ARCH} ${.CURDIR}/pmu-events/arch ${.TARGET}.tmp
38	if [ ! -e ${.TARGET} ] || ! cmp -s ${.TARGET} ${.TARGET}.tmp; then \
39		mv -f ${.TARGET}.tmp ${.TARGET}; \
40	fi
41CLEANFILES+=	libpmc_events.c libpmc_events.c.tmp
42SRCS+=	libpmc_events.c
43.endif
44
45WARNS?=	3
46
47CFLAGS+= -I${.CURDIR}
48CWARNFLAGS.gcc+= -Wno-shadow -Wno-cast-align
49
50# Silence warnings about usage of deprecated std::auto_ptr
51CXXWARNFLAGS+=	-Wno-deprecated-declarations
52
53MAN=	pmc.3
54MAN+=	pmc_allocate.3
55MAN+=	pmc_attach.3
56MAN+=	pmc_capabilities.3
57MAN+=	pmc_configure_logfile.3
58MAN+=	pmc_disable.3
59MAN+=	pmc_event_names_of_class.3
60MAN+=	pmc_get_driver_stats.3
61MAN+=	pmc_get_msr.3
62MAN+=	pmc_init.3
63MAN+=	pmc_name_of_capability.3
64MAN+=	pmc_read.3
65MAN+=	pmc_set.3
66MAN+=	pmc_start.3
67MAN+=	pmclog.3
68MAN+=	pmc.soft.3
69
70# PMC-dependent manual pages
71MAN+=	pmc.atom.3
72MAN+=	pmc.atomsilvermont.3
73MAN+=	pmc.core.3
74MAN+=	pmc.core2.3
75MAN+=	pmc.corei7.3
76MAN+=	pmc.corei7uc.3
77MAN+=	pmc.haswell.3
78MAN+=	pmc.haswelluc.3
79MAN+=	pmc.haswellxeon.3
80MAN+=	pmc.iaf.3
81MAN+=	pmc.ivybridge.3
82MAN+=	pmc.ivybridgexeon.3
83MAN+=	pmc.k7.3
84MAN+=	pmc.k8.3
85MAN+=	pmc.mips24k.3
86MAN+=	pmc.octeon.3
87MAN+=	pmc.p4.3
88MAN+=	pmc.p5.3
89MAN+=	pmc.p6.3
90MAN+=	pmc.sandybridge.3
91MAN+=	pmc.sandybridgeuc.3
92MAN+=	pmc.sandybridgexeon.3
93MAN+=	pmc.tsc.3
94MAN+=	pmc.ucf.3
95MAN+=	pmc.westmere.3
96MAN+=	pmc.westmereuc.3
97
98MLINKS+= \
99	pmc_allocate.3 pmc_release.3 \
100	pmc_attach.3 pmc_detach.3 \
101	pmc_capabilities.3 pmc_ncpu.3 \
102	pmc_capabilities.3 pmc_npmc.3 \
103	pmc_capabilities.3 pmc_pmcinfo.3 \
104	pmc_capabilities.3 pmc_cpuinfo.3 \
105	pmc_capabilities.3 pmc_width.3 \
106	pmc_configure_logfile.3 pmc_flush_logfile.3 \
107	pmc_configure_logfile.3 pmc_writelog.3 \
108	pmc_disable.3 pmc_enable.3 \
109	pmc_name_of_capability.3 pmc_name_of_class.3 \
110	pmc_name_of_capability.3 pmc_name_of_cputype.3 \
111	pmc_name_of_capability.3 pmc_name_of_disposition.3 \
112	pmc_name_of_capability.3 pmc_name_of_event.3 \
113	pmc_name_of_capability.3 pmc_name_of_mode.3 \
114	pmc_name_of_capability.3 pmc_name_of_state.3 \
115	pmc_read.3 pmc_rw.3 \
116	pmc_read.3 pmc_write.3 \
117	pmc_start.3 pmc_stop.3
118
119MLINKS+= \
120	pmclog.3 pmclog_open.3 \
121	pmclog.3 pmclog_close.3 \
122	pmclog.3 pmclog_feed.3 \
123	pmclog.3 pmclog_read.3
124
125.include <bsd.lib.mk>
126