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