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 2009 Sun Microsystems, Inc. All rights reserved. 23 # Use is subject to license terms. 24 # 25 # Copyright (c) 2018, Joyent, Inc. 26 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 43 44 MANIFEST= power.xml 45 SVCMETHOD= svc-power 46 47 include ../Makefile.cmd 48 49 ROOTMANIFESTDIR = $(ROOTSVCSYSTEM) 50 51 TEXT_DOMAIN= SUNW_OST_OSCMD 52 53 XGETFLAGS += -a -x power_all.xcl 54 POFILE= power_all.po 55 POFILES= $(PMCFG_SRCS:%.c=%.po) $(SUSPEND_SRCS:%.c=%.po) 56 57 # pmconfig only needs libdevinfo on sparc 58 sparc_LDEVINFO= -ldevinfo -lefi -ladm -lzfs -lnvpair 59 i386_LDEVINFO= 60 61 LDEVINFO= -ldevinfo 62 63 DAEMON_LDLIBS = $(LDLIBS.cmd) -lkstat $(LDEVINFO) 64 PMCFG_LDLIBS = $(LDLIBS.cmd) -lsmbios -lkstat $($(MACH)_LDEVINFO) 65 SUSPEND_LDLIBS = $(LDLIBS.cmd) -lbsm -lpam -lsecdb 66 67 ROOTUSRSBINPMCFG= $(PMCFG:%=$(ROOTUSRSBIN)/%) 68 $(ROOTUSRSBINPMCFG) := FILEMODE= 4555 69 ROOTUSRBINSUSPEND= $(SUSPEND:%=$(ROOTBIN)/%) 70 $(ROOTUSRBINSUSPEND) := FILEMODE= 4555 71 72 ROOTLIBPOWER= $(ROOTLIB)/power 73 ROOTLIBPOWERDAEMON= $(DAEMON:%=$(ROOTLIBPOWER)/%) 74 $(ROOTLIBPOWER) := FILEMODE= 755 75 $(ROOTLIBPOWERDAEMON) := FILEMODE= 555 76 77 ROOTETCFILES= $(ETCFILES:%=$(ROOTETC)/%) 78 $(ROOTETCFILES) := FILEMODE= 644 79 80 # 81 # lint pass one enforcement 82 # 83 CFLAGS += $(CCVERBOSE) 84 85 SMOFF += signed 86 87 .PARALLEL: $(OBJS) 88 89 .KEEP_STATE: 90 91 all: $(PROG) $(POWERPERM).dfl $(ETCFILES) 92 93 install clean: 94 95 $(POWERCONF): $(POWERCONF).$(MACH) 96 97 $(DAEMON_OBJS): $(DAEMON_SRCS) 98 $(CC) $(CFLAGS) -D_REENTRANT $(CPPFLAGS) -o $@ -c $< 99 $(PROCESS_COMMENT) $@ 100 101 $(DAEMON): $(DAEMON_OBJS) 102 $(CC) -o $@ $(DAEMON_OBJS) $(LDFLAGS) $(DAEMON_LDLIBS) 103 $(POST_PROCESS) 104 105 $(PMCFG_OBJS): pmconfig.h 106 107 $(PMCFG): $(PMCFG_OBJS) 108 $(LINK.c) -o $@ $(PMCFG_OBJS) $(PMCFG_LDLIBS) 109 $(POST_PROCESS) 110 111 $(SUSPEND): $(SUSPEND_OBJS) 112 $(LINK.c) -o $@ $(SUSPEND_OBJS) $(SUSPEND_LDLIBS) 113 $(POST_PROCESS) 114 115 install: all $(ROOTUSRSBINPMCFG) $(ROOTLIBPOWERDAEMON) $(ROOTUSRBINSUSPEND) \ 116 $(ROOTETCFILES) $(ROOTETCDEFAULTFILES) \ 117 $(ROOTMANIFEST) $(ROOTSVCMETHOD) 118 119 $(ROOTLIBPOWER): 120 $(INS.dir) 121 122 $(ROOTLIBPOWER)/%: % 123 $(INS.file) 124 125 $(ROOTLIBPOWERDAEMON): $(ROOTLIBPOWER) 126 127 $(POFILE): $(POFILES) 128 $(RM) $@ 129 cat $(POFILES) > $@ 130 131 check: $(CHKMANIFEST) 132 133 clean: 134 $(RM) $(OBJS) $(POWERCONF) 135 $(RM) $(POFILE) $(POFILES) 136 137 lint := LINTFLAGS=-auxn 138 lint: 139 $(LINT.c) $(DAEMON_SRCS) 140 $(LINT.c) $(PMCFG_SRCS) 141 $(LINT.c) $(SUSPEND_SRCS) 142 143 cstyle: 144 $(CSTYLE) $(SRCS) 145 146 %: %.$(MACH) 147 $(RM) $@ 148 cat $< > $@ 149 150 include ../Makefile.targ