xref: /titanic_50/usr/src/head/Makefile (revision 489b7c4ab76ae8df137fbfcc2214f7baa52883a0)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# head/Makefile
26#
27# include global definitions
28include ../Makefile.master
29
30sparc_HDRS=
31i386_HDRS=	stack_unwind.h
32
33# Headers are listed one per line so that TeamWare can auto-merge most changes
34
35KRB5HDRS= mit_copyright.h mit-sipb-copyright.h
36
37ATTRDB_HDRS=	secdb.h auth_attr.h exec_attr.h prof_attr.h user_attr.h \
38	auth_list.h
39
40HDRS=   $($(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
208ISOHDRS = \
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
229ARPAHDRS = 		\
230	ftp.h		\
231	inet.h		\
232	nameser.h	\
233	telnet.h	\
234	tftp.h		\
235	nameser_compat.h
236
237AUDIOHDRS =		\
238	au.h
239
240UUIDHDRS =		\
241	uuid.h
242
243# rpcsvc headers which are just headers (not derived from a .x file)
244RPCSVC_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
259RPCSVC_GEN_HDRS = \
260	bootparam_prot.h \
261	mount.h		\
262	nfs_prot.h	\
263	nfs4_prot.h	\
264	nis.h		\
265	nis_cache.h	\
266	nis_callback.h	\
267	nlm_prot.h	\
268	rex.h		\
269	rquota.h	\
270	rstat.h		\
271	rusers.h	\
272	rwall.h		\
273	spray.h		\
274	nispasswd.h	\
275	ufs_prot.h	\
276	nfs_acl.h
277
278LVMRPCHDRS = \
279mhdx.h mdiox.h meta_basic.h metad.h metamed.h metamhd.h metacl.h
280
281SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
282SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
283SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
284SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
285
286RPCGENFLAGS = -C -h
287rpcsvc/nispasswd.h :=	RPCGENFLAGS += -M
288rpcsvc/rwall.h :=	RPCGENFLAGS += -M
289meta_basic.h :=	RPCGENFLAGS += -M
290metad.h := RPCGENFLAGS += -M
291metamed.h := RPCGENFLAGS += -M
292mhdx.h := RPCGENFLAGS += -M
293mdiox.h := RPCGENFLAGS += -M
294metamhd.h := RPCGENFLAGS += -M
295metacl.h := RPCGENFLAGS += -M
296
297# rpcsvc rpcgen source (.x files)
298#
299# yp.x is an attempt at codifying what was hand coded in RPCL.
300# Unfortunately it doesn't quite work. (The handcoded stuff isn't
301# expressable in RPCL) this is due to the fact that YP was written
302# before rpcgen existed.  Hence, yp_prot.h cannot be derived from yp.x
303#
304# There is no `.h' for nis_object.x because it is included by nis.x and
305# the resulting .h is nis.h.
306
307RPCSVCPROTS = \
308$(RPCSVC_GEN_HDRS:%.h=%.x)        nis_object.x       yp.x
309
310LVMSVCPROTS = \
311$(LVMRPCHDRS:%.h=%.x)
312
313RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS)
314
315PROTOHDRS=   dumprestore.h routed.h ripngd.h rwhod.h timed.h
316
317ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%)  \
318	$(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%)  \
319	$(ISOHDRS:%=$(ROOT)/usr/include/iso/%)  \
320	$(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%)  \
321	$(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%)  \
322	$(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%)  \
323	$(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%)  \
324	$(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%)  \
325	$(LVMRPCHDRS:%=$(ROOT)/usr/include/%) \
326	$(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%)
327
328DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5
329ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%)
330
331SED=	sed
332
333# check files really don't exist
334#
335# should do something with the rpcsvc headers
336
337iso/%.check:		iso/%.h
338	$(DOT_H_CHECK)
339
340arpa/%.check:		arpa/%.h
341	$(DOT_H_CHECK)
342
343audio/%.check:		audio/%.h
344	$(DOT_H_CHECK)
345
346rpcsvc/%.check:		rpcsvc/%.h
347	$(DOT_H_CHECK)
348
349rpcsvc/%.check:		rpcsvc/%.x
350	$(DOT_X_CHECK)
351
352protocols/%.check:	protocols/%.h
353	$(DOT_H_CHECK)
354
355kerberosv5/%.check:             kerberosv5/%.h
356	$(DOT_H_CHECK)
357
358uuid/%.check:		uuid/%.h
359	$(DOT_H_CHECK)
360
361# Note that the derived headers (rpcgen) are not checked at this time.  These
362# need work at the source level and rpcgen itself has a bug which causes a
363# cstyle violation.  Furthermore, there seems to be good reasons for the
364# generated headers to not pass all of the hdrchk rules.
365#
366# Add the following to the CHECKHDRS list to activate the .x checks:
367#	$(RPCSVCPROTS:%.x=rpcsvc/%.check) \
368#
369CHECKHDRS= $(HDRS:%.h=%.check)  \
370	$(KRB5HDRS:%.h=kerberosv5/%.check)  \
371	$(ISOHDRS:%.h=iso/%.check)  \
372	$(ARPAHDRS:%.h=arpa/%.check)  \
373	$(AUDIOHDRS:%.h=audio/%.check)  \
374	$(UUIDHDRS:%.h=uuid/%.check)  \
375	$(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \
376	$(PROTOHDRS:%.h=protocols/%.check)
377
378# headers which won't quite meet the standards...
379#
380# assert.h is required by ansi-c to *not* be idempotent (section 4.1.2).
381# Hence the trailing guard is not the last thing in the file nor can it
382# be without playing silly games.
383
384assert.check	:= HDRCHK_TAIL = | grep -v "end guard wrong" | true
385
386# install rules
387
388$(ROOT)/usr/include/security/%: security/%
389	$(INS.file)
390
391$(ROOT)/usr/include/protocols/%: protocols/%
392	$(INS.file)
393
394$(ROOT)/usr/include/rpcsvc/%: rpcsvc/%
395	$(INS.file)
396
397$(ROOT)/usr/include/kerberosv5/%: kerberosv5/%
398	$(INS.file)
399
400$(ROOT)/usr/include/arpa/%: arpa/%
401	$(INS.file)
402
403$(ROOT)/usr/include/audio/%: audio/%
404	$(INS.file)
405
406$(ROOT)/usr/include/iso/%: iso/%
407	$(INS.file)
408
409$(ROOT)/usr/include/uuid/%: uuid/%
410	$(INS.file)
411
412$(ROOT)/usr/include/%: %
413	$(INS.file)
414
415.KEEP_STATE:
416
417.PARALLEL:	$(ROOTHDRS) $(CHECKHDRS)
418
419install_h: 	$(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \
420		$(SYMHDRFLOAT) $(SYMHDRISO646)
421
422check:	$(CHECKHDRS)
423
424clean clobber:
425	$(RM) $(LVMRPCHDRS);
426	cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS)
427
428$(ROOTDIRS):
429	$(INS.dir)
430
431$(SYMHDRASSERT):
432	-$(RM) $@; $(SYMLINK) ../assert.h $@
433
434$(SYMHDRERRNO):
435	-$(RM) $@; $(SYMLINK) ../errno.h $@
436
437$(SYMHDRFLOAT):
438	-$(RM) $@; $(SYMLINK) ../float.h $@
439
440$(SYMHDRISO646):
441	-$(RM) $@; $(SYMLINK) ../iso646.h $@
442
443rpcsvc/%.h:	rpcsvc/%.x
444	$(RPCGEN) $(RPCGENFLAGS) $< -o $@
445
446rpcsvc/nis.h:	rpcsvc/nis.x
447	$(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\
448	$(SED) -e '/EDIT_START/,$$ d' > $@
449
450meta_basic.h:	../uts/common/sys/lvm/meta_basic.x
451	$(RPCGEN) $(RPCGENFLAGS)  ../uts/common/sys/lvm/meta_basic.x | \
452	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
453	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
454	{ print $0 } \
455	' > $@
456
457metad.h:	metad.x
458	$(RPCGEN) $(RPCGENFLAGS)  metad.x | \
459	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
460	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
461	{ print $0 } \
462	' > $@
463
464mhdx.h:	../uts/common/sys/lvm/mhdx.x
465	$(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mhdx.x | \
466	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
467	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
468	{ print $0 } \
469	' > $@
470
471mdiox.h:	../uts/common/sys/lvm/mdiox.x
472	$(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mdiox.x | \
473	nawk '{sub(/sys\/lvm\/md_mhdx/, "mhdx"); print $$0}' | \
474	nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \
475	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
476	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
477	{ print $0 } \
478	' > $@
479
480metamed.h:	../uts/common/sys/lvm/metamed.x
481	$(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/metamed.x | \
482	nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \
483	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
484	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
485	{ print $0 } \
486	' > $@
487
488metamhd.h:	metamhd.x
489	$(RPCGEN) $(RPCGENFLAGS) metamhd.x | \
490	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
491	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
492	{ print $0 } \
493	' > $@
494
495metacl.h:	metacl.x
496	$(RPCGEN) $(RPCGENFLAGS) metacl.x | \
497	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
498	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
499	{ print $0 } \
500	' > $@
501