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 # Copyright 2015 RackTop Systems.
  25 # Copyright 2017 Gary Mills
  26 #
  27 
  28 FSTYPE=         autofs
  29 AUTO=           automount
  30 MOUNT=          mount
  31 VERS=           .2
  32 DFSHARES=       dfshares
  33 SHARE=          share
  34 UNSHARE=        unshare
  35 LIBPROG=        $(AUTO) $(MOUNT) $(DFSHARES) $(SHARE) $(UNSHARE)
  36 TYPEPROG=       automountd
  37 
  38 LINKINSTALL=    $(ROOTUSRSBIN)/$(AUTO)
  39 LINKVALUE=      ../lib/fs/$(FSTYPE)/$(AUTO)
  40 MAPS=           auto_master auto_home
  41 MAPINSTALL=     $(MAPS:%=$(ROOTETC)/%)
  42 AUTOFS=         autofs
  43 DEFAULTFILES=   autofs.dfl
  44 SMFMANIFEST=    autofs.xml
  45 SMFMETHOD=      svc-autofs
  46 MFSTINSTALL=    $(SMFMANIFEST:%=$(ROOTSVCSYSTEM)/filesystem/%)
  47 METHODINSTALL=  $(SMFMETHOD:%=$(ROOTLIBSVCMETHOD)/%)
  48 
  49 OTHERINSTALL=   $(MAPINSTALL) $(LINKINSTALL) $(ROOTETCDEFAULTFILES) \
  50                 $(MFSTINSTALL) $(METHODINSTALL)
  51 
  52 UNCHECKED_HDRS= webnfs.h
  53 
  54 MANIFEST=       autofs.xml
  55 SVCMETHOD=      svc-autofs
  56 
  57 include         ../Makefile.fstype
  58 
  59 $(MAPINSTALL)   := FILEMODE= 0644
  60 
  61 $(MFSTINSTALL)  := FILEMODE = 0444
  62 
  63 REAL_COMMON=    debug_alloc.o
  64 COMMON=         ns_generic.o ns_files.o ns_nis.o \
  65                 ns_ldap.o auto_mnttab.o auto_subr.o $(REAL_COMMON)
  66 
  67 AUTOOBJS=       automount.o $(COMMON) $(FSLIB) smfcfg.o
  68 
  69 MOUNTOBJS=      mount.o $(FSLIB) $(REAL_COMMON)
  70 
  71 LOCAL=          autod_main.o \
  72                 autod_parse.o autod_mount.o autod_nfs.o nfs_cast.o \
  73                 autod_autofs.o autod_xdr.o autod_readdir.o autod_lookup.o \
  74                 smfcfg.o
  75 
  76 TYPEOBJS=       $(LOCAL) $(COMMON) replica.o nfs_sec.o nfs_resolve.o nfs_subr.o \
  77                 $(FSLIB) webnfs_xdr.o webnfs_client.o selfcheck.o
  78 
  79 SHAREOBJS=      $(SHARESRCS:%.c=%.o)
  80 
  81 UNSHAREOBJS=    $(UNSHARESRCS:%.c=%.o)
  82 
  83 POFILE= autofs.po
  84 GREP= egrep
  85 SED= sed
  86 
  87 $(AUTO) :=      LDLIBS += -lnsl -lsldap -lscf
  88 $(MOUNT):=      LDLIBS += -lscf
  89 $(TYPEPROG) :=  LDLIBS += -lrpcsvc -lsocket -lnsl -lsldap -lkstat -lscf
  90 
  91 CFLAGS +=       $(CCVERBOSE) -D_FILE_OFFSET_BITS=64
  92 CPPFLAGS=       -I. -I.. -I../nfs/lib $(CPPFLAGS.master) -D_REENTRANT  \
  93                         $(MALLOC_DEBUG)
  94 
  95 CERRWARN +=     -_gcc=-Wno-parentheses
  96 CERRWARN +=     -_gcc=-Wno-unused-variable
  97 CERRWARN +=     -_gcc=-Wno-switch
  98 CERRWARN +=     -_gcc=-Wno-uninitialized
  99 CERRWARN +=     -_gcc=-Wno-unused-label
 100 CERRWARN +=     -_gcc=-Wno-unused-function
 101 
 102 # Suppress the error for: lp
 103 ns_files.o :=   CERRWARN += -_gcc=-Wno-unused-but-set-parameter
 104 # Suppress the error for: lastread
 105 autod_nfs.o :=  CERRWARN += -_gcc=-Wno-unused-but-set-variable
 106 
 107 OBJS=           $(AUTOOBJS) $(MOUNTOBJS) $(TYPEOBJS) \
 108                 $(SHAREOBJS) $(UNSHAREOBJS)
 109 
 110 AUTOSRCS=       automount.c $(COMMON:%.o=%.c) $(FSLIBSRC)
 111 MOUNTSRCS=      mount.c $(FSLIBSRC)
 112 TYPESRCS=       $(LOCAL:%.o=%.c) $(COMMON:%.o=%.c) \
 113                 ../nfs/lib/replica.c ../nfs/lib/nfs_sec.c \
 114                 ../nfs/lib/nfs_subr.c $(FSLIBSRC) ../nfs/lib/selfcheck.c \
 115                 ../nfs/lib/nfs_resolve.c ../nfs/lib/smfcfg.c
 116 SHARESRCS=      $(SHARE:%=%.c)
 117 UNSHARESRCS=    $(UNSHARE:%=%.c)
 118 DFSHARESSRCS=   $(DFSHARES:%=%.sh)
 119 SRCS=           $(OBJS:%.o=%.c)
 120 
 121 nfs_sec.o :=    CPPFLAGS += -DWNFS_SEC_NEGO
 122 
 123 $(AUTO):        $(AUTOOBJS)
 124                 $(LINK.c) -o $@ $(AUTOOBJS) $(LDLIBS)
 125                 $(POST_PROCESS)
 126 
 127 $(MOUNT):       $(MOUNTOBJS)
 128                 $(LINK.c) -o $@ $(MOUNTOBJS) $(LDLIBS)
 129                 $(POST_PROCESS)
 130 
 131 $(TYPEPROG):    webnfs.h $(TYPEOBJS)
 132                 $(LINK.c) -o $@ $(TYPEOBJS) $(LDLIBS)
 133                 $(POST_PROCESS)
 134 
 135 $(SHARE):       $(SHAREOBJS)
 136                 $(LINK.c) -o $@ $(SHAREOBJS) $(LDLIBS)
 137                 $(POST_PROCESS)
 138 
 139 $(UNSHARE):     $(UNSHAREOBJS)
 140                 $(LINK.c) -o $@ $(UNSHAREOBJS) $(LDLIBS)
 141                 $(POST_PROCESS)
 142 
 143 $(ROOTSVCSYSTEM)/filesystem/%: %
 144                 $(INS.file)
 145 
 146 DUMP_PROG=malloc_dump
 147 BUILDDIR=tmp
 148 DUMP_PROTO=$(BUILDDIR)/$(DUMP_PROG)_client
 149 XFILE=$(BUILDDIR)/malloc_dump.x
 150 XLINE= "program DUMP { version VERS \
 151         { void DUMP_IT(void) = 1000000; } = 2; } = 100099;"
 152 
 153 $(XFILE):       $(BUILDDIR)
 154                 $(RM) $(XFILE)
 155                 echo $(XLINE) > $(XFILE)
 156 
 157 $(BUILDDIR):
 158                 $(RM) -r $(BUILDDIR)
 159                 mkdir $(BUILDDIR)
 160 
 161 $(DUMP_PROTO):  $(BUILDDIR) $(XFILE)
 162                 cd $(BUILDDIR); $(RM) *.[ch] makefile.malloc_dump ; rpcgen -a `basename $(XFILE)
 163                 cd $(BUILDDIR); $(MAKE) -f makefile.malloc_dump `basename $@`
 164 
 165 $(DUMP_PROG):   $(DUMP_PROTO)
 166                 $(RM) $@
 167                 cp $(DUMP_PROTO) $@
 168 
 169 clean_dump:
 170                 $(RM) -r $(BUILDDIR)
 171                 $(RM) $(DUMP_PROG)
 172 $(ROOTUSRSBIN)/$(AUTO):
 173                 $(RM) $@; $(SYMLINK) $(LINKVALUE) $@
 174 
 175 replica.o:      ../nfs/lib/replica.c
 176                 $(COMPILE.c) ../nfs/lib/replica.c
 177 
 178 nfs_sec.o:      ../nfs/lib/nfs_sec.c
 179                 $(COMPILE.c) ../nfs/lib/nfs_sec.c
 180 
 181 nfs_subr.o:     ../nfs/lib/nfs_subr.c
 182                 $(COMPILE.c) ../nfs/lib/nfs_subr.c
 183 
 184 selfcheck.o:    ../nfs/lib/selfcheck.c
 185                 $(COMPILE.c) ../nfs/lib/selfcheck.c
 186 
 187 smfcfg.o: ../nfs/lib/smfcfg.c
 188                 $(COMPILE.c) ../nfs/lib/smfcfg.c
 189 
 190 nfs_resolve.o:  ../nfs/lib/nfs_resolve.c
 191                 $(COMPILE.c) ../nfs/lib/nfs_resolve.c
 192 
 193 webnfs_xdr.c:   webnfs.x
 194         $(RPCGEN) -M -C -c -o $@ webnfs.x
 195 
 196 webnfs_client.c:        webnfs.x
 197         $(RPCGEN) -M -C -l -o $@ webnfs.x
 198 
 199 webnfs.h:       webnfs.x
 200         $(RPCGEN) -M -C -h -o $@ webnfs.x
 201 
 202 webnfs.x:       ../nfs/lib/webnfs.x
 203         $(RM) webnfs.x
 204         cp ../nfs/lib/webnfs.x .
 205 
 206 catalog: $(POFILE)
 207 
 208 $(POFILE):
 209         $(RM) messages.po
 210         $(SED) -e 's/pr_msg/gettext/' `$(GREP) -l "pr_msg|gettext" *.[ch]` | \
 211         $(XGETTEXT) $(XGETFLAGS) -
 212         $(SED) -e '/^# msg/d' -e '/^domain/d' < messages.po > $@
 213         $(RM) messages.po
 214 
 215 lint:
 216         $(LINT.c) $(AUTOSRCS)
 217         $(LINT.c) $(MOUNTSRCS)
 218         $(LINT.c) $(TYPESRCS)
 219 
 220 clean:  clean_dump
 221         $(RM) $(OBJS) webnfs_xdr.c webnfs_client.c webnfs.h webnfs.x
 222 
 223 check:  $(CHKMANIFEST)