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