xref: /titanic_51/usr/src/cmd/power/Makefile (revision a31148363f598def767ac48c5d82e1572e44b935)
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
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)
93
94.PARALLEL: $(OBJS)
95
96.KEEP_STATE:
97
98all: $(PROG) $(POWERPERM).dfl $(ETCFILES) $(SCRIPTS)
99
100install clean:
101
102$(POWERCONF): $(POWERCONF).$(MACH)
103
104$(DAEMON_OBJS): $(DAEMON_SRCS)
105	$(CC) $(CFLAGS) -D_REENTRANT $(CPPFLAGS) -o $@ -c $<
106	$(PROCESS_COMMENT) $@
107
108$(DAEMON): $(DAEMON_OBJS)
109	$(CC) -o $@ $(DAEMON_OBJS) $(LDFLAGS) $(DAEMON_LDLIBS)
110	$(POST_PROCESS)
111
112$(PMCFG_OBJS): pmconfig.h
113
114$(PMCFG): $(PMCFG_OBJS)
115	$(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
116	$(POST_PROCESS)
117
118$(SUSPEND): $(SUSPEND_OBJS)
119	$(LINK.c) -o $@ $(SUSPEND_OBJS) $(SUSPEND_LDLIBS)
120	$(POST_PROCESS)
121
122install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) $(ROOTUSRBINSUSPEND) \
123	$(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \
124	$(ROOTMANIFEST) $(ROOTSVCMETHOD)
125
126$(ROOTLIBPOWER):
127	$(INS.dir)
128
129$(ROOTLIBPOWER)/%:	%
130	$(INS.file)
131
132$(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
133
134$(OPOFILES):
135	@
136
137$(POFILE):	$(POFILES) $(OPOFILES)
138	$(RM)	$@
139	cat	$(POFILES) $(OPOFILES)	> $@
140
141check:	$(CHKMANIFEST)
142
143clean:
144	$(RM) $(OBJS) $(SYSIDPM) $(POWERCONF)
145	$(RM) $(POFILE) $(POFILES)
146
147lint := LINTFLAGS=-auxn
148lint:
149	$(LINT.c) $(DAEMON_SRCS)
150	$(LINT.c) $(PMCFG_SRCS)
151	$(LINT.c) $(SUSPEND_SRCS)
152
153cstyle:
154	$(CSTYLE) $(SRCS)
155
156%:	%.$(MACH)
157	$(RM) $@
158	cat $< > $@
159
160include ../Makefile.targ
161