xref: /titanic_44/usr/src/cmd/power/Makefile (revision 18c2aff776a775d34a4c9893a4c72e0434d68e36)
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
56XGETFLAGS +=    -a -x power_all.xcl
57POFILE=		power_all.po
58POFILES=	$(PMCFG_SRCS:%.c=%.po)
59# needed because POFILES is deleted by clobber, but it's under
60# SCCS control here.
61OPOFILES=	sysidpm.po
62
63#
64# we only need libdevinfo on sparc
65sparc_LDEVINFO=	-ldevinfo
66i386_LDEVINFO=
67
68DAEMON_LDLIBS =	$(LDLIBS.cmd) -lkstat $($(MACH)_LDEVINFO)
69PMCFG_LDLIBS =	$(LDLIBS.cmd) -lcmd $($(MACH)_LDEVINFO)
70
71OWNER= root
72ROOTUSRSBINPMCFG= $(PMCFG:%=$(ROOTUSRSBIN)/%)
73$(ROOTUSRSBINPMCFG) := GROUP= bin
74$(ROOTUSRSBINPMCFG) := FILEMODE= 4555
75
76GROUP= sys
77ROOTLIBPOWER= $(ROOTLIB)/power
78ROOTLIBPOWERDAEMON= $(DAEMON:%=$(ROOTLIBPOWER)/%)
79$(ROOTLIBPOWER) := GROUP= sys
80$(ROOTLIBPOWER) := FILEMODE= 755
81$(ROOTLIBPOWERDAEMON) := GROUP= bin
82$(ROOTLIBPOWERDAEMON) := FILEMODE= 555
83
84ROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%)
85$(ROOTETCFILES) := FILEMODE= 644
86
87ROOTUSRSBINSYSIDPM= $(SYSIDPM:%=$(ROOTUSRSBIN)/%)
88$(ROOTUSRSBINSYSIDPM) := FILEMODE= 755
89
90#
91# lint pass one enforcement
92#
93CFLAGS += $(CCVERBOSE)
94
95.PARALLEL: $(OBJS)
96
97.KEEP_STATE:
98
99all: $(PROG) $(POWERPERM).dfl $(ETCFILES) $(SCRIPTS)
100
101install clean:
102
103$(DAEMON_OBJS): $(DAEMON_SRCS)
104	$(CC) $(CFLAGS) -D_REENTRANT $(CPPFLAGS) -o $@ -c $<
105	$(PROCESS_COMMENT) $@
106
107$(DAEMON): $(DAEMON_OBJS)
108	$(CC) -o $@ $(DAEMON_OBJS) $(LDFLAGS) $(DAEMON_LDLIBS)
109	$(POST_PROCESS)
110
111$(PMCFG_OBJS): pmconfig.h
112
113$(PMCFG): $(PMCFG_OBJS)
114	$(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
115	$(POST_PROCESS)
116$(ROOTSVCSYSTEM)/power.xml := OWNER = root
117$(ROOTSVCSYSTEM)/power.xml := GROUP = sys
118$(ROOTSVCSYSTEM)/power.xml := FILEMODE = 0444
119
120$(ROOTLIBSVCMETHOD)/svc-power := OWNER = root
121$(ROOTLIBSVCMETHOD)/svc-power := GROUP = bin
122$(ROOTLIBSVCMETHOD)/svc-power := FILEMODE = 0555
123
124install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) \
125	$(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \
126	$(ROOTMANIFEST) $(ROOTMETHOD)
127
128$(ROOTLIBPOWER):
129	$(INS.dir)
130
131$(ROOTLIBPOWER)/%:	%
132	$(INS.file)
133
134$(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
135
136$(OPOFILES):
137	@
138
139$(POFILE):	$(POFILES) $(OPOFILES)
140	$(RM)	$@
141	cat	$(POFILES) $(OPOFILES)	> $@
142
143check:	$(CHKMANIFEST)
144
145clean:
146	$(RM) $(OBJS) $(SYSIDPM)
147	$(RM) $(POFILE) $(POFILES)
148
149lint := LINTFLAGS=-auxn
150lint:
151	$(LINT.c) $(DAEMON_SRCS)
152	$(LINT.c) $(PMCFG_SRCS)
153
154cstyle:
155	$(CSTYLE) $(SRCS)
156
157include ../Makefile.targ
158