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