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