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 2010 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 # Copyright 2013 Garrett D'Amore <garrett@damore.org>
  26 # Copyright 2015 Igor Kozhukhov <ikozhukhov@gmail.com>
  27 # Copyright 2017 Nexenta Systems, Inc.
  28 #
  29 
  30 # include global definitions
  31 include ../Makefile.master
  32 
  33 sparc_HDRS=
  34 i386_HDRS=      stack_unwind.h
  35 
  36 KRB5HDRS=               \
  37         mit_copyright.h \
  38         mit-sipb-copyright.h
  39 
  40 ATTRDB_HDRS=            \
  41         auth_attr.h     \
  42         auth_list.h     \
  43         exec_attr.h     \
  44         prof_attr.h     \
  45         secdb.h         \
  46         user_attr.h
  47 
  48 HDRS=   $($(MACH)_HDRS) \
  49         $(ATTRDB_HDRS)  \
  50         aio.h           \
  51         alloca.h        \
  52         apptrace.h      \
  53         apptrace_impl.h \
  54         ar.h            \
  55         archives.h      \
  56         assert.h        \
  57         atomic.h        \
  58         attr.h          \
  59         complex.h       \
  60         config_admin.h  \
  61         cpio.h          \
  62         crypt.h         \
  63         ctype.h         \
  64         deflt.h         \
  65         devid.h         \
  66         devmgmt.h       \
  67         devpoll.h       \
  68         dial.h          \
  69         dirent.h        \
  70         dlfcn.h         \
  71         door.h          \
  72         elf.h           \
  73         endian.h        \
  74         err.h           \
  75         errno.h         \
  76         euc.h           \
  77         exacct.h        \
  78         exacct_impl.h   \
  79         execinfo.h      \
  80         fatal.h         \
  81         fcntl.h         \
  82         fenv.h          \
  83         float.h         \
  84         floatingpoint.h \
  85         fmtmsg.h        \
  86         fnmatch.h       \
  87         fts.h           \
  88         ftw.h           \
  89         gelf.h          \
  90         getopt.h        \
  91         getwidth.h      \
  92         glob.h          \
  93         grp.h           \
  94         iconv.h         \
  95         ieeefp.h        \
  96         ifaddrs.h       \
  97         inttypes.h      \
  98         iso646.h        \
  99         klpd.h          \
 100         langinfo.h      \
 101         lastlog.h       \
 102         lber.h          \
 103         ldap.h          \
 104         libelf.h        \
 105         libgen.h        \
 106         libintl.h       \
 107         libw.h          \
 108         libzonecfg.h    \
 109         limits.h        \
 110         linenum.h       \
 111         link.h          \
 112         listen.h        \
 113         locale.h        \
 114         macros.h        \
 115         malloc.h        \
 116         math.h          \
 117         memory.h        \
 118         mon.h           \
 119         monetary.h      \
 120         mp.h            \
 121         mqueue.h        \
 122         nan.h           \
 123         ndbm.h          \
 124         ndpd.h          \
 125         netconfig.h     \
 126         netdb.h         \
 127         netdir.h        \
 128         nl_types.h      \
 129         nlist.h         \
 130         note.h          \
 131         nsctl.h         \
 132         nsswitch.h      \
 133         nss_common.h    \
 134         nss_dbdefs.h    \
 135         nss_netdir.h    \
 136         paths.h         \
 137         pcsample.h      \
 138         pfmt.h          \
 139         pkgdev.h        \
 140         pkginfo.h       \
 141         pkglocs.h       \
 142         pkgstrct.h      \
 143         pkgtrans.h      \
 144         poll.h          \
 145         port.h          \
 146         priv.h          \
 147         priv_utils.h    \
 148         proc_service.h  \
 149         procfs.h        \
 150         prof.h          \
 151         project.h       \
 152         pthread.h       \
 153         pw.h            \
 154         pwd.h           \
 155         rctl.h          \
 156         re_comp.h       \
 157         regex.h         \
 158         regexp.h        \
 159         resolv.h        \
 160         rje.h           \
 161         rtld_db.h       \
 162         sac.h           \
 163         sched.h         \
 164         schedctl.h      \
 165         search.h        \
 166         semaphore.h     \
 167         setjmp.h        \
 168         sgtty.h         \
 169         shadow.h        \
 170         siginfo.h       \
 171         signal.h        \
 172         spawn.h         \
 173         stdalign.h      \
 174         stdarg.h        \
 175         stdbool.h       \
 176         stddef.h        \
 177         stdint.h        \
 178         stdio.h         \
 179         stdio_ext.h     \
 180         stdio_tag.h     \
 181         stdio_impl.h    \
 182         stdlib.h        \
 183         stdnoreturn.h   \
 184         storclass.h     \
 185         string.h        \
 186         strings.h       \
 187         stropts.h       \
 188         synch.h         \
 189         sysexits.h      \
 190         syslog.h        \
 191         syms.h          \
 192         tar.h           \
 193         termio.h        \
 194         termios.h       \
 195         tgmath.h        \
 196         thread.h        \
 197         thread_db.h     \
 198         threads.h       \
 199         time.h          \
 200         tiuser.h        \
 201         tzfile.h        \
 202         ucontext.h      \
 203         ucred.h         \
 204         ulimit.h        \
 205         unistd.h        \
 206         userdefs.h      \
 207         ustat.h         \
 208         utime.h         \
 209         utmp.h          \
 210         utmpx.h         \
 211         valtools.h      \
 212         values.h        \
 213         varargs.h       \
 214         wait.h          \
 215         wchar.h         \
 216         wchar_impl.h    \
 217         wctype.h        \
 218         widec.h         \
 219         wordexp.h       \
 220         xlocale.h       \
 221         xti.h           \
 222         xti_inet.h      \
 223         zone.h
 224 
 225 ISOHDRS = \
 226         ctype_iso.h     \
 227         limits_iso.h    \
 228         locale_iso.h    \
 229         math_c99.h      \
 230         math_iso.h      \
 231         setjmp_iso.h    \
 232         signal_iso.h    \
 233         stdarg_c99.h    \
 234         stdarg_iso.h    \
 235         stddef_iso.h    \
 236         stdio_c99.h     \
 237         stdio_iso.h     \
 238         stdlib_c99.h    \
 239         stdlib_c11.h    \
 240         stdlib_iso.h    \
 241         string_iso.h    \
 242         time_iso.h      \
 243         wchar_c99.h     \
 244         wchar_iso.h     \
 245         wctype_iso.h
 246 
 247 ARPAHDRS =              \
 248         ftp.h           \
 249         inet.h          \
 250         nameser.h       \
 251         telnet.h        \
 252         tftp.h          \
 253         nameser_compat.h
 254 
 255 AUDIOHDRS =             \
 256         au.h
 257 
 258 UUIDHDRS =              \
 259         uuid.h
 260 
 261 # rpcsvc headers which are just headers (not derived from a .x file)
 262 RPCSVC_SRC_HDRS =       \
 263         bootparam.h     \
 264         daemon_utils.h  \
 265         dbm.h           \
 266         nis_db.h        \
 267         nislib.h        \
 268         svc_dg_priv.h   \
 269         yp_prot.h       \
 270         ypclnt.h        \
 271         yppasswd.h      \
 272         ypupd.h         \
 273         rpc_sztypes.h
 274 
 275 # rpcsvc headers which are generated from .x files
 276 RPCSVC_GEN_HDRS = \
 277         bootparam_prot.h \
 278         mount.h         \
 279         nfs_prot.h      \
 280         nfs4_prot.h     \
 281         nis.h           \
 282         rquota.h        \
 283         rstat.h         \
 284         rusers.h        \
 285         rwall.h         \
 286         spray.h         \
 287         ufs_prot.h      \
 288         nfs_acl.h
 289 
 290 SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
 291 SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
 292 SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
 293 SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
 294 
 295 RPCGENFLAGS = -C -h
 296 rpcsvc/rwall.h :=       RPCGENFLAGS += -M
 297 
 298 # rpcsvc rpcgen source (.x files)
 299 #
 300 # yp.x is an attempt at codifying what was hand coded in RPCL.
 301 # Unfortunately it doesn't quite work. (The handcoded stuff isn't
 302 # expressable in RPCL) this is due to the fact that YP was written
 303 # before rpcgen existed.  Hence, yp_prot.h cannot be derived from yp.x
 304 #
 305 # There is no `.h' for nis_object.x because it is included by nis.x and
 306 # the resulting .h is nis.h.
 307 
 308 RPCSVCPROTS = \
 309 $(RPCSVC_GEN_HDRS:%.h=%.x)        nis_object.x       yp.x
 310 
 311 RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS)
 312 
 313 PROTOHDRS=   dumprestore.h routed.h ripngd.h rwhod.h timed.h
 314 
 315 ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%)  \
 316         $(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%)  \
 317         $(ISOHDRS:%=$(ROOT)/usr/include/iso/%)  \
 318         $(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%)  \
 319         $(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%)  \
 320         $(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%)  \
 321         $(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%)  \
 322         $(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%)  \
 323         $(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%)
 324 
 325 DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5
 326 ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%)
 327 
 328 # check files really don't exist
 329 #
 330 # should do something with the rpcsvc headers
 331 
 332 iso/%.check:            iso/%.h
 333         $(DOT_H_CHECK)
 334 
 335 arpa/%.check:           arpa/%.h
 336         $(DOT_H_CHECK)
 337 
 338 audio/%.check:          audio/%.h
 339         $(DOT_H_CHECK)
 340 
 341 rpcsvc/%.check:         rpcsvc/%.h
 342         $(DOT_H_CHECK)
 343 
 344 rpcsvc/%.check:         rpcsvc/%.x
 345         $(DOT_X_CHECK)
 346 
 347 protocols/%.check:      protocols/%.h
 348         $(DOT_H_CHECK)
 349 
 350 kerberosv5/%.check:             kerberosv5/%.h
 351         $(DOT_H_CHECK)
 352 
 353 uuid/%.check:           uuid/%.h
 354         $(DOT_H_CHECK)
 355 
 356 # Note that the derived headers (rpcgen) are not checked at this time.  These
 357 # need work at the source level and rpcgen itself has a bug which causes a
 358 # cstyle violation.  Furthermore, there seems to be good reasons for the
 359 # generated headers to not pass all of the hdrchk rules.
 360 #
 361 # Add the following to the CHECKHDRS list to activate the .x checks:
 362 #       $(RPCSVCPROTS:%.x=rpcsvc/%.check) \
 363 #
 364 CHECKHDRS= $(HDRS:%.h=%.check)  \
 365         $(KRB5HDRS:%.h=kerberosv5/%.check)  \
 366         $(ISOHDRS:%.h=iso/%.check)  \
 367         $(ARPAHDRS:%.h=arpa/%.check)  \
 368         $(AUDIOHDRS:%.h=audio/%.check)  \
 369         $(UUIDHDRS:%.h=uuid/%.check)  \
 370         $(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \
 371         $(PROTOHDRS:%.h=protocols/%.check)
 372 
 373 # headers which won't quite meet the standards...
 374 #
 375 # assert.h is required by ansi-c to *not* be idempotent (section 4.1.2).
 376 # Hence the trailing guard is not the last thing in the file nor can it
 377 # be without playing silly games.
 378 
 379 assert.check    := HDRCHK_TAIL = | grep -v "end guard wrong" | true
 380 
 381 # install rules
 382 
 383 $(ROOT)/usr/include/security/%: security/%
 384         $(INS.file)
 385 
 386 $(ROOT)/usr/include/protocols/%: protocols/%
 387         $(INS.file)
 388 
 389 $(ROOT)/usr/include/rpcsvc/%: rpcsvc/%
 390         $(INS.file)
 391 
 392 $(ROOT)/usr/include/kerberosv5/%: kerberosv5/%
 393         $(INS.file)
 394 
 395 $(ROOT)/usr/include/arpa/%: arpa/%
 396         $(INS.file)
 397 
 398 $(ROOT)/usr/include/audio/%: audio/%
 399         $(INS.file)
 400 
 401 $(ROOT)/usr/include/iso/%: iso/%
 402         $(INS.file)
 403 
 404 $(ROOT)/usr/include/uuid/%: uuid/%
 405         $(INS.file)
 406 
 407 $(ROOT)/usr/include/%: %
 408         $(INS.file)
 409 
 410 .KEEP_STATE:
 411 
 412 .PARALLEL:      $(ROOTHDRS) $(CHECKHDRS)
 413 
 414 install_h:      $(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \
 415                 $(SYMHDRFLOAT) $(SYMHDRISO646)
 416 
 417 check:  $(CHECKHDRS)
 418 
 419 clean clobber:
 420         cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS)
 421 
 422 $(ROOTDIRS):
 423         $(INS.dir)
 424 
 425 $(SYMHDRASSERT):
 426         -$(RM) $@; $(SYMLINK) ../assert.h $@
 427 
 428 $(SYMHDRERRNO):
 429         -$(RM) $@; $(SYMLINK) ../errno.h $@
 430 
 431 $(SYMHDRFLOAT):
 432         -$(RM) $@; $(SYMLINK) ../float.h $@
 433 
 434 $(SYMHDRISO646):
 435         -$(RM) $@; $(SYMLINK) ../iso646.h $@
 436 
 437 rpcsvc/%.h:     rpcsvc/%.x
 438         $(RPCGEN) $(RPCGENFLAGS) $< -o $@
 439 
 440 rpcsvc/nis.h:   rpcsvc/nis.x
 441         $(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\
 442         $(SED) -e '/EDIT_START/,$$ d' > $@