xref: /illumos-gate/usr/src/cmd/power/Makefile (revision d583b39bfb4e2571d3e41097c5c357ffe353ad45)
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# cmd/power/Makefile
26#
27
28DAEMON_SRCS =	powerd.c sysstat.c
29DAEMON_OBJS =	$(DAEMON_SRCS:%.c=%.o)
30DAEMON =	powerd
31PMCFG_SRCS = 	conf.c parse.c handlers.c
32PMCFG_OBJS =	$(PMCFG_SRCS:%.c=%.o)
33PMCFG = 	pmconfig
34SUSPEND_SRCS = 	sys-suspend.c pm_pam_conv.c
35SUSPEND_OBJS =	$(SUSPEND_SRCS:%.c=%.o)
36SUSPEND = 	sys-suspend
37SRCS = 		$(DAEMON_SRCS) $(PMCFG_SRCS) $(SUSPEND_SRCS)
38OBJS = 		$(SRCS:%.c=%.o)
39SCRIPTS =	sysidpm.sh
40SYSIDPM = 	sysidpm
41PROG =		$(DAEMON) $(PMCFG) $(SYSIDPM) $(SUSPEND)
42POWERCONF=	power.conf
43ETCFILES =	$(POWERCONF)
44POWERPERM =	power
45DEFAULTFILES =	power.dfl
46
47MANIFEST=	power.xml
48SVCMETHOD=	svc-power
49
50include ../Makefile.cmd
51
52ROOTMANIFESTDIR =	$(ROOTSVCSYSTEM)
53
54TEXT_DOMAIN=	SUNW_OST_OSCMD
55
56XGETFLAGS +=    -a -x power_all.xcl
57POFILE=		power_all.po
58POFILES=	$(PMCFG_SRCS:%.c=%.po) $(SUSPEND_SRCS:%.c=%.po)
59# needed because POFILES is deleted by clobber, but it's under
60# SCCS control here.
61OPOFILES=	sysidpm.po
62
63# pmconfig only needs libdevinfo on sparc
64sparc_LDEVINFO=	-ldevinfo -lefi -ladm -lzfs -lnvpair
65i386_LDEVINFO=
66
67LDEVINFO=	-ldevinfo
68
69DAEMON_LDLIBS =	$(LDLIBS.cmd) -lkstat $(LDEVINFO)
70PMCFG_LDLIBS =	$(LDLIBS.cmd) -lsmbios -lkstat $($(MACH)_LDEVINFO)
71SUSPEND_LDLIBS = $(LDLIBS.cmd) -lbsm -lpam -lsecdb
72
73ROOTUSRSBINPMCFG= $(PMCFG:%=$(ROOTUSRSBIN)/%)
74$(ROOTUSRSBINPMCFG) := FILEMODE= 4555
75ROOTUSRBINSUSPEND= $(SUSPEND:%=$(ROOTBIN)/%)
76$(ROOTUSRBINSUSPEND) := FILEMODE= 4555
77
78ROOTLIBPOWER= $(ROOTLIB)/power
79ROOTLIBPOWERDAEMON= $(DAEMON:%=$(ROOTLIBPOWER)/%)
80$(ROOTLIBPOWER) := FILEMODE= 755
81$(ROOTLIBPOWERDAEMON) := FILEMODE= 555
82
83ROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%)
84$(ROOTETCFILES) := FILEMODE= 644
85
86ROOTUSRSBINSYSIDPM= $(SYSIDPM:%=$(ROOTUSRSBIN)/%)
87$(ROOTUSRSBINSYSIDPM) := FILEMODE= 755
88
89#
90# lint pass one enforcement
91#
92CFLAGS += $(CCVERBOSE)
93CERRWARN += -_gcc=-Wno-parentheses
94CERRWARN += -_gcc=-Wno-uninitialized
95CERRWARN += -_gcc=-Wno-unused-value
96
97.PARALLEL: $(OBJS)
98
99.KEEP_STATE:
100
101all: $(PROG) $(POWERPERM).dfl $(ETCFILES) $(SCRIPTS)
102
103install clean:
104
105$(POWERCONF): $(POWERCONF).$(MACH)
106
107$(DAEMON_OBJS): $(DAEMON_SRCS)
108	$(CC) $(CFLAGS) -D_REENTRANT $(CPPFLAGS) -o $@ -c $<
109	$(PROCESS_COMMENT) $@
110
111$(DAEMON): $(DAEMON_OBJS)
112	$(CC) -o $@ $(DAEMON_OBJS) $(LDFLAGS) $(DAEMON_LDLIBS)
113	$(POST_PROCESS)
114
115$(PMCFG_OBJS): pmconfig.h
116
117$(PMCFG): $(PMCFG_OBJS)
118	$(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
119	$(POST_PROCESS)
120
121$(SUSPEND): $(SUSPEND_OBJS)
122	$(LINK.c) -o $@ $(SUSPEND_OBJS) $(SUSPEND_LDLIBS)
123	$(POST_PROCESS)
124
125install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) $(ROOTUSRBINSUSPEND) \
126	$(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \
127	$(ROOTMANIFEST) $(ROOTSVCMETHOD)
128
129$(ROOTLIBPOWER):
130	$(INS.dir)
131
132$(ROOTLIBPOWER)/%:	%
133	$(INS.file)
134
135$(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
136
137$(OPOFILES):
138	@
139
140$(POFILE):	$(POFILES) $(OPOFILES)
141	$(RM)	$@
142	cat	$(POFILES) $(OPOFILES)	> $@
143
144check:	$(CHKMANIFEST)
145
146clean:
147	$(RM) $(OBJS) $(SYSIDPM) $(POWERCONF)
148	$(RM) $(POFILE) $(POFILES)
149
150lint := LINTFLAGS=-auxn
151lint:
152	$(LINT.c) $(DAEMON_SRCS)
153	$(LINT.c) $(PMCFG_SRCS)
154	$(LINT.c) $(SUSPEND_SRCS)
155
156cstyle:
157	$(CSTYLE) $(SRCS)
158
159%:	%.$(MACH)
160	$(RM) $@
161	cat $< > $@
162
163include ../Makefile.targ
164