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