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