xref: /titanic_51/usr/src/head/Makefile (revision d2670fc40c4567a1426992012f9a8666e3fa1098)
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	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	storclass.h	\
179	string.h	\
180	strings.h	\
181	stropts.h	\
182	synch.h		\
183	sysexits.h	\
184	syslog.h	\
185	syms.h		\
186	tar.h		\
187	termio.h	\
188	termios.h	\
189	tgmath.h	\
190	thread.h	\
191	thread_db.h	\
192	time.h		\
193	tiuser.h	\
194	tzfile.h	\
195	ucontext.h	\
196	ucred.h		\
197	ulimit.h	\
198	unistd.h	\
199	userdefs.h	\
200	ustat.h		\
201	utime.h		\
202	utmp.h		\
203	utmpx.h		\
204	valtools.h	\
205	values.h	\
206	varargs.h	\
207	wait.h		\
208	wchar.h		\
209	wchar_impl.h	\
210	wctype.h	\
211	widec.h		\
212	wordexp.h	\
213	xlocale.h	\
214	xti.h		\
215	xti_inet.h	\
216	zone.h
217
218ISOHDRS = \
219	ctype_iso.h	\
220	limits_iso.h	\
221	locale_iso.h	\
222	math_c99.h	\
223	math_iso.h	\
224	setjmp_iso.h  	\
225	signal_iso.h	\
226	stdarg_c99.h	\
227	stdarg_iso.h	\
228	stddef_iso.h	\
229	stdio_c99.h	\
230	stdio_iso.h	\
231	stdlib_c99.h	\
232	stdlib_iso.h	\
233	string_iso.h	\
234	time_iso.h	\
235	wchar_c99.h	\
236	wchar_iso.h	\
237	wctype_iso.h
238
239ARPAHDRS = 		\
240	ftp.h		\
241	inet.h		\
242	nameser.h	\
243	telnet.h	\
244	tftp.h		\
245	nameser_compat.h
246
247AUDIOHDRS =		\
248	au.h
249
250UUIDHDRS =		\
251	uuid.h
252
253# rpcsvc headers which are just headers (not derived from a .x file)
254RPCSVC_SRC_HDRS =	\
255	bootparam.h	\
256	daemon_utils.h	\
257	dbm.h		\
258	nis_db.h	\
259	nislib.h	\
260	svc_dg_priv.h	\
261	yp_prot.h	\
262	ypclnt.h	\
263	yppasswd.h	\
264	ypupd.h		\
265	rpc_sztypes.h
266
267# rpcsvc headers which are generated from .x files
268RPCSVC_GEN_HDRS = \
269	bootparam_prot.h \
270	mount.h		\
271	nfs_prot.h	\
272	nfs4_prot.h	\
273	nis.h		\
274	rex.h		\
275	rquota.h	\
276	rstat.h		\
277	rusers.h	\
278	rwall.h		\
279	spray.h		\
280	ufs_prot.h	\
281	nfs_acl.h
282
283SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
284SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
285SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
286SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
287
288RPCGENFLAGS = -C -h
289rpcsvc/rwall.h :=	RPCGENFLAGS += -M
290
291# rpcsvc rpcgen source (.x files)
292#
293# yp.x is an attempt at codifying what was hand coded in RPCL.
294# Unfortunately it doesn't quite work. (The handcoded stuff isn't
295# expressable in RPCL) this is due to the fact that YP was written
296# before rpcgen existed.  Hence, yp_prot.h cannot be derived from yp.x
297#
298# There is no `.h' for nis_object.x because it is included by nis.x and
299# the resulting .h is nis.h.
300
301RPCSVCPROTS = \
302$(RPCSVC_GEN_HDRS:%.h=%.x)        nis_object.x       yp.x
303
304RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS)
305
306PROTOHDRS=   dumprestore.h routed.h ripngd.h rwhod.h timed.h
307
308ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%)  \
309	$(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%)  \
310	$(ISOHDRS:%=$(ROOT)/usr/include/iso/%)  \
311	$(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%)  \
312	$(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%)  \
313	$(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%)  \
314	$(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%)  \
315	$(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%)  \
316	$(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%)
317
318DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5
319ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%)
320
321# check files really don't exist
322#
323# should do something with the rpcsvc headers
324
325iso/%.check:		iso/%.h
326	$(DOT_H_CHECK)
327
328arpa/%.check:		arpa/%.h
329	$(DOT_H_CHECK)
330
331audio/%.check:		audio/%.h
332	$(DOT_H_CHECK)
333
334rpcsvc/%.check:		rpcsvc/%.h
335	$(DOT_H_CHECK)
336
337rpcsvc/%.check:		rpcsvc/%.x
338	$(DOT_X_CHECK)
339
340protocols/%.check:	protocols/%.h
341	$(DOT_H_CHECK)
342
343kerberosv5/%.check:             kerberosv5/%.h
344	$(DOT_H_CHECK)
345
346uuid/%.check:		uuid/%.h
347	$(DOT_H_CHECK)
348
349# Note that the derived headers (rpcgen) are not checked at this time.  These
350# need work at the source level and rpcgen itself has a bug which causes a
351# cstyle violation.  Furthermore, there seems to be good reasons for the
352# generated headers to not pass all of the hdrchk rules.
353#
354# Add the following to the CHECKHDRS list to activate the .x checks:
355#	$(RPCSVCPROTS:%.x=rpcsvc/%.check) \
356#
357CHECKHDRS= $(HDRS:%.h=%.check)  \
358	$(KRB5HDRS:%.h=kerberosv5/%.check)  \
359	$(ISOHDRS:%.h=iso/%.check)  \
360	$(ARPAHDRS:%.h=arpa/%.check)  \
361	$(AUDIOHDRS:%.h=audio/%.check)  \
362	$(UUIDHDRS:%.h=uuid/%.check)  \
363	$(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \
364	$(PROTOHDRS:%.h=protocols/%.check)
365
366# headers which won't quite meet the standards...
367#
368# assert.h is required by ansi-c to *not* be idempotent (section 4.1.2).
369# Hence the trailing guard is not the last thing in the file nor can it
370# be without playing silly games.
371
372assert.check	:= HDRCHK_TAIL = | grep -v "end guard wrong" | true
373
374# install rules
375
376$(ROOT)/usr/include/security/%: security/%
377	$(INS.file)
378
379$(ROOT)/usr/include/protocols/%: protocols/%
380	$(INS.file)
381
382$(ROOT)/usr/include/rpcsvc/%: rpcsvc/%
383	$(INS.file)
384
385$(ROOT)/usr/include/kerberosv5/%: kerberosv5/%
386	$(INS.file)
387
388$(ROOT)/usr/include/arpa/%: arpa/%
389	$(INS.file)
390
391$(ROOT)/usr/include/audio/%: audio/%
392	$(INS.file)
393
394$(ROOT)/usr/include/iso/%: iso/%
395	$(INS.file)
396
397$(ROOT)/usr/include/uuid/%: uuid/%
398	$(INS.file)
399
400$(ROOT)/usr/include/%: %
401	$(INS.file)
402
403.KEEP_STATE:
404
405.PARALLEL:	$(ROOTHDRS) $(CHECKHDRS)
406
407install_h: 	$(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \
408		$(SYMHDRFLOAT) $(SYMHDRISO646)
409
410check:	$(CHECKHDRS)
411
412clean clobber:
413	cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS)
414
415$(ROOTDIRS):
416	$(INS.dir)
417
418$(SYMHDRASSERT):
419	-$(RM) $@; $(SYMLINK) ../assert.h $@
420
421$(SYMHDRERRNO):
422	-$(RM) $@; $(SYMLINK) ../errno.h $@
423
424$(SYMHDRFLOAT):
425	-$(RM) $@; $(SYMLINK) ../float.h $@
426
427$(SYMHDRISO646):
428	-$(RM) $@; $(SYMLINK) ../iso646.h $@
429
430rpcsvc/%.h:	rpcsvc/%.x
431	$(RPCGEN) $(RPCGENFLAGS) $< -o $@
432
433rpcsvc/nis.h:	rpcsvc/nis.x
434	$(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\
435	$(SED) -e '/EDIT_START/,$$ d' > $@
436