xref: /titanic_41/usr/src/cmd/power/Makefile (revision b0fc0e77220f1fa4c933fd58a4e1dedcd650b0f1)
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 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27# cmd/power/Makefile
28#
29
30DAEMON_SRCS =	powerd.c sysstat.c
31DAEMON_OBJS =	$(DAEMON_SRCS:%.c=%.o)
32DAEMON =	powerd
33PMCFG_SRCS = 	conf.c parse.c handlers.c
34PMCFG_OBJS =	$(PMCFG_SRCS:%.c=%.o)
35PMCFG = 	pmconfig
36SRCS = 		$(DAEMON_SRCS) $(PMCFG_SRCS)
37OBJS = 		$(SRCS:%.c=%.o)
38SCRIPTS =	sysidpm.sh
39SYSIDPM = 	sysidpm
40PROG =		$(DAEMON) $(PMCFG) $(SYSIDPM)
41ETCFILES =	power.conf
42POWERPERM =	power
43DEFAULTFILES =	power.dfl
44
45include ../Makefile.cmd
46
47MANIFEST =	power.xml
48
49ROOTMANIFESTDIR =	$(ROOTSVCSYSTEM)
50ROOTMETHOD =	$(ROOTLIBSVCMETHOD)/svc-power
51
52TEXT_DOMAIN=	SUNW_OST_OSCMD
53
54XGETFLAGS +=    -a -x power_all.xcl
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) $($(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
85ROOTUSRSBINSYSIDPM= $(SYSIDPM:%=$(ROOTUSRSBIN)/%)
86$(ROOTUSRSBINSYSIDPM) := FILEMODE= 755
87
88#
89# lint pass one enforcement
90#
91CFLAGS += $(CCVERBOSE)
92
93.PARALLEL: $(OBJS)
94
95.KEEP_STATE:
96
97all: $(PROG) $(POWERPERM).dfl $(ETCFILES) $(SCRIPTS)
98
99install clean:
100
101$(DAEMON_OBJS): $(DAEMON_SRCS)
102	$(CC) $(CFLAGS) -D_REENTRANT $(CPPFLAGS) -o $@ -c $<
103	$(PROCESS_COMMENT) $@
104
105$(DAEMON): $(DAEMON_OBJS)
106	$(CC) -o $@ $(DAEMON_OBJS) $(LDFLAGS) $(DAEMON_LDLIBS)
107	$(POST_PROCESS)
108
109$(PMCFG_OBJS): pmconfig.h
110
111$(PMCFG): $(PMCFG_OBJS)
112	$(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
113	$(POST_PROCESS)
114$(ROOTSVCSYSTEM)/power.xml := OWNER = root
115$(ROOTSVCSYSTEM)/power.xml := GROUP = sys
116$(ROOTSVCSYSTEM)/power.xml := FILEMODE = 0444
117
118$(ROOTLIBSVCMETHOD)/svc-power := OWNER = root
119$(ROOTLIBSVCMETHOD)/svc-power := GROUP = bin
120$(ROOTLIBSVCMETHOD)/svc-power := FILEMODE = 0555
121
122install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) \
123	$(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \
124	$(ROOTMANIFEST) $(ROOTMETHOD)
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)
145	$(RM) $(POFILE) $(POFILES)
146
147lint := LINTFLAGS=-auxn
148lint:
149	$(LINT.c) $(DAEMON_SRCS)
150	$(LINT.c) $(PMCFG_SRCS)
151
152cstyle:
153	$(CSTYLE) $(SRCS)
154
155include ../Makefile.targ
156