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