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