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 #
  23 # Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  24 #
  25 
  26 ETCTSOLFILES =  devalloc_defaults
  27 
  28 include         ../Makefile.cmd
  29 
  30 CERRWARN +=     -_gcc=-Wno-unused-value
  31 CERRWARN +=     -_gcc=-Wno-uninitialized
  32 CERRWARN +=     -_gcc=-Wno-parentheses
  33 CERRWARN +=     -_gcc=-Wno-clobbered
  34 
  35 ROOTSEC =       $(ROOTETC)/security
  36 ROOTSECDEV =    $(ROOTSEC)/dev
  37 ROOTSECLIB =    $(ROOTSEC)/lib
  38 ROOTSECAUD =    $(ROOTSEC)/audio
  39 ROOTDIRS =      $(ROOTSECDEV) $(ROOTSECLIB) $(ROOTSECAUD)
  40 
  41 ROOTMANIFESTDIR=        $(ROOTSVCSYSTEMDEVICE)
  42 SVCMETHOD =     svc-allocate    
  43 MANIFEST =      allocate.xml
  44 
  45 RTLCKS =        audio fd0 sr0 st0 st1
  46 CLEANfd =       fd_clean
  47 CLEANsr =       sr_clean
  48 CLEANst =       st_clean
  49 CLEANaudio =    audio_clean
  50 CLEANdisk =     disk_clean
  51 CLEAN_SCRIPTS = $(CLEANfd) $(CLEANsr) $(CLEANst) $(CLEANaudio) $(CLEANdisk)
  52 WDW_SCRIPTS =   wdwmsg wdwwrapper
  53 WDW_LINKS =     $(CLEANaudio) $(CLEANdisk) $(CLEANst)
  54 SCRIPTS =       $(CLEAN_SCRIPTS) $(WDW_SCRIPTS)
  55 ALLSCRIPTS =    allscripts.sh
  56 
  57 PROGalloc =     allocate
  58 PROGmkdevalloc =        mkdevalloc
  59 PROGdminfo =    dminfo
  60 PROGaddalloc =  add_allocatable
  61 PROG =          $(PROGalloc) $(PROGmkdevalloc) $(PROGdminfo) \
  62         $(PROGaddalloc)
  63 
  64 LINKPROGalloc = deallocate list_devices
  65 LINKPROGmkdevalloc = mkdevmaps
  66 LINKPROGaddalloc = remove_allocatable
  67 
  68 POFILE =        allocate_all.po
  69 POFILES =       $(OBJS:%.o=%.po) $(ALLSCRIPTS:%.sh=%.po)
  70 
  71 DFLAGS +=       -D_REENTRANT
  72 CPPFLAGS +=     $(DFLAGS)
  73 
  74 ROOTLOCKS =     $(RTLCKS:%=$(ROOTSECDEV)/%)
  75 ROOTSCRIPTS =   $(SCRIPTS:%=$(ROOTSECLIB)/%)
  76 ROOTWDWLINKS =  $(WDW_LINKS:%=$(ROOTSECLIB)/%.windowing)
  77 
  78 ROOTPROG =      $(PROGallocate:%=$(ROOTUSRSBIN)/%) \
  79                 $(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%) \
  80                 $(PROGdminfo:%=$(ROOTUSRSBIN)/%) \
  81                 $(PROGaddaloc:%=$(ROOTUSRSBIN)/%)
  82 ROOTLINKalloc = $(LINKPROGalloc:%=$(ROOTUSRSBIN)/%)
  83 ROOTLINKmkdevalloc = $(LINKPROGmkdevalloc:%=$(ROOTUSRSBIN)/%)
  84 ROOTLINKaddalloc = $(LINKPROGaddalloc:%=$(ROOTUSRSBIN)/%)
  85 ROOTLINKS =     $(ROOTLINKalloc) $(ROOTLINKmkdevalloc) $(ROOTLINKaddalloc)
  86 
  87 PROGallocOBJS =         allocate.o allocate3.o
  88 PROGmkdevallocOBJS =    mkdevalloc.o
  89 PROGdminfoOBJS =        dminfo.o
  90 PROGaddallocOBJS =      add_allocatable.o
  91 
  92 OBJS =          $(PROGallocOBJS) \
  93                 $(PROGmkdevallocOBJS) \
  94                 $(PROGdminfoOBJS) \
  95                 $(PROGaddallocOBJS)
  96 
  97 SRCS =          $(OBJS:%.o=%.c)
  98 
  99 $(ROOTUSRSBIN)/% :=     FILEMODE = 555
 100 $(ROOTUSRSBIN)/allocate :=      FILEMODE = 4555
 101 $(ROOTSECDEV)/% :=      FILEMODE = 0400
 102 $(ROOTSECLIB)/% :=      FILEMODE = 0555
 103 
 104 lint :=                 LDLIBS += -lbsm -lsec -lsecdb -ldevinfo -ltsol
 105 
 106 $(PROGalloc) :=         LDLIBS += -lbsm -lsec -lsecdb -ldevinfo -ltsol
 107 $(PROGmkdevalloc) :=    LDLIBS += -lbsm
 108 $(PROGdminfo) :=        LDLIBS += -lbsm
 109 $(PROGaddalloc) :=      LDLIBS += -lbsm -lsecdb -ltsol
 110 
 111 CLOBBERFILES += $(SCRIPTS)
 112 
 113 .KEEP_STATE:
 114 
 115 all :           $(PROG) $(RTLCKS) $(SCRIPTS)
 116 
 117 install :       $(PROG) $(ROOTDIRS) $(ROOTPROG) $(ROOTLOCKS) \
 118                 $(ROOTSCRIPTS) $(ROOTLINKS) $(ROOTWDWLINKS) \
 119                 $(ROOTETCTSOLFILES) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
 120 $(RTLCKS):
 121                 $(TOUCH) $@
 122 
 123 $(ROOTSECLIB)/%: %.sh
 124                 $(INS.rename)
 125 
 126 $(PROGalloc) :  $(PROGallocOBJS)
 127                 $(LINK.c) $(PROGallocOBJS) -o $@ $(LDLIBS)
 128                 $(POST_PROCESS)
 129 
 130 $(PROGaddalloc) :       $(PROGaddallocOBJS)
 131                 $(LINK.c) $(PROGaddallocOBJS) -o $@ $(LDLIBS)
 132                 $(POST_PROCESS)
 133 
 134 $(PROGmkdevalloc) :     $(PROGmkdevallocOBJS)
 135                         $(LINK.c) $(PROGmkdevallocOBJS) -o $@ $(LDLIBS)
 136                         $(POST_PROCESS)
 137 
 138 $(PROGdminfo) : $(PROGdminfoOBJS)
 139                 $(LINK.c) $(PROGdminfoOBJS) -o $@ $(LDLIBS)
 140                 $(POST_PROCESS)
 141 
 142 $(ROOTDIRS) :
 143                 $(INS.dir)
 144 
 145 $(ROOTSECDEV)/%: %
 146                 $(INS.file)
 147 
 148 $(ROOTSECLIB)/%: %
 149                 $(RM) $@
 150                 $(INS.file)
 151 
 152 $(ROOTLINKalloc) :      $(PROGalloc:%=$(ROOTUSRSBIN)/%)
 153                         $(RM) $@
 154                         $(LN) $(PROGalloc:%=$(ROOTUSRSBIN)/%) $@
 155 
 156 $(ROOTLINKaddalloc) :   $(PROGaddalloc:%=$(ROOTUSRSBIN)/%)
 157                         $(RM) $@
 158                         $(LN) $(PROGaddalloc:%=$(ROOTUSRSBIN)/%) $@
 159 
 160 $(ROOTLINKmkdevalloc) : $(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%)
 161                         $(RM) $@
 162                         $(LN) $(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%) $@
 163 
 164 
 165 $(ROOTETCSECLIB)/%.windowing: %
 166         $(RM) $@
 167         $(SYMLINK) $< $@
 168 
 169 $(POFILE):      $(POFILES)
 170                 $(RM) $@
 171                 $(CAT) $(POFILES) > $@
 172 
 173 #
 174 # Concatenate all the scripts into one before we build the catalogue.
 175 # Done to shrink the catalogue since some messages are shared between
 176 # the various scripts.
 177 #
 178 $(ALLSCRIPTS):  $(SCRIPTS:%=%.sh)
 179                 $(CAT) $(SCRIPTS:%=%.sh) > $@
 180 
 181 clean :
 182                 $(RM) $(PROG) $(RTLCKS) $(OBJS) \
 183                 $(SCRIPTS) $(ALLSCRIPTS) $(POFILE) $(POFILES)
 184 
 185 lint :          lint_SRCS
 186 
 187 strip :
 188                 $(STRIP) $(PROG)
 189 
 190 include         ../Makefile.targ