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