xref: /illumos-gate/usr/src/uts/intel/opteron_pcbe/Makefile (revision bd97c7ce2344fa3252d8785c35895490916bc79b)
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 2023 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
42CPCGEN_COMMON	= opteron_pcbe_cpcgen.h
43CPCGEN_CMD	= $(CPCGEN) -d $(SRC)/data/amdpmc -o .
44CPCGEN_SRCS	= $(CPCGEN_OBJS:%.o=%.c) opteron_pcbe_cpcgen.h
45
46
47#
48#	Define module and object file sets.
49#
50MODULE		= pcbe.AuthenticAMD
51OBJECTS		= $(OPTERON_PCBE_OBJS:%=$(OBJS_DIR)/%)
52OBJECTS		+= $(CPCGEN_OBJS:%=$(OBJS_DIR)/%)
53ROOTMODULE	= $(USR_PCBE_DIR)/$(MODULE)
54
55#
56#	Include common rules.
57#
58include $(UTSBASE)/intel/Makefile.intel
59
60CPPFLAGS	+= -I$(UTSBASE)/intel/opteron_pcbe
61CLEANFILES	+= $(CPCGEN_SRCS)
62
63#
64#	Define targets.
65#
66ALL_TARGET	= $(CPCGEN_COMMON) .WAIT $(BINARY)
67INSTALL_TARGET	= $(CPCGEN_COMMON) .WAIT $(BINARY) $(ROOTMODULE)
68
69
70#
71#	Default build targets.
72#
73.KEEP_STATE:
74
75def:		$(DEF_DEPS)
76
77all:		$(ALL_DEPS)
78
79clean:		$(CLEAN_DEPS)
80
81clobber:	$(CLOBBER_DEPS)
82
83install:	$(INSTALL_DEPS)
84
85opteron_pcbe_cpcgen.h:
86	$(CPCGEN_CMD) -a -H
87
88opteron_pcbe_%.c: $(CPCGEN_COMMON)
89	$(CPCGEN_CMD) -c -p \
90	    $$(echo $@ | \
91	    $(SED) -e 's/opteron_pcbe_//g' -e 's/.c$$//g')
92
93$(OBJS_DIR)/%.o: %.c
94	$(COMPILE.c) -I$(SRC)/uts/intel/pcbe/ -o $@ $<
95	$(CTFCONVERT_O)
96
97#
98#	Include common targets.
99#
100include $(UTSBASE)/intel/Makefile.targ
101