xref: /illumos-gate/usr/src/cmd/ucodeadm/Makefile (revision d3b5f56344d8bfcdd6cfb82446af0e5e55ad9ebe)
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#
25# Copyright 2017 RackTop Systems.
26#
27
28PROG = ucodeadm
29
30PROG_OBJS = ucodeadm.o ucode_errno.o
31COMMON_OBJS = ucode_utils.o
32OBJS = $(PROG_OBJS) $(COMMON_OBJS)
33COMMON_SRCDIR = ../../common/ucode
34ERROR_HEADER = $(COMMON_SRCDIR)/ucode_errno.h
35SRCS = $(PROG_OBJS:%.o=%.c) $(COMMON_OBJS:%.o=$(COMMON_SRCDIR)/%.c)
36
37include	../Makefile.cmd
38
39POFILE = ucodeadm_all.po
40POFILES = $(PROG_OBJS:%.o=%.po)
41
42INTEL_UCODE_FILE = intel-ucode.txt
43AMD_UCODE_FILE = amd-ucode.bin
44
45ROOTUCODEPATH = $(ROOT)/platform/i86pc/ucode
46ROOTINTELUCODE = $(INTEL_UCODE_FILE:%=$(ROOTUCODEPATH)/%)
47ROOTAMDUCODE = $(AMD_UCODE_FILE:%=$(ROOTUCODEPATH)/%)
48
49CPPFLAGS = -I../../common -I../../uts/common
50CFLAGS	+= $(CCVERBOSE)
51CERRWARN += $(CNOWARN_UNINIT)
52CERRWARN += -_gcc=-Wno-type-limits
53LINTFLAGS += -errtags -erroff=E_NAME_DEF_NOT_USED2
54LINTFLAGS += -erroff=E_INCONS_ARG_DECL2,E_INCONS_VAL_TYPE_DECL2
55LDLIBS += -lgen
56
57DIRMODE = 0755
58FILEMODE = 0555
59
60$(ROOTINTELUCODE) := FILEMODE = 0444
61$(ROOTAMDUCODE) := FILEMODE = 0444
62
63install := TARGET = install
64clobber := TARGET = clobber
65
66CLEANFILES += $(PROG) $(OBJS) ucode_errno.c $(POFILES) $(POFILE)
67
68.KEEP_STATE:
69
70all: $(PROG)
71
72install: all $(ROOTUSRSBINPROG) $(ROOTUCODEPATH) $(ROOTINTELUCODE) $(ROOTAMDUCODE)
73
74_msg: ucodeadm_all.po
75
76%.o: $(COMMON_SRCDIR)/%.c
77	$(COMPILE.c) -o $@ $<
78	$(POST_PROCESS_O)
79
80$(PROG): $(OBJS) ucode_errno.c
81	$(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS)
82	$(POST_PROCESS)
83
84$(ROOTUCODEPATH):
85	$(INS.dir)
86
87$(ROOTUCODEPATH)/%: %
88	$(INS.file)
89
90clean:
91	-$(RM) $(CLEANFILES)
92
93lint:	lint_SRCS
94
95
96include	../Makefile.targ
97
98ucode_errno.c: $(COMMON_SRCDIR)/mkerrno.sh $(ERROR_HEADER)
99	sh $(COMMON_SRCDIR)/mkerrno.sh $(ERROR_HEADER) > $@
100
101ucode_errno.po := XGETFLAGS += -a
102
103$(POFILE): $(POFILES)
104	$(RM) $@
105	$(CAT) $(POFILES) > $@
106
107FRC:
108