xref: /titanic_50/usr/src/head/Makefile (revision 1ce128c5034a35ed7c3b67b10eae594fac4420d9)
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
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	nislib.h	\
250	svc_dg_priv.h	\
251	yp_prot.h	\
252	ypclnt.h	\
253	yppasswd.h	\
254	ypupd.h		\
255	rpc_sztypes.h
256
257# rpcsvc headers which are generated from .x files
258RPCSVC_GEN_HDRS = \
259	bootparam_prot.h \
260	mount.h		\
261	nfs_prot.h	\
262	nfs4_prot.h	\
263	nis.h		\
264	nlm_prot.h	\
265	rex.h		\
266	rquota.h	\
267	rstat.h		\
268	rusers.h	\
269	rwall.h		\
270	spray.h		\
271	ufs_prot.h	\
272	nfs_acl.h
273
274LVMRPCHDRS = \
275mhdx.h mdiox.h meta_basic.h metad.h metamed.h metamhd.h metacl.h
276
277SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
278SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
279SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
280SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
281
282RPCGENFLAGS = -C -h
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