xref: /titanic_51/usr/src/cmd/power/Makefile (revision 60c45ed01d4f99571d468c42f609d11a099fab1e)
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 2008 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)
41POWERCONF=	power.conf
42ETCFILES =	$(POWERCONF)
43POWERPERM =	power
44DEFAULTFILES =	power.dfl
45
46MANIFEST=	power.xml
47SVCMETHOD=	svc-power
48
49include ../Makefile.cmd
50
51ROOTMANIFESTDIR =	$(ROOTSVCSYSTEM)
52
53TEXT_DOMAIN=	SUNW_OST_OSCMD
54
55XGETFLAGS +=    -a -x power_all.xcl
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# pmconfig only needs libdevinfo on sparc
63sparc_LDEVINFO=	-ldevinfo -lefi -ladm -lzfs -lnvpair
64i386_LDEVINFO=
65
66LDEVINFO=	-ldevinfo
67
68DAEMON_LDLIBS =	$(LDLIBS.cmd) -lkstat $(LDEVINFO)
69PMCFG_LDLIBS =	$(LDLIBS.cmd) -lcmd -lsmbios -lkstat $($(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$(POWERCONF): $(POWERCONF).$(MACH)
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
119install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) \
120	$(ROOTETCFILES) $(ROOTUSRSBINSYSIDPM) $(ROOTETCDEFAULTFILES) \
121	$(ROOTMANIFEST) $(ROOTSVCMETHOD)
122
123$(ROOTLIBPOWER):
124	$(INS.dir)
125
126$(ROOTLIBPOWER)/%:	%
127	$(INS.file)
128
129$(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
130
131$(OPOFILES):
132	@
133
134$(POFILE):	$(POFILES) $(OPOFILES)
135	$(RM)	$@
136	cat	$(POFILES) $(OPOFILES)	> $@
137
138check:	$(CHKMANIFEST)
139
140clean:
141	$(RM) $(OBJS) $(SYSIDPM) $(POWERCONF)
142	$(RM) $(POFILE) $(POFILES)
143
144lint := LINTFLAGS=-auxn
145lint:
146	$(LINT.c) $(DAEMON_SRCS)
147	$(LINT.c) $(PMCFG_SRCS)
148
149cstyle:
150	$(CSTYLE) $(SRCS)
151
152%:	%.$(MACH)
153	$(RM) $@
154	cat $< > $@
155
156include ../Makefile.targ
157