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