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