Merge illumos-gate
[unleashed.git] / usr / src / cmd / power / Makefile
blob90741b8e1f10a52f62b13b28304cd38b12ab1333
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
22 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
25 # Copyright (c) 2018, Joyent, Inc.
27 DAEMON_SRCS = powerd.c sysstat.c
28 DAEMON_OBJS = $(DAEMON_SRCS:%.c=%.o)
29 DAEMON = powerd
30 PMCFG_SRCS = conf.c parse.c handlers.c
31 PMCFG_OBJS = $(PMCFG_SRCS:%.c=%.o)
32 PMCFG = pmconfig
33 SUSPEND_SRCS = sys-suspend.c pm_pam_conv.c
34 SUSPEND_OBJS = $(SUSPEND_SRCS:%.c=%.o)
35 SUSPEND = sys-suspend
36 SRCS = $(DAEMON_SRCS) $(PMCFG_SRCS) $(SUSPEND_SRCS)
37 OBJS = $(SRCS:%.c=%.o)
38 PROG = $(DAEMON) $(PMCFG) $(SUSPEND)
39 POWERCONF= power.conf
40 ETCFILES = $(POWERCONF)
41 POWERPERM = power
42 DEFAULTFILES = power.dfl
44 MANIFEST= power.xml
45 SVCMETHOD= svc-power
47 include ../Makefile.cmd
49 ROOTMANIFESTDIR = $(ROOTSVCSYSTEM)
51 TEXT_DOMAIN= SUNW_OST_OSCMD
53 XGETFLAGS += -a -x power_all.xcl
54 POFILE= power_all.po
55 POFILES= $(PMCFG_SRCS:%.c=%.po) $(SUSPEND_SRCS:%.c=%.po)
57 # pmconfig only needs libdevinfo on sparc
58 sparc_LDEVINFO= -ldevinfo -lefi -ladm -lzfs -lnvpair
59 i386_LDEVINFO=
61 LDEVINFO= -ldevinfo
63 DAEMON_LDLIBS = $(LDLIBS.cmd) -lkstat $(LDEVINFO)
64 PMCFG_LDLIBS = $(LDLIBS.cmd) -lsmbios -lkstat $($(MACH)_LDEVINFO)
65 SUSPEND_LDLIBS = $(LDLIBS.cmd) -lpam -lsecdb
67 ROOTUSRSBINPMCFG= $(PMCFG:%=$(ROOTUSRSBIN)/%)
68 $(ROOTUSRSBINPMCFG) := FILEMODE= 4555
69 ROOTUSRBINSUSPEND= $(SUSPEND:%=$(ROOTBIN)/%)
70 $(ROOTUSRBINSUSPEND) := FILEMODE= 4555
72 ROOTLIBPOWER= $(ROOTLIB)/power
73 ROOTLIBPOWERDAEMON= $(DAEMON:%=$(ROOTLIBPOWER)/%)
74 $(ROOTLIBPOWER) := FILEMODE= 755
75 $(ROOTLIBPOWERDAEMON) := FILEMODE= 555
77 ROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%)
78 $(ROOTETCFILES) := FILEMODE= 644
80 SMOFF += signed
82 .PARALLEL: $(OBJS)
84 .KEEP_STATE:
86 all: $(PROG) $(POWERPERM).dfl $(ETCFILES)
88 install clean:
90 $(POWERCONF): $(POWERCONF).$(MACH)
92 $(DAEMON_OBJS): $(DAEMON_SRCS)
93 $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
95 $(DAEMON): $(DAEMON_OBJS)
96 $(CC) -o $@ $(CFLAGS) $(DAEMON_OBJS) $(LDFLAGS) $(DAEMON_LDLIBS)
97 $(POST_PROCESS)
99 $(PMCFG_OBJS): pmconfig.h
101 $(PMCFG): $(PMCFG_OBJS)
102 $(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS)
103 $(POST_PROCESS)
105 $(SUSPEND): $(SUSPEND_OBJS)
106 $(LINK.c) -o $@ $(SUSPEND_OBJS) $(SUSPEND_LDLIBS)
107 $(POST_PROCESS)
109 install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) $(ROOTUSRBINSUSPEND) \
110 $(ROOTETCFILES) $(ROOTETCDEFAULTFILES) \
111 $(ROOTMANIFEST) $(ROOTSVCMETHOD)
113 $(ROOTLIBPOWER):
114 $(INS.dir)
116 $(ROOTLIBPOWER)/%: %
117 $(INS.file)
119 $(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER)
121 $(POFILE): $(POFILES)
122 $(RM) $@
123 cat $(POFILES) > $@
125 check: $(CHKMANIFEST)
127 clean:
128 $(RM) $(OBJS) $(POWERCONF)
129 $(RM) $(POFILE) $(POFILES)
131 cstyle:
132 $(CSTYLE) $(SRCS)
134 %: %.$(MACH)
135 $(RM) $@
136 cat $< > $@
138 include ../Makefile.targ