xref: /titanic_50/usr/src/cmd/power/Makefile (revision 753a6d457b330b1b29b2d3eefcd0831116ce950d)
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) -lcmd -lsmbios -lkstat $($(MACH)_LDEVINFO)
71SUSPEND_LDLIBS = $(LDLIBS.cmd) -lbsm -lpam -lsecdb
72
73OWNER= root
74ROOTUSRSBINPMCFG= $(PMCFG:%=$(ROOTUSRSBIN)/%)
75$(ROOTUSRSBINPMCFG) := GROUP= bin
76$(ROOTUSRSBINPMCFG) := FILEMODE= 4555
77ROOTUSRBINSUSPEND= $(SUSPEND:%=$(ROOTBIN)/%)
78$(ROOTUSRBINSUSPEND) := GROUP= bin
79$(ROOTUSRBINSUSPEND) := FILEMODE= 4555
80
81GROUP= sys
82ROOTLIBPOWER= $(ROOTLIB)/power
83ROOTLIBPOWERDAEMON= $(DAEMON:%=$(ROOTLIBPOWER)/%)
84$(ROOTLIBPOWER) := GROUP= sys
85$(ROOTLIBPOWER) := FILEMODE= 755
86$(ROOTLIBPOWERDAEMON) := GROUP= bin
87$(ROOTLIBPOWERDAEMON) := FILEMODE= 555
88
89ROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%)
90$(ROOTETCFILES) := FILEMODE= 644
91
92ROOTUSRSBINSYSIDPM= $(SYSIDPM:%=$(ROOTUSRSBIN)/%)
93$(ROOTUSRSBINSYSIDPM) := FILEMODE= 755
94
95#
96# lint pass one enforcement
97#
98CFLAGS += $(CCVERBOSE)
99
100.PARALLEL: $(OBJS)
101
102.KEEP_STATE:
103
104all: $(PROG) $(POWERPERM).dfl $(ETCFILES) $(SCRIPTS)
105
106install clean:
107
108$(POWERCONF): $(POWERCONF).$(MACH)
109
110$(DAEMON_OBJS): $(DAEMON_SRCS)
111	$(CC) $(CFLAGS) -D_REENTRANT $(CPPFLAGS) -o $@ -c $<
112	$(PROCESS_COMMENT) $@
113
114$(DAEMON): $(DAEMON_OBJS)
115	$(CC) -o $@ $(DAEMON_OBJS) $(LDFLAGS) $(DAEMON_LDLIBS)
116	$(POST_PROCESS)
117
118$(PMCFG_OBJS): pmconfig.h
119
120$(PMCFG): $(PMCFG_OBJS)
121	$(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
122	$(POST_PROCESS)
123
124$(SUSPEND): $(SUSPEND_OBJS)
125	$(LINK.c) -o $@ $(SUSPEND_OBJS) $(SUSPEND_LDLIBS)
126	$(POST_PROCESS)
127
128install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) $(ROOTUSRBINSUSPEND) \
129	$(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \
130	$(ROOTMANIFEST) $(ROOTSVCMETHOD)
131
132$(ROOTLIBPOWER):
133	$(INS.dir)
134
135$(ROOTLIBPOWER)/%:	%
136	$(INS.file)
137
138$(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
139
140$(OPOFILES):
141	@
142
143$(POFILE):	$(POFILES) $(OPOFILES)
144	$(RM)	$@
145	cat	$(POFILES) $(OPOFILES)	> $@
146
147check:	$(CHKMANIFEST)
148
149clean:
150	$(RM) $(OBJS) $(SYSIDPM) $(POWERCONF)
151	$(RM) $(POFILE) $(POFILES)
152
153lint := LINTFLAGS=-auxn
154lint:
155	$(LINT.c) $(DAEMON_SRCS)
156	$(LINT.c) $(PMCFG_SRCS)
157	$(LINT.c) $(SUSPEND_SRCS)
158
159cstyle:
160	$(CSTYLE) $(SRCS)
161
162%:	%.$(MACH)
163	$(RM) $@
164	cat $< > $@
165
166include ../Makefile.targ
167