1#
2# CDDL HEADER START
3#
4# The contents of this file are subject to the terms of the
5# Common Development and Distribution License (the "License").
6# You may not use this file except in compliance with the License.
7#
8# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9# or http://www.opensolaris.org/os/licensing.
10# See the License for the specific language governing permissions
11# and limitations under the License.
12#
13# When distributing Covered Code, include this CDDL HEADER in each
14# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15# If applicable, add the following below this CDDL HEADER, with the
16# fields enclosed by brackets "[]" replaced with your own identifying
17# information: Portions Copyright [yyyy] [name of copyright owner]
18#
19# CDDL HEADER END
20#
21#
22# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24# Copyright 2019 Joyent, Inc.
25# Copyright 2024 Oxide Computer Company
26#
27#
28# This Makefile builds the AMD Opteron/Athlon64 Performance Counter BackEnd.
29#
30
31UTSBASE = ../..
32
33#
34# The following objects are autogenerated by cpcgen.
35#
36CPCGEN_OBJS	= \
37	opteron_pcbe_f17h_zen1.o \
38	opteron_pcbe_f17h_zen2.o \
39	opteron_pcbe_f19h_zen3.o \
40	opteron_pcbe_f19h_zen4.o \
41	opteron_pcbe_f1ah_zen5.o
42
43CPCGEN_COMMON	= opteron_pcbe_cpcgen.h
44CPCGEN_CMD	= $(CPCGEN) -d $(SRC)/data/amdpmc -o .
45CPCGEN_SRCS	= $(CPCGEN_OBJS:%.o=%.c) opteron_pcbe_cpcgen.h
46
47
48#
49#	Define module and object file sets.
50#
51MODULE		= pcbe.AuthenticAMD
52OBJECTS		= $(OPTERON_PCBE_OBJS:%=$(OBJS_DIR)/%)
53OBJECTS		+= $(CPCGEN_OBJS:%=$(OBJS_DIR)/%)
54ROOTMODULE	= $(USR_PCBE_DIR)/$(MODULE)
55
56#
57#	Include common rules.
58#
59include $(UTSBASE)/intel/Makefile.intel
60
61CPPFLAGS	+= -I$(UTSBASE)/intel/opteron_pcbe
62CLEANFILES	+= $(CPCGEN_SRCS)
63
64#
65#	Define targets.
66#
67ALL_TARGET	= $(CPCGEN_COMMON) .WAIT $(BINARY)
68INSTALL_TARGET	= $(CPCGEN_COMMON) .WAIT $(BINARY) $(ROOTMODULE)
69
70
71#
72#	Default build targets.
73#
74.KEEP_STATE:
75
76def:		$(DEF_DEPS)
77
78all:		$(ALL_DEPS)
79
80clean:		$(CLEAN_DEPS)
81
82clobber:	$(CLOBBER_DEPS)
83
84install:	$(INSTALL_DEPS)
85
86opteron_pcbe_cpcgen.h:
87	$(CPCGEN_CMD) -a -H
88
89opteron_pcbe_%.c: $(CPCGEN_COMMON)
90	$(CPCGEN_CMD) -c -p \
91	    $$(echo $@ | \
92	    $(SED) -e 's/opteron_pcbe_//g' -e 's/.c$$//g')
93
94$(OBJS_DIR)/%.o: %.c
95	$(COMPILE.c) -I$(SRC)/uts/intel/pcbe/ -o $@ $<
96	$(CTFCONVERT_O)
97
98#
99#	Include common targets.
100#
101include $(UTSBASE)/intel/Makefile.targ
102