xref: /illumos-gate/usr/src/cmd/power/Makefile (revision fae4f9e0b50e2f5af5fce78f508f8669dc2b1e48)
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)
39PROG =		$(DAEMON) $(PMCFG) $(SUSPEND)
40POWERCONF=	power.conf
41ETCFILES =	$(POWERCONF)
42POWERPERM =	power
43DEFAULTFILES =	power.dfl
44
45MANIFEST=	power.xml
46SVCMETHOD=	svc-power
47
48include ../Makefile.cmd
49
50ROOTMANIFESTDIR =	$(ROOTSVCSYSTEM)
51
52TEXT_DOMAIN=	SUNW_OST_OSCMD
53
54XGETFLAGS +=    -a -x power_all.xcl
55POFILE=		power_all.po
56POFILES=	$(PMCFG_SRCS:%.c=%.po) $(SUSPEND_SRCS:%.c=%.po)
57
58# pmconfig only needs libdevinfo on sparc
59sparc_LDEVINFO=	-ldevinfo -lefi -ladm -lzfs -lnvpair
60i386_LDEVINFO=
61
62LDEVINFO=	-ldevinfo
63
64DAEMON_LDLIBS =	$(LDLIBS.cmd) -lkstat $(LDEVINFO)
65PMCFG_LDLIBS =	$(LDLIBS.cmd) -lsmbios -lkstat $($(MACH)_LDEVINFO)
66SUSPEND_LDLIBS = $(LDLIBS.cmd) -lbsm -lpam -lsecdb
67
68ROOTUSRSBINPMCFG= $(PMCFG:%=$(ROOTUSRSBIN)/%)
69$(ROOTUSRSBINPMCFG) := FILEMODE= 4555
70ROOTUSRBINSUSPEND= $(SUSPEND:%=$(ROOTBIN)/%)
71$(ROOTUSRBINSUSPEND) := FILEMODE= 4555
72
73ROOTLIBPOWER= $(ROOTLIB)/power
74ROOTLIBPOWERDAEMON= $(DAEMON:%=$(ROOTLIBPOWER)/%)
75$(ROOTLIBPOWER) := FILEMODE= 755
76$(ROOTLIBPOWERDAEMON) := FILEMODE= 555
77
78ROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%)
79$(ROOTETCFILES) := FILEMODE= 644
80
81#
82# lint pass one enforcement
83#
84CFLAGS += $(CCVERBOSE)
85
86.PARALLEL: $(OBJS)
87
88.KEEP_STATE:
89
90all: $(PROG) $(POWERPERM).dfl $(ETCFILES)
91
92install clean:
93
94$(POWERCONF): $(POWERCONF).$(MACH)
95
96$(DAEMON_OBJS): $(DAEMON_SRCS)
97	$(CC) $(CFLAGS) -D_REENTRANT $(CPPFLAGS) -o $@ -c $<
98	$(PROCESS_COMMENT) $@
99
100$(DAEMON): $(DAEMON_OBJS)
101	$(CC) -o $@ $(DAEMON_OBJS) $(LDFLAGS) $(DAEMON_LDLIBS)
102	$(POST_PROCESS)
103
104$(PMCFG_OBJS): pmconfig.h
105
106$(PMCFG): $(PMCFG_OBJS)
107	$(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
108	$(POST_PROCESS)
109
110$(SUSPEND): $(SUSPEND_OBJS)
111	$(LINK.c) -o $@ $(SUSPEND_OBJS) $(SUSPEND_LDLIBS)
112	$(POST_PROCESS)
113
114install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) $(ROOTUSRBINSUSPEND) \
115	$(ROOTETCFILES) $(ROOTETCDEFAULTFILES) \
116	$(ROOTMANIFEST) $(ROOTSVCMETHOD)
117
118$(ROOTLIBPOWER):
119	$(INS.dir)
120
121$(ROOTLIBPOWER)/%:	%
122	$(INS.file)
123
124$(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
125
126$(POFILE):	$(POFILES)
127	$(RM)	$@
128	cat	$(POFILES)	> $@
129
130check:	$(CHKMANIFEST)
131
132clean:
133	$(RM) $(OBJS) $(POWERCONF)
134	$(RM) $(POFILE) $(POFILES)
135
136lint := LINTFLAGS=-auxn
137lint:
138	$(LINT.c) $(DAEMON_SRCS)
139	$(LINT.c) $(PMCFG_SRCS)
140	$(LINT.c) $(SUSPEND_SRCS)
141
142cstyle:
143	$(CSTYLE) $(SRCS)
144
145%:	%.$(MACH)
146	$(RM) $@
147	cat $< > $@
148
149include ../Makefile.targ
150