xref: /titanic_44/usr/src/head/Makefile (revision 3470957343f37ed9baa957980891dbbe4c2d7092)
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 2006 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	fatal.h		\
69	fcntl.h		\
70	float.h		\
71	fmtmsg.h	\
72	fnmatch.h	\
73	ftw.h		\
74	gelf.h		\
75	getopt.h	\
76	getwidth.h	\
77	glob.h		\
78	grp.h		\
79	iconv.h		\
80	ieeefp.h	\
81	inttypes.h	\
82	iso646.h	\
83	langinfo.h	\
84	lastlog.h	\
85	lber.h		\
86	ldap.h		\
87	libelf.h	\
88	libgen.h	\
89	libintl.h	\
90	libw.h		\
91	libzonecfg.h	\
92	limits.h	\
93	linenum.h	\
94	link.h		\
95	listen.h	\
96	locale.h	\
97	macros.h	\
98	malloc.h	\
99	mdmn_changelog.h	\
100	memory.h	\
101	meta.h		\
102	meta_runtime.h	\
103	metadyn.h	\
104	mon.h		\
105	monetary.h	\
106	mp.h		\
107	mqueue.h	\
108	nan.h		\
109	ndbm.h		\
110	netconfig.h	\
111	netdb.h		\
112	netdir.h	\
113	nl_types.h	\
114	nlist.h		\
115	note.h		\
116	nsswitch.h	\
117	nss_common.h	\
118	nss_dbdefs.h	\
119	nss_netdir.h	\
120	pcsample.h	\
121	pfmt.h		\
122	pkgdev.h	\
123	pkginfo.h	\
124	pkglocs.h	\
125	pkgstrct.h	\
126	pkgtrans.h	\
127	poll.h		\
128	port.h		\
129	priv.h		\
130	priv_utils.h	\
131	proc_service.h	\
132	procfs.h	\
133	prof.h		\
134	project.h	\
135	pthread.h	\
136	pw.h		\
137	pwd.h		\
138	rctl.h		\
139	re_comp.h	\
140	regex.h		\
141	regexp.h	\
142	resolv.h	\
143	rje.h		\
144	rtld_db.h	\
145	rmmount.h	\
146	sac.h		\
147	sched.h		\
148	schedctl.h	\
149	sdssc.h		\
150	search.h	\
151	semaphore.h	\
152	setjmp.h	\
153	sgtty.h		\
154	shadow.h	\
155	siginfo.h	\
156	signal.h	\
157	spawn.h		\
158	stdarg.h	\
159	stdbool.h	\
160	stddef.h	\
161	stdint.h	\
162	stdio.h		\
163	stdio_ext.h	\
164	stdio_tag.h	\
165	stdio_impl.h	\
166	stdlib.h	\
167	storclass.h	\
168	string.h	\
169	strings.h	\
170	stropts.h	\
171	synch.h		\
172	sysexits.h	\
173	syslog.h	\
174	syms.h		\
175	tar.h		\
176	termio.h	\
177	termios.h	\
178	thread.h	\
179	thread_db.h	\
180	time.h		\
181	tiuser.h	\
182	tzfile.h	\
183	ucontext.h	\
184	ucred.h		\
185	ulimit.h	\
186	unistd.h	\
187	userdefs.h	\
188	ustat.h		\
189	utime.h		\
190	utmp.h		\
191	utmpx.h		\
192	valtools.h	\
193	values.h	\
194	varargs.h	\
195	wait.h		\
196	wchar.h		\
197	wchar_impl.h	\
198	wctype.h	\
199	widec.h		\
200	wordexp.h	\
201	xti.h		\
202	xti_inet.h	\
203	zone.h
204
205ISOHDRS = \
206	ctype_c99.h	\
207	ctype_iso.h	\
208	limits_iso.h	\
209	locale_iso.h	\
210	setjmp_iso.h  	\
211	signal_iso.h	\
212	stdarg_c99.h	\
213	stdarg_iso.h	\
214	stddef_iso.h	\
215	stdio_c99.h	\
216	stdio_iso.h	\
217	stdlib_c99.h	\
218	stdlib_iso.h	\
219	string_iso.h	\
220	time_iso.h	\
221	wchar_c99.h	\
222	wchar_iso.h	\
223	wctype_c99.h	\
224	wctype_iso.h
225
226ARPAHDRS = 		\
227	ftp.h		\
228	inet.h		\
229	nameser.h	\
230	telnet.h	\
231	tftp.h		\
232	nameser_compat.h
233
234AUDIOHDRS =		\
235	au.h
236
237UUIDHDRS =		\
238	uuid.h
239
240# rpcsvc headers which are just headers (not derived from a .x file)
241RPCSVC_SRC_HDRS =	\
242	bootparam.h	\
243	daemon_utils.h	\
244	dbm.h		\
245	nis_db.h	\
246	nis_tags.h	\
247	nislib.h	\
248	yp_prot.h	\
249	ypclnt.h	\
250	yppasswd.h	\
251	ypupd.h		\
252	rpc_sztypes.h
253
254# rpcsvc headers which are generated from .x files
255RPCSVC_GEN_HDRS = \
256	bootparam_prot.h \
257	mount.h		\
258	nfs_prot.h	\
259	nfs4_prot.h	\
260	nis.h		\
261	nis_cache.h	\
262	nis_callback.h	\
263	nlm_prot.h	\
264	rex.h		\
265	rquota.h	\
266	rstat.h		\
267	rusers.h	\
268	rwall.h		\
269	spray.h		\
270	nispasswd.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/nispasswd.h :=	RPCGENFLAGS += -M
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