xref: /illumos-gate/usr/src/head/Makefile (revision cc52cd5b)
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	config_admin.h	\
52	cpio.h		\
53	crypt.h		\
54	ctype.h		\
55	deflt.h		\
56	devid.h		\
57	devmgmt.h	\
58	devpoll.h	\
59	dial.h		\
60	dirent.h	\
61	dlfcn.h		\
62	door.h		\
63	elf.h		\
64	errno.h		\
65	euc.h		\
66	exacct.h	\
67	exacct_impl.h	\
68	fatal.h		\
69	fcntl.h		\
70	float.h		\
71	fmtmsg.h	\
72	fnmatch.h	\
73	ftw.h		\
74	gelf.h		\
75	getopt.h	\
76	getwidth.h	\
77	glob.h		\
78	grp.h		\
79	iconv.h		\
80	ieeefp.h	\
81	inttypes.h	\
82	iso646.h	\
83	langinfo.h	\
84	lastlog.h	\
85	lber.h		\
86	ldap.h		\
87	libelf.h	\
88	libgen.h	\
89	libintl.h	\
90	libw.h		\
91	libzonecfg.h	\
92	limits.h	\
93	linenum.h	\
94	link.h		\
95	listen.h	\
96	locale.h	\
97	macros.h	\
98	malloc.h	\
99	mdmn_changelog.h	\
100	memory.h	\
101	meta.h		\
102	meta_runtime.h	\
103	metadyn.h	\
104	mon.h		\
105	monetary.h	\
106	mp.h		\
107	mqueue.h	\
108	nan.h		\
109	ndbm.h		\
110	ndpd.h		\
111	netconfig.h	\
112	netdb.h		\
113	netdir.h	\
114	nl_types.h	\
115	nlist.h		\
116	note.h		\
117	nsswitch.h	\
118	nss_common.h	\
119	nss_dbdefs.h	\
120	nss_netdir.h	\
121	pcsample.h	\
122	pfmt.h		\
123	pkgdev.h	\
124	pkginfo.h	\
125	pkglocs.h	\
126	pkgstrct.h	\
127	pkgtrans.h	\
128	poll.h		\
129	port.h		\
130	priv.h		\
131	priv_utils.h	\
132	proc_service.h	\
133	procfs.h	\
134	prof.h		\
135	project.h	\
136	pthread.h	\
137	pw.h		\
138	pwd.h		\
139	raidcfg.h	\
140	raidcfg_spi.h	\
141	rctl.h		\
142	re_comp.h	\
143	regex.h		\
144	regexp.h	\
145	resolv.h	\
146	rje.h		\
147	rtld_db.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