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 # Copyright (c) 2018, Joyent, Inc.
  26 
  27 PROTOCOL_DIR= $(ROOT)/usr/include/rpcsvc
  28 
  29 BINPROG= rusers rup
  30 SBINPROG= rwall spray
  31 RPROG= rpc.rusersd
  32 SPROG= rpc.sprayd
  33 WPROG= rpc.rwalld
  34 TPROG= rpc.rstatd
  35 
  36 PROG= $(BINPROG) $(SBINPROG) $(RPROG) $(SPROG) $(WPROG) $(TPROG)
  37 
  38 MANIFEST= \
  39         rusers.xml \
  40         spray.xml \
  41         wall.xml \
  42         rstat.xml
  43 
  44 SVCMETHOD=
  45 
  46 SCLNTOBJS= spray.o spray_clnt.o
  47 SSVCOBJS= spray_subr.o spray_svc.o
  48 WCLNTOBJS = rwall.o rwall_clnt.o
  49 WSVCOBJS= rwall_subr.o rwall_svc.o
  50 TSVCOBJS= rstat_main.o rstat_proc.o rstat_svc.o rstat_v2_svc.o rstat_v2_xdr.o
  51 
  52 DERIVED_FILES = rstat.x rstat.h rstat_svc.c rstat_v2.h rstat_v2_svc.c \
  53                 rstat_v2_xdr.c spray.x spray.h spray_clnt.c spray_svc.c \
  54                 rwall.x rwall.h rwall_svc.c rwall_clnt.c
  55 
  56 include ../Makefile.cmd
  57 
  58 ROOTMANIFESTDIR=        $(ROOTSVCNETWORKRPC)
  59 
  60 CPPFLAGS= -I. $(CPPFLAGS.master)
  61 CERRWARN += -_gcc=-Wno-implicit-function-declaration
  62 CERRWARN += -_gcc=-Wno-unused-variable
  63 CERRWARN += -_gcc=-Wno-parentheses
  64 CERRWARN += -_gcc=-Wno-extra
  65 CERRWARN += -_gcc=-Wno-unused-function
  66 
  67 # not linted
  68 SMATCH=off
  69 
  70 LDLIBS += -lnsl
  71 rusers :=       CFLAGS += $(CCVERBOSE)
  72 $(BINPROG) :=   LDLIBS += -lrpcsvc
  73 $(RPROG) :=     LDLIBS += -lrpcsvc
  74 $(SPROG) :=     LDLIBS += -lrpcsvc
  75 $(TPROG) :=     LDLIBS += -lrpcsvc
  76 spray :=        LDLIBS += -lrpcsvc
  77 
  78 
  79 SUBDIRS= rpc.bootparamd
  80 OBJS= $(SCLNTOBJS) $(SSVCOBJS) $(WCLNTOBJS) $(WSVCOBJS) $(TSVCOBJS)
  81 SRCS= $(OBJS:%.o=%.c) rusers.c rpc.rusersd.c rup.c
  82 
  83 ETCFILES= rpc
  84 
  85 TXTS= $(ETCFILES:%=net_files/%)
  86 
  87 NETSVC= $(ROOTLIB)/netsvc
  88 NIS = $(NETSVC)/nis
  89 RWALL= $(NETSVC)/rwall
  90 RUSERS= $(NETSVC)/rusers
  91 SPRAY= $(NETSVC)/spray
  92 RSTAT= $(NETSVC)/rstat
  93 
  94 ROOTDIRS= \
  95                 $(NETSVC) \
  96                 $(NIS) \
  97                 $(RWALL) \
  98                 $(RUSERS) \
  99                 $(SPRAY) \
 100                 $(RSTAT)
 101 
 102 IBINPROG=               $(BINPROG:%=$(ROOTBIN)/%)
 103 ISBINPROG=              $(SBINPROG:%=$(ROOTUSRSBIN)/%)
 104 IWPROG=                 $(WPROG:%=$(RWALL)/%)
 105 ISPROG=                 $(SPROG:%=$(SPRAY)/%)
 106 IRPROG=                 $(RPROG:%=$(RUSERS)/%)
 107 ITPROG=                 $(TPROG:%=$(RSTAT)/%)
 108 IETCFILES=              $(ETCFILES:%=$(ROOTETC)/%)
 109 
 110 # non-default file attributes
 111 $(ROOTETC)/rpc :=                               FILEMODE=       0644
 112 
 113 all:=           TARGET= all
 114 install:=       TARGET= install
 115 clean:=         TARGET= clean
 116 clobber:=       TARGET= clobber
 117 lint:=          TARGET= lint
 118 
 119 rpc.rstatd:=    LDLIBS += -lkstat
 120 rwall:=         CPPFLAGS += -D_REENTRANT
 121 rpc.rwalld:=    CPPFLAGS += -D_REENTRANT
 122 
 123 # install rules
 124 
 125 $(RWALL)/% $(SPRAY)/% $(RUSERS)/% $(RSTAT)/%: %
 126         $(INS.file)
 127 
 128 $(ROOTETC)/%: ./net_files/%
 129         $(INS.file)
 130 
 131 .KEEP_STATE:
 132 
 133 all: $(PROG) $(TXTS) $(SUBDIRS)
 134 
 135 # multi-object targets
 136 #
 137 spray:  $(SCLNTOBJS)
 138         $(LINK.c) $(SCLNTOBJS) -o $@ $(LDLIBS)
 139         $(POST_PROCESS)
 140 
 141 spray_svc.o spray_clnt.o: spray.h
 142 
 143 rpc.sprayd: $(SSVCOBJS)
 144         $(LINK.c) $(SSVCOBJS) -o $@ $(LDLIBS)
 145         $(POST_PROCESS)
 146 
 147 rwall_svc.o rwall_clnt.o: rwall.h
 148 
 149 rwall: $(WCLNTOBJS)
 150         $(LINK.c) $(WCLNTOBJS) -o $@ $(LDLIBS)
 151         $(POST_PROCESS)
 152 
 153 rpc.rwalld: $(WSVCOBJS)
 154         $(LINK.c) $(WSVCOBJS) -o $@ $(LDLIBS)
 155         $(POST_PROCESS)
 156 
 157 rstat_main.o:   rstat.h rstat_v2.h
 158 
 159 rstat_svc.o: rstat.h
 160 
 161 rstat_V2_svc.o rstat_V2_xdr.o: rstat_v2.h
 162 
 163 rpc.rstatd: $(TSVCOBJS)
 164         $(LINK.c) $(TSVCOBJS) -o $@ $(LDLIBS)
 165         $(POST_PROCESS)
 166 
 167 install: $(PROG) $(TXTS) .WAIT $(ROOTDIRS) .WAIT $(IBINPROG) $(ISBINPROG) \
 168         $(IWPROG) $(ISPROG) $(IRPROG) $(ITPROG) $(IETCFILES) $(SUBDIRS) \
 169         $(ROOTMANIFEST) $(ROOTSVCMETHOD)
 170 
 171 $(ROOTDIRS):
 172         $(INS.dir)
 173 
 174 $(SUBDIRS): FRC
 175         @cd $@; pwd; $(MAKE) $(TARGET)
 176 
 177 #
 178 # Derived files
 179 #
 180 
 181 rstat.x: $(PROTOCOL_DIR)/rstat.x
 182         $(RM) rstat.x
 183         $(CP) $(PROTOCOL_DIR)/rstat.x rstat.x
 184 
 185 rstat.h: $(PROTOCOL_DIR)/rstat.h
 186         $(RM) rstat.h
 187         $(CP) $(PROTOCOL_DIR)/rstat.h rstat.h
 188 
 189 rstat_svc.c: rstat.x
 190         $(RPCGEN) -C -m rstat.x > $@
 191 
 192 rstat_v2.h: rstat_v2.x
 193         $(RPCGEN) -C -h rstat_v2.x > $@
 194 
 195 rstat_v2_svc.c: rstat_v2.x
 196         $(RPCGEN) -C -m rstat_v2.x > $@
 197 
 198 rstat_v2_xdr.c: rstat_v2.x
 199         $(RPCGEN) -c rstat_v2.x > $@
 200 
 201 spray.x: $(PROTOCOL_DIR)/spray.x
 202         $(RM) spray.x
 203         $(CP) $(PROTOCOL_DIR)/spray.x spray.x
 204 
 205 spray.h: $(PROTOCOL_DIR)/spray.h
 206         $(RM) spray.h
 207         $(CP) $(PROTOCOL_DIR)/spray.h spray.h
 208 
 209 spray_svc.c: spray.x
 210         $(RPCGEN) -s datagram_v -s circuit_v spray.x > $@
 211 
 212 spray_clnt.c: spray.x
 213         $(RPCGEN) -l spray.x > $@
 214 
 215 rwall.x: $(PROTOCOL_DIR)/rwall.x
 216         $(RM) rwall.x
 217         $(CP) $(PROTOCOL_DIR)/rwall.x rwall.x
 218 
 219 rwall.h: $(PROTOCOL_DIR)/rwall.h
 220         $(RM) rwall.h
 221         $(CP) $(PROTOCOL_DIR)/rwall.h rwall.h
 222 
 223 rwall_svc.c: rwall.x
 224         $(RPCGEN) -A -s datagram_v rwall.x > $@
 225 
 226 rwall_clnt.c: rwall.x
 227         $(RPCGEN) -l -M rwall.x > $@
 228 
 229 check:  $(CHKMANIFEST)
 230 
 231 clean: $(SUBDIRS)
 232         -$(RM) $(OBJS) $(DERIVED_FILES)
 233 
 234 clobber: $(SUBDIRS)
 235 
 236 lint:
 237         $(LINT.c) $(WCLNTOBJS:%.o=%.c) -lnsl -lrpcsvc
 238         $(LINT.c) $(WSVCOBJS:%.o=%.c) -lnsl -lrpcsvc
 239         $(LINT.c) rusers.c -lnsl -lrpcsvc
 240 
 241 FRC:
 242 
 243 include ../Makefile.targ