xref: /titanic_51/usr/src/head/Makefile (revision 7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fe)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28# head/Makefile
29#
30# include global definitions
31include ../Makefile.master
32
33sparc_HDRS=
34i386_HDRS=	stack_unwind.h
35
36# Headers are listed one per line so that TeamWare can auto-merge most changes
37
38KRB5HDRS= mit_copyright.h mit-sipb-copyright.h
39
40ATTRDB_HDRS=	secdb.h auth_attr.h exec_attr.h prof_attr.h user_attr.h \
41	auth_list.h
42
43HDRS=   $($(MACH)_HDRS)  $(ATTRDB_HDRS) \
44	aio.h		\
45	alloca.h	\
46	apptrace.h	\
47	apptrace_impl.h	\
48	ar.h		\
49	archives.h	\
50	assert.h	\
51	atomic.h	\
52	config_admin.h	\
53	cpio.h		\
54	crypt.h		\
55	ctype.h		\
56	deflt.h		\
57	devid.h		\
58	devmgmt.h	\
59	devpoll.h	\
60	dial.h		\
61	dirent.h	\
62	dlfcn.h		\
63	door.h		\
64	elf.h		\
65	errno.h		\
66	euc.h		\
67	exacct.h	\
68	exacct_impl.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	md5.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	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	rmmount.h	\
148	sac.h		\
149	sched.h		\
150	schedctl.h	\
151	sdssc.h		\
152	search.h	\
153	semaphore.h	\
154	setjmp.h	\
155	sgtty.h		\
156	shadow.h	\
157	siginfo.h	\
158	signal.h	\
159	spawn.h		\
160	stdarg.h	\
161	stdbool.h	\
162	stddef.h	\
163	stdint.h	\
164	stdio.h		\
165	stdio_ext.h	\
166	stdio_tag.h	\
167	stdio_impl.h	\
168	stdlib.h	\
169	storclass.h	\
170	string.h	\
171	strings.h	\
172	stropts.h	\
173	synch.h		\
174	sysexits.h	\
175	syslog.h	\
176	syms.h		\
177	tar.h		\
178	termio.h	\
179	termios.h	\
180	thread.h	\
181	thread_db.h	\
182	time.h		\
183	tiuser.h	\
184	tzfile.h	\
185	ucontext.h	\
186	ucred.h		\
187	ulimit.h	\
188	unistd.h	\
189	userdefs.h	\
190	ustat.h		\
191	utime.h		\
192	utmp.h		\
193	utmpx.h		\
194	valtools.h	\
195	values.h	\
196	varargs.h	\
197	wait.h		\
198	wchar.h		\
199	wchar_impl.h	\
200	wctype.h	\
201	widec.h		\
202	wordexp.h	\
203	xti.h		\
204	xti_inet.h	\
205	zone.h
206
207ISOHDRS = \
208	ctype_c99.h	\
209	ctype_iso.h	\
210	limits_iso.h	\
211	locale_iso.h	\
212	setjmp_iso.h  	\
213	signal_iso.h	\
214	stdarg_c99.h	\
215	stdarg_iso.h	\
216	stddef_iso.h	\
217	stdio_c99.h	\
218	stdio_iso.h	\
219	stdlib_c99.h	\
220	stdlib_iso.h	\
221	string_iso.h	\
222	time_iso.h	\
223	wchar_c99.h	\
224	wchar_iso.h	\
225	wctype_c99.h	\
226	wctype_iso.h
227
228ARPAHDRS = 		\
229	ftp.h		\
230	inet.h		\
231	nameser.h	\
232	telnet.h	\
233	tftp.h		\
234	nameser_compat.h
235
236AUDIOHDRS =		\
237	au.h
238
239UUIDHDRS =		\
240	uuid.h
241
242# rpcsvc headers which are just headers (not derived from a .x file)
243RPCSVC_SRC_HDRS =	\
244	bootparam.h	\
245	daemon_utils.h	\
246	dbm.h		\
247	nis_db.h	\
248	nis_tags.h	\
249	nislib.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