xref: /illumos-gate/usr/src/head/Makefile (revision fe4627ef755b7c263f91a0e6f07cdca5d7083501)
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	ucontext.h	\
199	ucred.h		\
200	ulimit.h	\
201	unistd.h	\
202	userdefs.h	\
203	ustat.h		\
204	utime.h		\
205	utmp.h		\
206	utmpx.h		\
207	valtools.h	\
208	values.h	\
209	varargs.h	\
210	wait.h		\
211	wchar.h		\
212	wchar_impl.h	\
213	wctype.h	\
214	widec.h		\
215	wordexp.h	\
216	xlocale.h	\
217	xti.h		\
218	xti_inet.h	\
219	zone.h
220
221ISOHDRS = \
222	ctype_iso.h	\
223	limits_iso.h	\
224	locale_iso.h	\
225	math_c99.h	\
226	math_iso.h	\
227	setjmp_iso.h  	\
228	signal_iso.h	\
229	stdarg_c99.h	\
230	stdarg_iso.h	\
231	stddef_iso.h	\
232	stdio_c99.h	\
233	stdio_iso.h	\
234	stdlib_c99.h	\
235	stdlib_c11.h	\
236	stdlib_iso.h	\
237	string_iso.h	\
238	time_iso.h	\
239	wchar_c99.h	\
240	wchar_iso.h	\
241	wctype_iso.h
242
243ARPAHDRS = 		\
244	ftp.h		\
245	inet.h		\
246	nameser.h	\
247	telnet.h	\
248	tftp.h		\
249	nameser_compat.h
250
251AUDIOHDRS =		\
252	au.h
253
254UUIDHDRS =		\
255	uuid.h
256
257# rpcsvc headers which are just headers (not derived from a .x file)
258RPCSVC_SRC_HDRS =	\
259	bootparam.h	\
260	daemon_utils.h	\
261	dbm.h		\
262	nis_db.h	\
263	nislib.h	\
264	svc_dg_priv.h	\
265	yp_prot.h	\
266	ypclnt.h	\
267	yppasswd.h	\
268	ypupd.h		\
269	rpc_sztypes.h
270
271# rpcsvc headers which are generated from .x files
272RPCSVC_GEN_HDRS = \
273	bootparam_prot.h \
274	mount.h		\
275	nfs_prot.h	\
276	nfs4_prot.h	\
277	nis.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
324# check files really don't exist
325#
326# should do something with the rpcsvc headers
327
328iso/%.check:		iso/%.h
329	$(DOT_H_CHECK)
330
331arpa/%.check:		arpa/%.h
332	$(DOT_H_CHECK)
333
334audio/%.check:		audio/%.h
335	$(DOT_H_CHECK)
336
337rpcsvc/%.check:		rpcsvc/%.h
338	$(DOT_H_CHECK)
339
340rpcsvc/%.check:		rpcsvc/%.x
341	$(DOT_X_CHECK)
342
343protocols/%.check:	protocols/%.h
344	$(DOT_H_CHECK)
345
346kerberosv5/%.check:             kerberosv5/%.h
347	$(DOT_H_CHECK)
348
349uuid/%.check:		uuid/%.h
350	$(DOT_H_CHECK)
351
352# Note that the derived headers (rpcgen) are not checked at this time.  These
353# need work at the source level and rpcgen itself has a bug which causes a
354# cstyle violation.  Furthermore, there seems to be good reasons for the
355# generated headers to not pass all of the hdrchk rules.
356#
357# Add the following to the CHECKHDRS list to activate the .x checks:
358#	$(RPCSVCPROTS:%.x=rpcsvc/%.check) \
359#
360CHECKHDRS= $(HDRS:%.h=%.check)  \
361	$(KRB5HDRS:%.h=kerberosv5/%.check)  \
362	$(ISOHDRS:%.h=iso/%.check)  \
363	$(ARPAHDRS:%.h=arpa/%.check)  \
364	$(AUDIOHDRS:%.h=audio/%.check)  \
365	$(UUIDHDRS:%.h=uuid/%.check)  \
366	$(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \
367	$(PROTOHDRS:%.h=protocols/%.check)
368
369# headers which won't quite meet the standards...
370#
371# assert.h is required by ansi-c to *not* be idempotent (section 4.1.2).
372# Hence the trailing guard is not the last thing in the file nor can it
373# be without playing silly games.
374
375assert.check	:= HDRCHK_TAIL = | grep -v "end guard wrong" | true
376
377# install rules
378
379$(ROOT)/usr/include/security/%: security/%
380	$(INS.file)
381
382$(ROOT)/usr/include/protocols/%: protocols/%
383	$(INS.file)
384
385$(ROOT)/usr/include/rpcsvc/%: rpcsvc/%
386	$(INS.file)
387
388$(ROOT)/usr/include/kerberosv5/%: kerberosv5/%
389	$(INS.file)
390
391$(ROOT)/usr/include/arpa/%: arpa/%
392	$(INS.file)
393
394$(ROOT)/usr/include/audio/%: audio/%
395	$(INS.file)
396
397$(ROOT)/usr/include/iso/%: iso/%
398	$(INS.file)
399
400$(ROOT)/usr/include/uuid/%: uuid/%
401	$(INS.file)
402
403$(ROOT)/usr/include/%: %
404	$(INS.file)
405
406.KEEP_STATE:
407
408.PARALLEL:	$(ROOTHDRS) $(CHECKHDRS)
409
410install_h: 	$(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \
411		$(SYMHDRFLOAT) $(SYMHDRISO646)
412
413check:	$(CHECKHDRS)
414
415clean clobber:
416	cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS)
417
418$(ROOTDIRS):
419	$(INS.dir)
420
421$(SYMHDRASSERT):
422	-$(RM) $@; $(SYMLINK) ../assert.h $@
423
424$(SYMHDRERRNO):
425	-$(RM) $@; $(SYMLINK) ../errno.h $@
426
427$(SYMHDRFLOAT):
428	-$(RM) $@; $(SYMLINK) ../float.h $@
429
430$(SYMHDRISO646):
431	-$(RM) $@; $(SYMLINK) ../iso646.h $@
432
433rpcsvc/%.h:	rpcsvc/%.x
434	$(RPCGEN) $(RPCGENFLAGS) $< -o $@
435
436rpcsvc/nis.h:	rpcsvc/nis.x
437	$(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\
438	$(SED) -e '/EDIT_START/,$$ d' > $@
439