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