xref: /titanic_51/usr/src/head/Makefile (revision a49a392f179e40c74ea8903bf2793b2aa49efdf1)
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	err.h		\
65	errno.h		\
66	euc.h		\
67	exacct.h	\
68	exacct_impl.h	\
69	execinfo.h	\
70	fatal.h		\
71	fcntl.h		\
72	float.h		\
73	fmtmsg.h	\
74	fnmatch.h	\
75	ftw.h		\
76	gelf.h		\
77	getopt.h	\
78	getwidth.h	\
79	glob.h		\
80	grp.h		\
81	iconv.h		\
82	ieeefp.h	\
83	inttypes.h	\
84	iso646.h	\
85	langinfo.h	\
86	lastlog.h	\
87	lber.h		\
88	ldap.h		\
89	libelf.h	\
90	libgen.h	\
91	libintl.h	\
92	libw.h		\
93	libzonecfg.h	\
94	limits.h	\
95	linenum.h	\
96	link.h		\
97	listen.h	\
98	locale.h	\
99	macros.h	\
100	malloc.h	\
101	mdmn_changelog.h	\
102	memory.h	\
103	meta.h		\
104	meta_runtime.h	\
105	metadyn.h	\
106	mon.h		\
107	monetary.h	\
108	mp.h		\
109	mqueue.h	\
110	nan.h		\
111	ndbm.h		\
112	ndpd.h		\
113	netconfig.h	\
114	netdb.h		\
115	netdir.h	\
116	nl_types.h	\
117	nlist.h		\
118	note.h		\
119	nsswitch.h	\
120	nss_common.h	\
121	nss_dbdefs.h	\
122	nss_netdir.h	\
123	pcsample.h	\
124	pfmt.h		\
125	pkgdev.h	\
126	pkginfo.h	\
127	pkglocs.h	\
128	pkgstrct.h	\
129	pkgtrans.h	\
130	poll.h		\
131	port.h		\
132	priv.h		\
133	priv_utils.h	\
134	proc_service.h	\
135	procfs.h	\
136	prof.h		\
137	project.h	\
138	pthread.h	\
139	pw.h		\
140	pwd.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	svc_dg_priv.h	\
251	yp_prot.h	\
252	ypclnt.h	\
253	yppasswd.h	\
254	ypupd.h		\
255	rpc_sztypes.h
256
257# rpcsvc headers which are generated from .x files
258RPCSVC_GEN_HDRS = \
259	bootparam_prot.h \
260	mount.h		\
261	nfs_prot.h	\
262	nfs4_prot.h	\
263	nis.h		\
264	nis_cache.h	\
265	nis_callback.h	\
266	nlm_prot.h	\
267	rex.h		\
268	rquota.h	\
269	rstat.h		\
270	rusers.h	\
271	rwall.h		\
272	spray.h		\
273	nispasswd.h	\
274	ufs_prot.h	\
275	nfs_acl.h
276
277LVMRPCHDRS = \
278mhdx.h mdiox.h meta_basic.h metad.h metamed.h metamhd.h metacl.h
279
280SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
281SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
282SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
283SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
284
285RPCGENFLAGS = -C -h
286rpcsvc/nispasswd.h :=	RPCGENFLAGS += -M
287rpcsvc/rwall.h :=	RPCGENFLAGS += -M
288meta_basic.h :=	RPCGENFLAGS += -M
289metad.h := RPCGENFLAGS += -M
290metamed.h := RPCGENFLAGS += -M
291mhdx.h := RPCGENFLAGS += -M
292mdiox.h := RPCGENFLAGS += -M
293metamhd.h := RPCGENFLAGS += -M
294metacl.h := RPCGENFLAGS += -M
295
296# rpcsvc rpcgen source (.x files)
297#
298# yp.x is an attempt at codifying what was hand coded in RPCL.
299# Unfortunately it doesn't quite work. (The handcoded stuff isn't
300# expressable in RPCL) this is due to the fact that YP was written
301# before rpcgen existed.  Hence, yp_prot.h cannot be derived from yp.x
302#
303# There is no `.h' for nis_object.x because it is included by nis.x and
304# the resulting .h is nis.h.
305
306RPCSVCPROTS = \
307$(RPCSVC_GEN_HDRS:%.h=%.x)        nis_object.x       yp.x
308
309LVMSVCPROTS = \
310$(LVMRPCHDRS:%.h=%.x)
311
312RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS)
313
314PROTOHDRS=   dumprestore.h routed.h ripngd.h rwhod.h timed.h
315
316ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%)  \
317	$(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%)  \
318	$(ISOHDRS:%=$(ROOT)/usr/include/iso/%)  \
319	$(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%)  \
320	$(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%)  \
321	$(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%)  \
322	$(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%)  \
323	$(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%)  \
324	$(LVMRPCHDRS:%=$(ROOT)/usr/include/%) \
325	$(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%)
326
327DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5
328ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%)
329
330SED=	sed
331
332# check files really don't exist
333#
334# should do something with the rpcsvc headers
335
336iso/%.check:		iso/%.h
337	$(DOT_H_CHECK)
338
339arpa/%.check:		arpa/%.h
340	$(DOT_H_CHECK)
341
342audio/%.check:		audio/%.h
343	$(DOT_H_CHECK)
344
345rpcsvc/%.check:		rpcsvc/%.h
346	$(DOT_H_CHECK)
347
348rpcsvc/%.check:		rpcsvc/%.x
349	$(DOT_X_CHECK)
350
351protocols/%.check:	protocols/%.h
352	$(DOT_H_CHECK)
353
354kerberosv5/%.check:             kerberosv5/%.h
355	$(DOT_H_CHECK)
356
357uuid/%.check:		uuid/%.h
358	$(DOT_H_CHECK)
359
360# Note that the derived headers (rpcgen) are not checked at this time.  These
361# need work at the source level and rpcgen itself has a bug which causes a
362# cstyle violation.  Furthermore, there seems to be good reasons for the
363# generated headers to not pass all of the hdrchk rules.
364#
365# Add the following to the CHECKHDRS list to activate the .x checks:
366#	$(RPCSVCPROTS:%.x=rpcsvc/%.check) \
367#
368CHECKHDRS= $(HDRS:%.h=%.check)  \
369	$(KRB5HDRS:%.h=kerberosv5/%.check)  \
370	$(ISOHDRS:%.h=iso/%.check)  \
371	$(ARPAHDRS:%.h=arpa/%.check)  \
372	$(AUDIOHDRS:%.h=audio/%.check)  \
373	$(UUIDHDRS:%.h=uuid/%.check)  \
374	$(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \
375	$(PROTOHDRS:%.h=protocols/%.check)
376
377# headers which won't quite meet the standards...
378#
379# assert.h is required by ansi-c to *not* be idempotent (section 4.1.2).
380# Hence the trailing guard is not the last thing in the file nor can it
381# be without playing silly games.
382
383assert.check	:= HDRCHK_TAIL = | grep -v "end guard wrong" | true
384
385# install rules
386
387$(ROOT)/usr/include/security/%: security/%
388	$(INS.file)
389
390$(ROOT)/usr/include/protocols/%: protocols/%
391	$(INS.file)
392
393$(ROOT)/usr/include/rpcsvc/%: rpcsvc/%
394	$(INS.file)
395
396$(ROOT)/usr/include/kerberosv5/%: kerberosv5/%
397	$(INS.file)
398
399$(ROOT)/usr/include/arpa/%: arpa/%
400	$(INS.file)
401
402$(ROOT)/usr/include/audio/%: audio/%
403	$(INS.file)
404
405$(ROOT)/usr/include/iso/%: iso/%
406	$(INS.file)
407
408$(ROOT)/usr/include/uuid/%: uuid/%
409	$(INS.file)
410
411$(ROOT)/usr/include/%: %
412	$(INS.file)
413
414.KEEP_STATE:
415
416.PARALLEL:	$(ROOTHDRS) $(CHECKHDRS)
417
418install_h: 	$(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \
419		$(SYMHDRFLOAT) $(SYMHDRISO646)
420
421check:	$(CHECKHDRS)
422
423clean clobber:
424	$(RM) $(LVMRPCHDRS);
425	cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS)
426
427$(ROOTDIRS):
428	$(INS.dir)
429
430$(SYMHDRASSERT):
431	-$(RM) $@; $(SYMLINK) ../assert.h $@
432
433$(SYMHDRERRNO):
434	-$(RM) $@; $(SYMLINK) ../errno.h $@
435
436$(SYMHDRFLOAT):
437	-$(RM) $@; $(SYMLINK) ../float.h $@
438
439$(SYMHDRISO646):
440	-$(RM) $@; $(SYMLINK) ../iso646.h $@
441
442rpcsvc/%.h:	rpcsvc/%.x
443	$(RPCGEN) $(RPCGENFLAGS) $< -o $@
444
445rpcsvc/nis.h:	rpcsvc/nis.x
446	$(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\
447	$(SED) -e '/EDIT_START/,$$ d' > $@
448
449meta_basic.h:	../uts/common/sys/lvm/meta_basic.x
450	$(RPCGEN) $(RPCGENFLAGS)  ../uts/common/sys/lvm/meta_basic.x | \
451	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
452	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
453	{ print $0 } \
454	' > $@
455
456metad.h:	metad.x
457	$(RPCGEN) $(RPCGENFLAGS)  metad.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
463mhdx.h:	../uts/common/sys/lvm/mhdx.x
464	$(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mhdx.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
470mdiox.h:	../uts/common/sys/lvm/mdiox.x
471	$(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mdiox.x | \
472	nawk '{sub(/sys\/lvm\/md_mhdx/, "mhdx"); print $$0}' | \
473	nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \
474	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
475	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
476	{ print $0 } \
477	' > $@
478
479metamed.h:	../uts/common/sys/lvm/metamed.x
480	$(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/metamed.x | \
481	nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \
482	awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
483	/<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
484	{ print $0 } \
485	' > $@
486
487metamhd.h:	metamhd.x
488	$(RPCGEN) $(RPCGENFLAGS) metamhd.x | \
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
494metacl.h:	metacl.x
495	$(RPCGEN) $(RPCGENFLAGS) metacl.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