xref: /illumos-gate/usr/src/cmd/power/Makefile (revision 58e78d16)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
506e1a714Sraf# Common Development and Distribution License (the "License").
606e1a714Sraf# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
217c478bd9Sstevel@tonic-gate#
22623ec8b0SRandy Fishel# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate# Use is subject to license terms.
247c478bd9Sstevel@tonic-gate#
255661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc.
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gateDAEMON_SRCS =	powerd.c sysstat.c
287c478bd9Sstevel@tonic-gateDAEMON_OBJS =	$(DAEMON_SRCS:%.c=%.o)
297c478bd9Sstevel@tonic-gateDAEMON =	powerd
30*58e78d16SToomas SoomePMCFG_SRCS =	conf.c parse.c handlers.c
317c478bd9Sstevel@tonic-gatePMCFG_OBJS =	$(PMCFG_SRCS:%.c=%.o)
32*58e78d16SToomas SoomePMCFG =		pmconfig
33*58e78d16SToomas SoomeSUSPEND_SRCS =	sys-suspend.c pm_pam_conv.c
34623ec8b0SRandy FishelSUSPEND_OBJS =	$(SUSPEND_SRCS:%.c=%.o)
35*58e78d16SToomas SoomeSUSPEND =	sys-suspend
36*58e78d16SToomas SoomeSRCS =		$(DAEMON_SRCS) $(PMCFG_SRCS) $(SUSPEND_SRCS)
37*58e78d16SToomas SoomeOBJS =		$(SRCS:%.c=%.o)
38befc3ac7SPeter TribblePROG =		$(DAEMON) $(PMCFG) $(SUSPEND)
392df1fe9cSrandyfPOWERCONF=	power.conf
402df1fe9cSrandyfETCFILES =	$(POWERCONF)
417c478bd9Sstevel@tonic-gatePOWERPERM =	power
42a7872406SmeemDEFAULTFILES =	power.dfl
437c478bd9Sstevel@tonic-gate
44a192e900SamaguireMANIFEST=	power.xml
45a192e900SamaguireSVCMETHOD=	svc-power
467c478bd9Sstevel@tonic-gate
47a192e900Samaguireinclude ../Makefile.cmd
487c478bd9Sstevel@tonic-gate
497c478bd9Sstevel@tonic-gateROOTMANIFESTDIR =	$(ROOTSVCSYSTEM)
507c478bd9Sstevel@tonic-gate
517c478bd9Sstevel@tonic-gateTEXT_DOMAIN=	SUNW_OST_OSCMD
527c478bd9Sstevel@tonic-gate
531dc065c6SmhXGETFLAGS +=    -a -x power_all.xcl
547c478bd9Sstevel@tonic-gatePOFILE=		power_all.po
55623ec8b0SRandy FishelPOFILES=	$(PMCFG_SRCS:%.c=%.po) $(SUSPEND_SRCS:%.c=%.po)
567c478bd9Sstevel@tonic-gate
572df1fe9cSrandyf# pmconfig only needs libdevinfo on sparc
58e7cbe64fSgwsparc_LDEVINFO=	-ldevinfo -lefi -ladm -lzfs -lnvpair
597c478bd9Sstevel@tonic-gatei386_LDEVINFO=
607c478bd9Sstevel@tonic-gate
612df1fe9cSrandyfLDEVINFO=	-ldevinfo
622df1fe9cSrandyf
632df1fe9cSrandyfDAEMON_LDLIBS =	$(LDLIBS.cmd) -lkstat $(LDEVINFO)
64ec8accefSMilan JurikPMCFG_LDLIBS =	$(LDLIBS.cmd) -lsmbios -lkstat $($(MACH)_LDEVINFO)
65623ec8b0SRandy FishelSUSPEND_LDLIBS = $(LDLIBS.cmd) -lbsm -lpam -lsecdb
667c478bd9Sstevel@tonic-gate
677c478bd9Sstevel@tonic-gateROOTUSRSBINPMCFG= $(PMCFG:%=$(ROOTUSRSBIN)/%)
687c478bd9Sstevel@tonic-gate$(ROOTUSRSBINPMCFG) := FILEMODE= 4555
69623ec8b0SRandy FishelROOTUSRBINSUSPEND= $(SUSPEND:%=$(ROOTBIN)/%)
70623ec8b0SRandy Fishel$(ROOTUSRBINSUSPEND) := FILEMODE= 4555
717c478bd9Sstevel@tonic-gate
727c478bd9Sstevel@tonic-gateROOTLIBPOWER= $(ROOTLIB)/power
737c478bd9Sstevel@tonic-gateROOTLIBPOWERDAEMON= $(DAEMON:%=$(ROOTLIBPOWER)/%)
747c478bd9Sstevel@tonic-gate$(ROOTLIBPOWER) := FILEMODE= 755
757c478bd9Sstevel@tonic-gate$(ROOTLIBPOWERDAEMON) := FILEMODE= 555
767c478bd9Sstevel@tonic-gate
775661bb76SJohn LevonROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%)
785661bb76SJohn Levon$(ROOTETCFILES) := FILEMODE= 644
797c478bd9Sstevel@tonic-gate
807c478bd9Sstevel@tonic-gate#
817c478bd9Sstevel@tonic-gate# lint pass one enforcement
827c478bd9Sstevel@tonic-gate#
837c478bd9Sstevel@tonic-gateCFLAGS += $(CCVERBOSE)
847c478bd9Sstevel@tonic-gate
855661bb76SJohn LevonSMOFF += signed
865661bb76SJohn Levon
877c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS)
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gate.KEEP_STATE:
907c478bd9Sstevel@tonic-gate
91befc3ac7SPeter Tribbleall: $(PROG) $(POWERPERM).dfl $(ETCFILES)
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gateinstall clean:
947c478bd9Sstevel@tonic-gate
952df1fe9cSrandyf$(POWERCONF): $(POWERCONF).$(MACH)
962df1fe9cSrandyf
977c478bd9Sstevel@tonic-gate$(DAEMON_OBJS): $(DAEMON_SRCS)
987c478bd9Sstevel@tonic-gate	$(CC) $(CFLAGS) -D_REENTRANT $(CPPFLAGS) -o $@ -c $<
997c478bd9Sstevel@tonic-gate	$(PROCESS_COMMENT) $@
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gate$(DAEMON): $(DAEMON_OBJS)
102*58e78d16SToomas Soome	$(LINK.c) -o $@ $(DAEMON_OBJS) $(DAEMON_LDLIBS)
1037c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1047c478bd9Sstevel@tonic-gate
1057c478bd9Sstevel@tonic-gate$(PMCFG_OBJS): pmconfig.h
1067c478bd9Sstevel@tonic-gate
1077c478bd9Sstevel@tonic-gate$(PMCFG): $(PMCFG_OBJS)
1087c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
1097c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1107c478bd9Sstevel@tonic-gate
111623ec8b0SRandy Fishel$(SUSPEND): $(SUSPEND_OBJS)
112623ec8b0SRandy Fishel	$(LINK.c) -o $@ $(SUSPEND_OBJS) $(SUSPEND_LDLIBS)
113623ec8b0SRandy Fishel	$(POST_PROCESS)
114623ec8b0SRandy Fishel
115623ec8b0SRandy Fishelinstall: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) $(ROOTUSRBINSUSPEND) \
116befc3ac7SPeter Tribble	$(ROOTETCFILES) $(ROOTETCDEFAULTFILES) \
117a192e900Samaguire	$(ROOTMANIFEST) $(ROOTSVCMETHOD)
1187c478bd9Sstevel@tonic-gate
1197c478bd9Sstevel@tonic-gate$(ROOTLIBPOWER):
1207c478bd9Sstevel@tonic-gate	$(INS.dir)
1217c478bd9Sstevel@tonic-gate
1227c478bd9Sstevel@tonic-gate$(ROOTLIBPOWER)/%:	%
1237c478bd9Sstevel@tonic-gate	$(INS.file)
1247c478bd9Sstevel@tonic-gate
1257c478bd9Sstevel@tonic-gate$(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
1267c478bd9Sstevel@tonic-gate
127befc3ac7SPeter Tribble$(POFILE):	$(POFILES)
1287c478bd9Sstevel@tonic-gate	$(RM)	$@
129befc3ac7SPeter Tribble	cat	$(POFILES)	> $@
1307c478bd9Sstevel@tonic-gate
1317c478bd9Sstevel@tonic-gatecheck:	$(CHKMANIFEST)
1327c478bd9Sstevel@tonic-gate
1337c478bd9Sstevel@tonic-gateclean:
134befc3ac7SPeter Tribble	$(RM) $(OBJS) $(POWERCONF)
1357c478bd9Sstevel@tonic-gate	$(RM) $(POFILE) $(POFILES)
1367c478bd9Sstevel@tonic-gate
1377c478bd9Sstevel@tonic-gatelint := LINTFLAGS=-auxn
1387c478bd9Sstevel@tonic-gatelint:
1397c478bd9Sstevel@tonic-gate	$(LINT.c) $(DAEMON_SRCS)
1407c478bd9Sstevel@tonic-gate	$(LINT.c) $(PMCFG_SRCS)
141623ec8b0SRandy Fishel	$(LINT.c) $(SUSPEND_SRCS)
1427c478bd9Sstevel@tonic-gate
1437c478bd9Sstevel@tonic-gatecstyle:
1447c478bd9Sstevel@tonic-gate	$(CSTYLE) $(SRCS)
1457c478bd9Sstevel@tonic-gate
1462df1fe9cSrandyf%:	%.$(MACH)
1472df1fe9cSrandyf	$(RM) $@
1482df1fe9cSrandyf	cat $< > $@
1492df1fe9cSrandyf
1507c478bd9Sstevel@tonic-gateinclude ../Makefile.targ
151