xref: /titanic_44/usr/src/head/Makefile (revision e01ec5d5f4fc831c481861bbc5813ed87c953ac4)
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 2016 Nexenta Systems, Inc.
27#
28
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	memory.h	\
113	mon.h		\
114	monetary.h	\
115	mp.h		\
116	mqueue.h	\
117	nan.h		\
118	ndbm.h		\
119	ndpd.h		\
120	netconfig.h	\
121	netdb.h		\
122	netdir.h	\
123	nl_types.h	\
124	nlist.h		\
125	note.h		\
126	nsctl.h		\
127	nsswitch.h	\
128	nss_common.h	\
129	nss_dbdefs.h	\
130	nss_netdir.h	\
131	paths.h		\
132	pcsample.h	\
133	pfmt.h		\
134	pkgdev.h	\
135	pkginfo.h	\
136	pkglocs.h	\
137	pkgstrct.h	\
138	pkgtrans.h	\
139	poll.h		\
140	port.h		\
141	priv.h		\
142	priv_utils.h	\
143	proc_service.h	\
144	procfs.h	\
145	prof.h		\
146	project.h	\
147	pthread.h	\
148	pw.h		\
149	pwd.h		\
150	rctl.h		\
151	re_comp.h	\
152	regex.h		\
153	regexp.h	\
154	resolv.h	\
155	rje.h		\
156	rtld_db.h	\
157	sac.h		\
158	sched.h		\
159	schedctl.h	\
160	search.h	\
161	semaphore.h	\
162	setjmp.h	\
163	sgtty.h		\
164	shadow.h	\
165	siginfo.h	\
166	signal.h	\
167	spawn.h		\
168	stdalign.h	\
169	stdarg.h	\
170	stdbool.h	\
171	stddef.h	\
172	stdint.h	\
173	stdio.h		\
174	stdio_ext.h	\
175	stdio_tag.h	\
176	stdio_impl.h	\
177	stdlib.h	\
178	stdnoreturn.h	\
179	storclass.h	\
180	string.h	\
181	strings.h	\
182	stropts.h	\
183	synch.h		\
184	sysexits.h	\
185	syslog.h	\
186	syms.h		\
187	tar.h		\
188	termio.h	\
189	termios.h	\
190	tgmath.h	\
191	thread.h	\
192	thread_db.h	\
193	threads.h	\
194	time.h		\
195	tiuser.h	\
196	tzfile.h	\
197	ucontext.h	\
198	ucred.h		\
199	ulimit.h	\
200	unistd.h	\
201	userdefs.h	\
202	ustat.h		\
203	utime.h		\
204	utmp.h		\
205	utmpx.h		\
206	valtools.h	\
207	values.h	\
208	varargs.h	\
209	wait.h		\
210	wchar.h		\
211	wchar_impl.h	\
212	wctype.h	\
213	widec.h		\
214	wordexp.h	\
215	xlocale.h	\
216	xti.h		\
217	xti_inet.h	\
218	zone.h
219
220ISOHDRS = \
221	ctype_iso.h	\
222	limits_iso.h	\
223	locale_iso.h	\
224	math_c99.h	\
225	math_iso.h	\
226	setjmp_iso.h  	\
227	signal_iso.h	\
228	stdarg_c99.h	\
229	stdarg_iso.h	\
230	stddef_iso.h	\
231	stdio_c99.h	\
232	stdio_iso.h	\
233	stdlib_c99.h	\
234	stdlib_c11.h	\
235	stdlib_iso.h	\
236	string_iso.h	\
237	time_iso.h	\
238	wchar_c99.h	\
239	wchar_iso.h	\
240	wctype_iso.h
241
242ARPAHDRS = 		\
243	ftp.h		\
244	inet.h		\
245	nameser.h	\
246	telnet.h	\
247	tftp.h		\
248	nameser_compat.h
249
250AUDIOHDRS =		\
251	au.h
252
253UUIDHDRS =		\
254	uuid.h
255
256# rpcsvc headers which are just headers (not derived from a .x file)
257RPCSVC_SRC_HDRS =	\
258	bootparam.h	\
259	daemon_utils.h	\
260	dbm.h		\
261	nis_db.h	\
262	nislib.h	\
263	svc_dg_priv.h	\
264	yp_prot.h	\
265	ypclnt.h	\
266	yppasswd.h	\
267	ypupd.h		\
268	rpc_sztypes.h
269
270# rpcsvc headers which are generated from .x files
271RPCSVC_GEN_HDRS = \
272	bootparam_prot.h \
273	mount.h		\
274	nfs_prot.h	\
275	nfs4_prot.h	\
276	nis.h		\
277	rex.h		\
278	rquota.h	\
279	rstat.h		\
280	rusers.h	\
281	rwall.h		\
282	spray.h		\
283	ufs_prot.h	\
284	nfs_acl.h
285
286SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
287SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
288SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
289SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
290
291RPCGENFLAGS = -C -h
292rpcsvc/rwall.h :=	RPCGENFLAGS += -M
293
294# rpcsvc rpcgen source (.x files)
295#
296# yp.x is an attempt at codifying what was hand coded in RPCL.
297# Unfortunately it doesn't quite work. (The handcoded stuff isn't
298# expressable in RPCL) this is due to the fact that YP was written
299# before rpcgen existed.  Hence, yp_prot.h cannot be derived from yp.x
300#
301# There is no `.h' for nis_object.x because it is included by nis.x and
302# the resulting .h is nis.h.
303
304RPCSVCPROTS = \
305$(RPCSVC_GEN_HDRS:%.h=%.x)        nis_object.x       yp.x
306
307RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS)
308
309PROTOHDRS=   dumprestore.h routed.h ripngd.h rwhod.h timed.h
310
311ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%)  \
312	$(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%)  \
313	$(ISOHDRS:%=$(ROOT)/usr/include/iso/%)  \
314	$(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%)  \
315	$(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%)  \
316	$(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%)  \
317	$(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%)  \
318	$(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%)  \
319	$(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%)
320
321DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5
322ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%)
323
324SED=	sed
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