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