xref: /titanic_44/usr/src/cmd/power/Makefile (revision 0dee7919e2f2a6479d16b370af93747b9416b242)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# cmd/power/Makefile
29#
30#
31
32DAEMON_SRCS =	powerd.c sysstat.c
33DAEMON_OBJS =	$(DAEMON_SRCS:%.c=%.o)
34DAEMON =	powerd
35PMCFG_SRCS = 	conf.c parse.c handlers.c
36PMCFG_OBJS =	$(PMCFG_SRCS:%.c=%.o)
37PMCFG = 	pmconfig
38SRCS = 		$(DAEMON_SRCS) $(PMCFG_SRCS)
39OBJS = 		$(SRCS:%.c=%.o)
40SCRIPTS =	sysidpm.sh
41SYSIDPM = 	sysidpm
42PROG =		$(DAEMON) $(PMCFG) $(SYSIDPM)
43ETCFILES =	power.conf
44POWERPERM =	power
45DEFAULTFILES =	power.dfl
46
47include ../Makefile.cmd
48
49MANIFEST =	power.xml
50
51ROOTMANIFESTDIR =	$(ROOTSVCSYSTEM)
52ROOTMETHOD =	$(ROOTLIBSVCMETHOD)/svc-power
53
54TEXT_DOMAIN=	SUNW_OST_OSCMD
55
56POFILE=		power_all.po
57POFILES=	$(PMCFG_SRCS:%.c=%.po)
58# needed because POFILES is deleted by clobber, but it's under
59# SCCS control here.
60OPOFILES=	sysidpm.po
61
62#
63# we only need libdevinfo on sparc
64sparc_LDEVINFO=	-ldevinfo
65i386_LDEVINFO=
66
67DAEMON_LDLIBS =	$(LDLIBS.cmd) -lkstat $($(MACH)_LDEVINFO)
68PMCFG_LDLIBS =	$(LDLIBS.cmd) -lcmd $($(MACH)_LDEVINFO)
69
70OWNER= root
71ROOTUSRSBINPMCFG= $(PMCFG:%=$(ROOTUSRSBIN)/%)
72$(ROOTUSRSBINPMCFG) := GROUP= bin
73$(ROOTUSRSBINPMCFG) := FILEMODE= 4555
74
75GROUP= sys
76ROOTLIBPOWER= $(ROOTLIB)/power
77ROOTLIBPOWERDAEMON= $(DAEMON:%=$(ROOTLIBPOWER)/%)
78$(ROOTLIBPOWER) := GROUP= sys
79$(ROOTLIBPOWER) := FILEMODE= 755
80$(ROOTLIBPOWERDAEMON) := GROUP= bin
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$(DAEMON_OBJS): $(DAEMON_SRCS)
103	$(CC) $(CFLAGS) -D_REENTRANT $(CPPFLAGS) -o $@ -c $<
104	$(PROCESS_COMMENT) $@
105
106$(DAEMON): $(DAEMON_OBJS)
107	$(CC) -o $@ $(DAEMON_OBJS) $(LDFLAGS) $(DAEMON_LDLIBS)
108	$(POST_PROCESS)
109
110$(PMCFG_OBJS): pmconfig.h
111
112$(PMCFG): $(PMCFG_OBJS)
113	$(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
114	$(POST_PROCESS)
115$(ROOTSVCSYSTEM)/power.xml := OWNER = root
116$(ROOTSVCSYSTEM)/power.xml := GROUP = sys
117$(ROOTSVCSYSTEM)/power.xml := FILEMODE = 0444
118
119$(ROOTLIBSVCMETHOD)/svc-power := OWNER = root
120$(ROOTLIBSVCMETHOD)/svc-power := GROUP = bin
121$(ROOTLIBSVCMETHOD)/svc-power := FILEMODE = 0555
122
123install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) \
124	$(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \
125	$(ROOTMANIFEST) $(ROOTMETHOD)
126
127$(ROOTLIBPOWER):
128	$(INS.dir)
129
130$(ROOTLIBPOWER)/%:	%
131	$(INS.file)
132
133$(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
134
135$(OPOFILES):
136	@
137
138$(POFILE):	$(POFILES) $(OPOFILES)
139	$(RM)	$@
140	cat	$(POFILES) $(OPOFILES)	> $@
141
142check:	$(CHKMANIFEST)
143
144clean:
145	$(RM) $(OBJS) $(SYSIDPM)
146	$(RM) $(POFILE) $(POFILES)
147
148lint := LINTFLAGS=-auxn
149lint:
150	$(LINT.c) $(DAEMON_SRCS)
151	$(LINT.c) $(PMCFG_SRCS)
152
153cstyle:
154	$(CSTYLE) $(SRCS)
155
156include ../Makefile.targ
157