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