xref: /titanic_41/usr/src/cmd/power/Makefile (revision 3125ebfc35130d243e775dc38a6a59be4df0b137)
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
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)
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
115install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) \
116	$(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \
117	$(ROOTMANIFEST) $(ROOTSVCMETHOD)
118
119$(ROOTLIBPOWER):
120	$(INS.dir)
121
122$(ROOTLIBPOWER)/%:	%
123	$(INS.file)
124
125$(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
126
127$(OPOFILES):
128	@
129
130$(POFILE):	$(POFILES) $(OPOFILES)
131	$(RM)	$@
132	cat	$(POFILES) $(OPOFILES)	> $@
133
134check:	$(CHKMANIFEST)
135
136clean:
137	$(RM) $(OBJS) $(SYSIDPM)
138	$(RM) $(POFILE) $(POFILES)
139
140lint := LINTFLAGS=-auxn
141lint:
142	$(LINT.c) $(DAEMON_SRCS)
143	$(LINT.c) $(PMCFG_SRCS)
144
145cstyle:
146	$(CSTYLE) $(SRCS)
147
148include ../Makefile.targ
149