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