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