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 2006 Sun Microsystems, Inc. All rights reserved. 23# Use is subject to license terms. 24# 25# ident "%Z%%M% %I% %E% SMI" 26# 27# head/Makefile 28# 29# include global definitions 30include ../Makefile.master 31 32sparc_HDRS= 33i386_HDRS= stack_unwind.h 34 35# Headers are listed one per line so that TeamWare can auto-merge most changes 36 37KRB5HDRS= mit_copyright.h mit-sipb-copyright.h 38 39ATTRDB_HDRS= secdb.h auth_attr.h exec_attr.h prof_attr.h user_attr.h \ 40 auth_list.h 41 42HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \ 43 aio.h \ 44 alloca.h \ 45 apptrace.h \ 46 apptrace_impl.h \ 47 ar.h \ 48 archives.h \ 49 assert.h \ 50 atomic.h \ 51 config_admin.h \ 52 cpio.h \ 53 crypt.h \ 54 ctype.h \ 55 deflt.h \ 56 devid.h \ 57 devmgmt.h \ 58 devpoll.h \ 59 dial.h \ 60 dirent.h \ 61 dlfcn.h \ 62 door.h \ 63 elf.h \ 64 errno.h \ 65 euc.h \ 66 exacct.h \ 67 exacct_impl.h \ 68 fatal.h \ 69 fcntl.h \ 70 float.h \ 71 fmtmsg.h \ 72 fnmatch.h \ 73 ftw.h \ 74 gelf.h \ 75 getopt.h \ 76 getwidth.h \ 77 glob.h \ 78 grp.h \ 79 iconv.h \ 80 ieeefp.h \ 81 inttypes.h \ 82 iso646.h \ 83 langinfo.h \ 84 lastlog.h \ 85 lber.h \ 86 ldap.h \ 87 libelf.h \ 88 libgen.h \ 89 libintl.h \ 90 libw.h \ 91 libzonecfg.h \ 92 limits.h \ 93 linenum.h \ 94 link.h \ 95 listen.h \ 96 locale.h \ 97 macros.h \ 98 malloc.h \ 99 mdmn_changelog.h \ 100 memory.h \ 101 meta.h \ 102 meta_runtime.h \ 103 metadyn.h \ 104 mon.h \ 105 monetary.h \ 106 mp.h \ 107 mqueue.h \ 108 nan.h \ 109 ndbm.h \ 110 netconfig.h \ 111 netdb.h \ 112 netdir.h \ 113 nl_types.h \ 114 nlist.h \ 115 note.h \ 116 nsswitch.h \ 117 nss_common.h \ 118 nss_dbdefs.h \ 119 nss_netdir.h \ 120 pcsample.h \ 121 pfmt.h \ 122 pkgdev.h \ 123 pkginfo.h \ 124 pkglocs.h \ 125 pkgstrct.h \ 126 pkgtrans.h \ 127 poll.h \ 128 port.h \ 129 priv.h \ 130 priv_utils.h \ 131 proc_service.h \ 132 procfs.h \ 133 prof.h \ 134 project.h \ 135 pthread.h \ 136 pw.h \ 137 pwd.h \ 138 rctl.h \ 139 re_comp.h \ 140 regex.h \ 141 regexp.h \ 142 resolv.h \ 143 rje.h \ 144 rtld_db.h \ 145 sac.h \ 146 sched.h \ 147 schedctl.h \ 148 sdssc.h \ 149 search.h \ 150 semaphore.h \ 151 setjmp.h \ 152 sgtty.h \ 153 shadow.h \ 154 siginfo.h \ 155 signal.h \ 156 spawn.h \ 157 stdarg.h \ 158 stdbool.h \ 159 stddef.h \ 160 stdint.h \ 161 stdio.h \ 162 stdio_ext.h \ 163 stdio_tag.h \ 164 stdio_impl.h \ 165 stdlib.h \ 166 storclass.h \ 167 string.h \ 168 strings.h \ 169 stropts.h \ 170 synch.h \ 171 sysexits.h \ 172 syslog.h \ 173 syms.h \ 174 tar.h \ 175 termio.h \ 176 termios.h \ 177 thread.h \ 178 thread_db.h \ 179 time.h \ 180 tiuser.h \ 181 tzfile.h \ 182 ucontext.h \ 183 ucred.h \ 184 ulimit.h \ 185 unistd.h \ 186 userdefs.h \ 187 ustat.h \ 188 utime.h \ 189 utmp.h \ 190 utmpx.h \ 191 valtools.h \ 192 values.h \ 193 varargs.h \ 194 wait.h \ 195 wchar.h \ 196 wchar_impl.h \ 197 wctype.h \ 198 widec.h \ 199 wordexp.h \ 200 xti.h \ 201 xti_inet.h \ 202 zone.h 203 204ISOHDRS = \ 205 ctype_c99.h \ 206 ctype_iso.h \ 207 limits_iso.h \ 208 locale_iso.h \ 209 setjmp_iso.h \ 210 signal_iso.h \ 211 stdarg_c99.h \ 212 stdarg_iso.h \ 213 stddef_iso.h \ 214 stdio_c99.h \ 215 stdio_iso.h \ 216 stdlib_c99.h \ 217 stdlib_iso.h \ 218 string_iso.h \ 219 time_iso.h \ 220 wchar_c99.h \ 221 wchar_iso.h \ 222 wctype_c99.h \ 223 wctype_iso.h 224 225ARPAHDRS = \ 226 ftp.h \ 227 inet.h \ 228 nameser.h \ 229 telnet.h \ 230 tftp.h \ 231 nameser_compat.h 232 233AUDIOHDRS = \ 234 au.h 235 236UUIDHDRS = \ 237 uuid.h 238 239# rpcsvc headers which are just headers (not derived from a .x file) 240RPCSVC_SRC_HDRS = \ 241 bootparam.h \ 242 daemon_utils.h \ 243 dbm.h \ 244 nis_db.h \ 245 nis_tags.h \ 246 nislib.h \ 247 yp_prot.h \ 248 ypclnt.h \ 249 yppasswd.h \ 250 ypupd.h \ 251 rpc_sztypes.h 252 253# rpcsvc headers which are generated from .x files 254RPCSVC_GEN_HDRS = \ 255 bootparam_prot.h \ 256 mount.h \ 257 nfs_prot.h \ 258 nfs4_prot.h \ 259 nis.h \ 260 nis_cache.h \ 261 nis_callback.h \ 262 nlm_prot.h \ 263 rex.h \ 264 rquota.h \ 265 rstat.h \ 266 rusers.h \ 267 rwall.h \ 268 spray.h \ 269 nispasswd.h \ 270 ufs_prot.h \ 271 nfs_acl.h 272 273LVMRPCHDRS = \ 274mhdx.h mdiox.h meta_basic.h metad.h metamed.h metamhd.h metacl.h 275 276SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h 277SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h 278SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h 279SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h 280 281RPCGENFLAGS = -C -h 282rpcsvc/nispasswd.h := RPCGENFLAGS += -M 283rpcsvc/rwall.h := RPCGENFLAGS += -M 284meta_basic.h := RPCGENFLAGS += -M 285metad.h := RPCGENFLAGS += -M 286metamed.h := RPCGENFLAGS += -M 287mhdx.h := RPCGENFLAGS += -M 288mdiox.h := RPCGENFLAGS += -M 289metamhd.h := RPCGENFLAGS += -M 290metacl.h := RPCGENFLAGS += -M 291 292# rpcsvc rpcgen source (.x files) 293# 294# yp.x is an attempt at codifying what was hand coded in RPCL. 295# Unfortunately it doesn't quite work. (The handcoded stuff isn't 296# expressable in RPCL) this is due to the fact that YP was written 297# before rpcgen existed. Hence, yp_prot.h cannot be derived from yp.x 298# 299# There is no `.h' for nis_object.x because it is included by nis.x and 300# the resulting .h is nis.h. 301 302RPCSVCPROTS = \ 303$(RPCSVC_GEN_HDRS:%.h=%.x) nis_object.x yp.x 304 305LVMSVCPROTS = \ 306$(LVMRPCHDRS:%.h=%.x) 307 308RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS) 309 310PROTOHDRS= dumprestore.h routed.h ripngd.h rwhod.h timed.h 311 312ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%) \ 313 $(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%) \ 314 $(ISOHDRS:%=$(ROOT)/usr/include/iso/%) \ 315 $(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%) \ 316 $(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%) \ 317 $(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%) \ 318 $(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%) \ 319 $(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%) \ 320 $(LVMRPCHDRS:%=$(ROOT)/usr/include/%) \ 321 $(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%) 322 323DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5 324ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%) 325 326SED= sed 327 328# check files really don't exist 329# 330# should do something with the rpcsvc headers 331 332iso/%.check: iso/%.h 333 $(DOT_H_CHECK) 334 335arpa/%.check: arpa/%.h 336 $(DOT_H_CHECK) 337 338audio/%.check: audio/%.h 339 $(DOT_H_CHECK) 340 341rpcsvc/%.check: rpcsvc/%.h 342 $(DOT_H_CHECK) 343 344rpcsvc/%.check: rpcsvc/%.x 345 $(DOT_X_CHECK) 346 347protocols/%.check: protocols/%.h 348 $(DOT_H_CHECK) 349 350kerberosv5/%.check: kerberosv5/%.h 351 $(DOT_H_CHECK) 352 353uuid/%.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# 364CHECKHDRS= $(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 379assert.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 414install_h: $(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \ 415 $(SYMHDRFLOAT) $(SYMHDRISO646) 416 417check: $(CHECKHDRS) 418 419clean clobber: 420 $(RM) $(LVMRPCHDRS); 421 cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS) 422 423$(ROOTDIRS): 424 $(INS.dir) 425 426$(SYMHDRASSERT): 427 -$(RM) $@; $(SYMLINK) ../assert.h $@ 428 429$(SYMHDRERRNO): 430 -$(RM) $@; $(SYMLINK) ../errno.h $@ 431 432$(SYMHDRFLOAT): 433 -$(RM) $@; $(SYMLINK) ../float.h $@ 434 435$(SYMHDRISO646): 436 -$(RM) $@; $(SYMLINK) ../iso646.h $@ 437 438rpcsvc/%.h: rpcsvc/%.x 439 $(RPCGEN) $(RPCGENFLAGS) $< -o $@ 440 441rpcsvc/nis.h: rpcsvc/nis.x 442 $(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\ 443 $(SED) -e '/EDIT_START/,$$ d' > $@ 444 445meta_basic.h: ../uts/common/sys/lvm/meta_basic.x 446 $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/meta_basic.x | \ 447 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 448 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 449 { print $0 } \ 450 ' > $@ 451 452metad.h: metad.x 453 $(RPCGEN) $(RPCGENFLAGS) metad.x | \ 454 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 455 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 456 { print $0 } \ 457 ' > $@ 458 459mhdx.h: ../uts/common/sys/lvm/mhdx.x 460 $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mhdx.x | \ 461 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 462 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 463 { print $0 } \ 464 ' > $@ 465 466mdiox.h: ../uts/common/sys/lvm/mdiox.x 467 $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mdiox.x | \ 468 nawk '{sub(/sys\/lvm\/md_mhdx/, "mhdx"); print $$0}' | \ 469 nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \ 470 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 471 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 472 { print $0 } \ 473 ' > $@ 474 475metamed.h: ../uts/common/sys/lvm/metamed.x 476 $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/metamed.x | \ 477 nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \ 478 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 479 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 480 { print $0 } \ 481 ' > $@ 482 483metamhd.h: metamhd.x 484 $(RPCGEN) $(RPCGENFLAGS) metamhd.x | \ 485 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 486 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 487 { print $0 } \ 488 ' > $@ 489 490metacl.h: metacl.x 491 $(RPCGEN) $(RPCGENFLAGS) metacl.x | \ 492 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 493 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \ 494 { print $0 } \ 495 ' > $@ 496