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