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