xref: /titanic_41/usr/src/head/Makefile (revision ac19272f7eb4a433cfccf2fdccc769cca5528169)
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	attr.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	err.h		\
66	errno.h		\
67	euc.h		\
68	exacct.h	\
69	exacct_impl.h	\
70	execinfo.h	\
71	fatal.h		\
72	fcntl.h		\
73	float.h		\
74	fmtmsg.h	\
75	fnmatch.h	\
76	ftw.h		\
77	gelf.h		\
78	getopt.h	\
79	getwidth.h	\
80	glob.h		\
81	grp.h		\
82	iconv.h		\
83	ieeefp.h	\
84	inttypes.h	\
85	iso646.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	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	nis_tags.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	nis_cache.h	\
266	nis_callback.h	\
267	nlm_prot.h	\
268	rex.h		\
269	rquota.h	\
270	rstat.h		\
271	rusers.h	\
272	rwall.h		\
273	spray.h		\
274	nispasswd.h	\
275	ufs_prot.h	\
276	nfs_acl.h
277
278LVMRPCHDRS = \
279mhdx.h mdiox.h meta_basic.h metad.h metamed.h metamhd.h metacl.h
280
281SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
282SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
283SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
284SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
285
286RPCGENFLAGS = -C -h
287rpcsvc/nispasswd.h :=	RPCGENFLAGS += -M
288rpcsvc/rwall.h :=	RPCGENFLAGS += -M
289meta_basic.h :=	RPCGENFLAGS += -M
290metad.h := RPCGENFLAGS += -M
291metamed.h := RPCGENFLAGS += -M
292mhdx.h := RPCGENFLAGS += -M
293mdiox.h := RPCGENFLAGS += -M
294metamhd.h := RPCGENFLAGS += -M
295metacl.h := RPCGENFLAGS += -M
296
297# rpcsvc rpcgen source (.x files)
298#
299# yp.x is an attempt at codifying what was hand coded in RPCL.
300# Unfortunately it doesn't quite work. (The handcoded stuff isn't
301# expressable in RPCL) this is due to the fact that YP was written
302# before rpcgen existed.  Hence, yp_prot.h cannot be derived from yp.x
303#
304# There is no `.h' for nis_object.x because it is included by nis.x and
305# the resulting .h is nis.h.
306
307RPCSVCPROTS = \
308$(RPCSVC_GEN_HDRS:%.h=%.x)        nis_object.x       yp.x
309
310LVMSVCPROTS = \
311$(LVMRPCHDRS:%.h=%.x)
312
313RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS)
314
315PROTOHDRS=   dumprestore.h routed.h ripngd.h rwhod.h timed.h
316
317ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%)  \
318	$(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%)  \
319	$(ISOHDRS:%=$(ROOT)/usr/include/iso/%)  \
320	$(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%)  \
321	$(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%)  \
322	$(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%)  \
323	$(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%)  \
324	$(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%)  \
325	$(LVMRPCHDRS:%=$(ROOT)/usr/include/%) \
326	$(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%)
327
328DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5
329ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%)
330
331SED=	sed
332
333# check files really don't exist
334#
335# should do something with the rpcsvc headers
336
337iso/%.check:		iso/%.h
338	$(DOT_H_CHECK)
339
340arpa/%.check:		arpa/%.h
341	$(DOT_H_CHECK)
342
343audio/%.check:		audio/%.h
344	$(DOT_H_CHECK)
345
346rpcsvc/%.check:		rpcsvc/%.h
347	$(DOT_H_CHECK)
348
349rpcsvc/%.check:		rpcsvc/%.x
350	$(DOT_X_CHECK)
351
352protocols/%.check:	protocols/%.h
353	$(DOT_H_CHECK)
354
355kerberosv5/%.check:             kerberosv5/%.h
356	$(DOT_H_CHECK)
357
358uuid/%.check:		uuid/%.h
359	$(DOT_H_CHECK)
360
361# Note that the derived headers (rpcgen) are not checked at this time.  These
362# need work at the source level and rpcgen itself has a bug which causes a
363# cstyle violation.  Furthermore, there seems to be good reasons for the
364# generated headers to not pass all of the hdrchk rules.
365#
366# Add the following to the CHECKHDRS list to activate the .x checks:
367#	$(RPCSVCPROTS:%.x=rpcsvc/%.check) \
368#
369CHECKHDRS= $(HDRS:%.h=%.check)  \
370	$(KRB5HDRS:%.h=kerberosv5/%.check)  \
371	$(ISOHDRS:%.h=iso/%.check)  \
372	$(ARPAHDRS:%.h=arpa/%.check)  \
373	$(AUDIOHDRS:%.h=audio/%.check)  \
374	$(UUIDHDRS:%.h=uuid/%.check)  \
375	$(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \
376	$(PROTOHDRS:%.h=protocols/%.check)
377
378# headers which won't quite meet the standards...
379#
380# assert.h is required by ansi-c to *not* be idempotent (section 4.1.2).
381# Hence the trailing guard is not the last thing in the file nor can it
382# be without playing silly games.
383
384assert.check	:= HDRCHK_TAIL = | grep -v "end guard wrong" | true
385
386# install rules
387
388$(ROOT)/usr/include/security/%: security/%
389	$(INS.file)
390
391$(ROOT)/usr/include/protocols/%: protocols/%
392	$(INS.file)
393
394$(ROOT)/usr/include/rpcsvc/%: rpcsvc/%
395	$(INS.file)
396
397$(ROOT)/usr/include/kerberosv5/%: kerberosv5/%
398	$(INS.file)
399
400$(ROOT)/usr/include/arpa/%: arpa/%
401	$(INS.file)
402
403$(ROOT)/usr/include/audio/%: audio/%
404	$(INS.file)
405
406$(ROOT)/usr/include/iso/%: iso/%
407	$(INS.file)
408
409$(ROOT)/usr/include/uuid/%: uuid/%
410	$(INS.file)
411
412$(ROOT)/usr/include/%: %
413	$(INS.file)
414
415.KEEP_STATE:
416
417.PARALLEL:	$(ROOTHDRS) $(CHECKHDRS)
418
419install_h: 	$(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \
420		$(SYMHDRFLOAT) $(SYMHDRISO646)
421
422check:	$(CHECKHDRS)
423
424clean clobber:
425	$(RM) $(LVMRPCHDRS);
426	cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS)
427
428$(ROOTDIRS):
429	$(INS.dir)
430
431$(SYMHDRASSERT):
432	-$(RM) $@; $(SYMLINK) ../assert.h $@
433
434$(SYMHDRERRNO):
435	-$(RM) $@; $(SYMLINK) ../errno.h $@
436
437$(SYMHDRFLOAT):
438	-$(RM) $@; $(SYMLINK) ../float.h $@
439
440$(SYMHDRISO646):
441	-$(RM) $@; $(SYMLINK) ../iso646.h $@
442
443rpcsvc/%.h:	rpcsvc/%.x
444	$(RPCGEN) $(RPCGENFLAGS) $< -o $@
445
446rpcsvc/nis.h:	rpcsvc/nis.x
447	$(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\
448	$(SED) -e '/EDIT_START/,$$ d' > $@
449
450meta_basic.h:	../uts/common/sys/lvm/meta_basic.x
451	$(RPCGEN) $(RPCGENFLAGS)  ../uts/common/sys/lvm/meta_basic.x | \
452	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
453	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
454	{ print $0 } \
455	' > $@
456
457metad.h:	metad.x
458	$(RPCGEN) $(RPCGENFLAGS)  metad.x | \
459	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
460	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
461	{ print $0 } \
462	' > $@
463
464mhdx.h:	../uts/common/sys/lvm/mhdx.x
465	$(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mhdx.x | \
466	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
467	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
468	{ print $0 } \
469	' > $@
470
471mdiox.h:	../uts/common/sys/lvm/mdiox.x
472	$(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mdiox.x | \
473	nawk '{sub(/sys\/lvm\/md_mhdx/, "mhdx"); print $$0}' | \
474	nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \
475	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
476	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
477	{ print $0 } \
478	' > $@
479
480metamed.h:	../uts/common/sys/lvm/metamed.x
481	$(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/metamed.x | \
482	nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \
483	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
484	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
485	{ print $0 } \
486	' > $@
487
488metamhd.h:	metamhd.x
489	$(RPCGEN) $(RPCGENFLAGS) metamhd.x | \
490	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
491	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
492	{ print $0 } \
493	' > $@
494
495metacl.h:	metacl.x
496	$(RPCGEN) $(RPCGENFLAGS) metacl.x | \
497	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
498	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
499	{ print $0 } \
500	' > $@
501