xref: /illumos-gate/usr/src/head/Makefile (revision 590e0b5da08d7261161e979afc4bf4aa0f543574)
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 2017 Nexenta Systems, Inc.
28#
29
30# include global definitions
31include ../Makefile.master
32
33sparc_HDRS=
34i386_HDRS=	stack_unwind.h
35
36KRB5HDRS=		\
37	mit_copyright.h	\
38	mit-sipb-copyright.h
39
40ATTRDB_HDRS=		\
41	auth_attr.h	\
42	auth_list.h	\
43	exec_attr.h	\
44	prof_attr.h	\
45	secdb.h		\
46	user_attr.h
47
48HDRS=   $($(MACH)_HDRS)	\
49	$(ATTRDB_HDRS)	\
50	aio.h		\
51	alloca.h	\
52	apptrace.h	\
53	apptrace_impl.h	\
54	ar.h		\
55	archives.h	\
56	assert.h	\
57	atomic.h	\
58	attr.h		\
59	complex.h	\
60	config_admin.h	\
61	cpio.h		\
62	crypt.h		\
63	ctype.h		\
64	deflt.h		\
65	devid.h		\
66	devmgmt.h	\
67	devpoll.h	\
68	dial.h		\
69	dirent.h	\
70	dlfcn.h		\
71	door.h		\
72	elf.h		\
73	endian.h	\
74	err.h		\
75	errno.h		\
76	euc.h		\
77	exacct.h	\
78	exacct_impl.h	\
79	execinfo.h	\
80	fatal.h		\
81	fcntl.h		\
82	fenv.h		\
83	float.h		\
84	floatingpoint.h	\
85	fmtmsg.h	\
86	fnmatch.h	\
87	fts.h		\
88	ftw.h		\
89	gelf.h		\
90	getopt.h	\
91	getwidth.h	\
92	glob.h		\
93	grp.h		\
94	iconv.h		\
95	ieeefp.h	\
96	ifaddrs.h	\
97	inttypes.h	\
98	iso646.h	\
99	klpd.h		\
100	langinfo.h	\
101	lastlog.h	\
102	lber.h		\
103	ldap.h		\
104	libelf.h	\
105	libgen.h	\
106	libintl.h	\
107	libw.h		\
108	libzonecfg.h	\
109	limits.h	\
110	linenum.h	\
111	link.h		\
112	listen.h	\
113	locale.h	\
114	macros.h	\
115	malloc.h	\
116	math.h		\
117	memory.h	\
118	mon.h		\
119	monetary.h	\
120	mp.h		\
121	mqueue.h	\
122	nan.h		\
123	ndbm.h		\
124	ndpd.h		\
125	netconfig.h	\
126	netdb.h		\
127	netdir.h	\
128	nl_types.h	\
129	nlist.h		\
130	note.h		\
131	nsswitch.h	\
132	nss_common.h	\
133	nss_dbdefs.h	\
134	nss_netdir.h	\
135	paths.h		\
136	pcsample.h	\
137	pfmt.h		\
138	pkgdev.h	\
139	pkginfo.h	\
140	pkglocs.h	\
141	pkgstrct.h	\
142	pkgtrans.h	\
143	poll.h		\
144	port.h		\
145	priv.h		\
146	priv_utils.h	\
147	proc_service.h	\
148	procfs.h	\
149	prof.h		\
150	project.h	\
151	pthread.h	\
152	pw.h		\
153	pwd.h		\
154	rctl.h		\
155	re_comp.h	\
156	regex.h		\
157	regexp.h	\
158	resolv.h	\
159	rje.h		\
160	rtld_db.h	\
161	sac.h		\
162	sched.h		\
163	schedctl.h	\
164	search.h	\
165	semaphore.h	\
166	setjmp.h	\
167	sgtty.h		\
168	shadow.h	\
169	siginfo.h	\
170	signal.h	\
171	spawn.h		\
172	stdalign.h	\
173	stdarg.h	\
174	stdbit.h	\
175	stdbool.h	\
176	stddef.h	\
177	stdint.h	\
178	stdio.h		\
179	stdio_ext.h	\
180	stdio_tag.h	\
181	stdio_impl.h	\
182	stdlib.h	\
183	stdnoreturn.h	\
184	storclass.h	\
185	string.h	\
186	strings.h	\
187	stropts.h	\
188	synch.h		\
189	sysexits.h	\
190	syslog.h	\
191	syms.h		\
192	tar.h		\
193	termio.h	\
194	termios.h	\
195	tgmath.h	\
196	thread.h	\
197	thread_db.h	\
198	threads.h	\
199	time.h		\
200	tiuser.h	\
201	tzfile.h	\
202	uchar.h		\
203	ucontext.h	\
204	ucred.h		\
205	ulimit.h	\
206	unistd.h	\
207	upanic.h	\
208	userdefs.h	\
209	ustat.h		\
210	utime.h		\
211	utmp.h		\
212	utmpx.h		\
213	valtools.h	\
214	values.h	\
215	varargs.h	\
216	wait.h		\
217	wchar.h		\
218	wchar_impl.h	\
219	wctype.h	\
220	widec.h		\
221	wordexp.h	\
222	xlocale.h	\
223	xti.h		\
224	xti_inet.h	\
225	zone.h
226
227ISOHDRS = \
228	ctype_iso.h	\
229	limits_iso.h	\
230	locale_iso.h	\
231	math_c99.h	\
232	math_iso.h	\
233	setjmp_iso.h	\
234	signal_iso.h	\
235	stdarg_c99.h	\
236	stdarg_iso.h	\
237	stddef_iso.h	\
238	stdio_c99.h	\
239	stdio_iso.h	\
240	stdlib_c99.h	\
241	stdlib_c11.h	\
242	stdlib_iso.h	\
243	string_iso.h	\
244	time_iso.h	\
245	wchar_c99.h	\
246	wchar_iso.h	\
247	wctype_iso.h
248
249ARPAHDRS =		\
250	ftp.h		\
251	inet.h		\
252	nameser.h	\
253	telnet.h	\
254	tftp.h		\
255	nameser_compat.h
256
257AUDIOHDRS =		\
258	au.h
259
260UUIDHDRS =		\
261	uuid.h
262
263# rpcsvc headers which are just headers (not derived from a .x file)
264RPCSVC_SRC_HDRS =	\
265	bootparam.h	\
266	daemon_utils.h	\
267	dbm.h		\
268	nis_db.h	\
269	nislib.h	\
270	svc_dg_priv.h	\
271	yp_prot.h	\
272	ypclnt.h	\
273	yppasswd.h	\
274	ypupd.h		\
275	rpc_sztypes.h
276
277# rpcsvc headers which are generated from .x files
278RPCSVC_GEN_HDRS = \
279	bootparam_prot.h \
280	mount.h		\
281	nfs_prot.h	\
282	nfs4_prot.h	\
283	nis.h		\
284	rquota.h	\
285	rstat.h		\
286	rusers.h	\
287	rwall.h		\
288	spray.h		\
289	ufs_prot.h	\
290	nfs_acl.h
291
292SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
293SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
294SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
295SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
296
297RPCGENFLAGS = -C -h
298rpcsvc/rwall.h :=	RPCGENFLAGS += -M
299
300# rpcsvc rpcgen source (.x files)
301#
302# yp.x is an attempt at codifying what was hand coded in RPCL.
303# Unfortunately it doesn't quite work. (The handcoded stuff isn't
304# expressable in RPCL) this is due to the fact that YP was written
305# before rpcgen existed.  Hence, yp_prot.h cannot be derived from yp.x
306#
307# There is no `.h' for nis_object.x because it is included by nis.x and
308# the resulting .h is nis.h.
309
310RPCSVCPROTS = \
311$(RPCSVC_GEN_HDRS:%.h=%.x)        nis_object.x       yp.x
312
313RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS)
314
315PROTOHDRS=   dumprestore.h routed.h ripngd.h rwhod.h timed.h
316
317ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%)  \
318	$(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%)  \
319	$(ISOHDRS:%=$(ROOT)/usr/include/iso/%)  \
320	$(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%)  \
321	$(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%)  \
322	$(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%)  \
323	$(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%)  \
324	$(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%)  \
325	$(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%)
326
327DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5
328ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%)
329
330# check files really don't exist
331#
332# should do something with the rpcsvc headers
333
334iso/%.check:		iso/%.h
335	$(DOT_H_CHECK)
336
337arpa/%.check:		arpa/%.h
338	$(DOT_H_CHECK)
339
340audio/%.check:		audio/%.h
341	$(DOT_H_CHECK)
342
343rpcsvc/%.check:		rpcsvc/%.h
344	$(DOT_H_CHECK)
345
346rpcsvc/%.check:		rpcsvc/%.x
347	$(DOT_X_CHECK)
348
349protocols/%.check:	protocols/%.h
350	$(DOT_H_CHECK)
351
352kerberosv5/%.check:             kerberosv5/%.h
353	$(DOT_H_CHECK)
354
355uuid/%.check:		uuid/%.h
356	$(DOT_H_CHECK)
357
358# Note that the derived headers (rpcgen) are not checked at this time.  These
359# need work at the source level and rpcgen itself has a bug which causes a
360# cstyle violation.  Furthermore, there seems to be good reasons for the
361# generated headers to not pass all of the hdrchk rules.
362#
363# Add the following to the CHECKHDRS list to activate the .x checks:
364#	$(RPCSVCPROTS:%.x=rpcsvc/%.check) \
365#
366CHECKHDRS= $(HDRS:%.h=%.check)  \
367	$(KRB5HDRS:%.h=kerberosv5/%.check)  \
368	$(ISOHDRS:%.h=iso/%.check)  \
369	$(ARPAHDRS:%.h=arpa/%.check)  \
370	$(AUDIOHDRS:%.h=audio/%.check)  \
371	$(UUIDHDRS:%.h=uuid/%.check)  \
372	$(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \
373	$(PROTOHDRS:%.h=protocols/%.check)
374
375# headers which won't quite meet the standards...
376#
377# assert.h is required by ansi-c to *not* be idempotent (section 4.1.2).
378# Hence the trailing guard is not the last thing in the file nor can it
379# be without playing silly games.
380
381assert.check	:= HDRCHK_TAIL = | grep -v "end guard wrong" | true
382
383# install rules
384
385$(ROOT)/usr/include/security/%: security/%
386	$(INS.file)
387
388$(ROOT)/usr/include/protocols/%: protocols/%
389	$(INS.file)
390
391$(ROOT)/usr/include/rpcsvc/%: rpcsvc/%
392	$(INS.file)
393
394$(ROOT)/usr/include/kerberosv5/%: kerberosv5/%
395	$(INS.file)
396
397$(ROOT)/usr/include/arpa/%: arpa/%
398	$(INS.file)
399
400$(ROOT)/usr/include/audio/%: audio/%
401	$(INS.file)
402
403$(ROOT)/usr/include/iso/%: iso/%
404	$(INS.file)
405
406$(ROOT)/usr/include/uuid/%: uuid/%
407	$(INS.file)
408
409$(ROOT)/usr/include/%: %
410	$(INS.file)
411
412.KEEP_STATE:
413
414.PARALLEL:	$(ROOTHDRS) $(CHECKHDRS)
415
416install_h:	$(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \
417		$(SYMHDRFLOAT) $(SYMHDRISO646)
418
419check:	$(CHECKHDRS)
420
421clean clobber:
422	cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS)
423
424$(ROOTDIRS):
425	$(INS.dir)
426
427$(SYMHDRASSERT):
428	-$(RM) $@; $(SYMLINK) ../assert.h $@
429
430$(SYMHDRERRNO):
431	-$(RM) $@; $(SYMLINK) ../errno.h $@
432
433$(SYMHDRFLOAT):
434	-$(RM) $@; $(SYMLINK) ../float.h $@
435
436$(SYMHDRISO646):
437	-$(RM) $@; $(SYMLINK) ../iso646.h $@
438
439rpcsvc/%.h:	rpcsvc/%.x
440	$(RPCGEN) $(RPCGENFLAGS) $< -o $@
441
442rpcsvc/nis.h:	rpcsvc/nis.x
443	$(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\
444	$(SED) -e '/EDIT_START/,$$ d' > $@
445