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