xref: /illumos-gate/usr/src/head/Makefile (revision 148434206d3ba623dff65e4b591dffc0ddadebf3)
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	rex.h		\
279	rquota.h	\
280	rstat.h		\
281	rusers.h	\
282	rwall.h		\
283	spray.h		\
284	ufs_prot.h	\
285	nfs_acl.h
286
287SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
288SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
289SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
290SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
291
292RPCGENFLAGS = -C -h
293rpcsvc/rwall.h :=	RPCGENFLAGS += -M
294
295# rpcsvc rpcgen source (.x files)
296#
297# yp.x is an attempt at codifying what was hand coded in RPCL.
298# Unfortunately it doesn't quite work. (The handcoded stuff isn't
299# expressable in RPCL) this is due to the fact that YP was written
300# before rpcgen existed.  Hence, yp_prot.h cannot be derived from yp.x
301#
302# There is no `.h' for nis_object.x because it is included by nis.x and
303# the resulting .h is nis.h.
304
305RPCSVCPROTS = \
306$(RPCSVC_GEN_HDRS:%.h=%.x)        nis_object.x       yp.x
307
308RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS)
309
310PROTOHDRS=   dumprestore.h routed.h ripngd.h rwhod.h timed.h
311
312ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%)  \
313	$(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%)  \
314	$(ISOHDRS:%=$(ROOT)/usr/include/iso/%)  \
315	$(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%)  \
316	$(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%)  \
317	$(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%)  \
318	$(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%)  \
319	$(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%)  \
320	$(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%)
321
322DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5
323ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%)
324
325# check files really don't exist
326#
327# should do something with the rpcsvc headers
328
329iso/%.check:		iso/%.h
330	$(DOT_H_CHECK)
331
332arpa/%.check:		arpa/%.h
333	$(DOT_H_CHECK)
334
335audio/%.check:		audio/%.h
336	$(DOT_H_CHECK)
337
338rpcsvc/%.check:		rpcsvc/%.h
339	$(DOT_H_CHECK)
340
341rpcsvc/%.check:		rpcsvc/%.x
342	$(DOT_X_CHECK)
343
344protocols/%.check:	protocols/%.h
345	$(DOT_H_CHECK)
346
347kerberosv5/%.check:             kerberosv5/%.h
348	$(DOT_H_CHECK)
349
350uuid/%.check:		uuid/%.h
351	$(DOT_H_CHECK)
352
353# Note that the derived headers (rpcgen) are not checked at this time.  These
354# need work at the source level and rpcgen itself has a bug which causes a
355# cstyle violation.  Furthermore, there seems to be good reasons for the
356# generated headers to not pass all of the hdrchk rules.
357#
358# Add the following to the CHECKHDRS list to activate the .x checks:
359#	$(RPCSVCPROTS:%.x=rpcsvc/%.check) \
360#
361CHECKHDRS= $(HDRS:%.h=%.check)  \
362	$(KRB5HDRS:%.h=kerberosv5/%.check)  \
363	$(ISOHDRS:%.h=iso/%.check)  \
364	$(ARPAHDRS:%.h=arpa/%.check)  \
365	$(AUDIOHDRS:%.h=audio/%.check)  \
366	$(UUIDHDRS:%.h=uuid/%.check)  \
367	$(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \
368	$(PROTOHDRS:%.h=protocols/%.check)
369
370# headers which won't quite meet the standards...
371#
372# assert.h is required by ansi-c to *not* be idempotent (section 4.1.2).
373# Hence the trailing guard is not the last thing in the file nor can it
374# be without playing silly games.
375
376assert.check	:= HDRCHK_TAIL = | grep -v "end guard wrong" | true
377
378# install rules
379
380$(ROOT)/usr/include/security/%: security/%
381	$(INS.file)
382
383$(ROOT)/usr/include/protocols/%: protocols/%
384	$(INS.file)
385
386$(ROOT)/usr/include/rpcsvc/%: rpcsvc/%
387	$(INS.file)
388
389$(ROOT)/usr/include/kerberosv5/%: kerberosv5/%
390	$(INS.file)
391
392$(ROOT)/usr/include/arpa/%: arpa/%
393	$(INS.file)
394
395$(ROOT)/usr/include/audio/%: audio/%
396	$(INS.file)
397
398$(ROOT)/usr/include/iso/%: iso/%
399	$(INS.file)
400
401$(ROOT)/usr/include/uuid/%: uuid/%
402	$(INS.file)
403
404$(ROOT)/usr/include/%: %
405	$(INS.file)
406
407.KEEP_STATE:
408
409.PARALLEL:	$(ROOTHDRS) $(CHECKHDRS)
410
411install_h: 	$(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \
412		$(SYMHDRFLOAT) $(SYMHDRISO646)
413
414check:	$(CHECKHDRS)
415
416clean clobber:
417	cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS)
418
419$(ROOTDIRS):
420	$(INS.dir)
421
422$(SYMHDRASSERT):
423	-$(RM) $@; $(SYMLINK) ../assert.h $@
424
425$(SYMHDRERRNO):
426	-$(RM) $@; $(SYMLINK) ../errno.h $@
427
428$(SYMHDRFLOAT):
429	-$(RM) $@; $(SYMLINK) ../float.h $@
430
431$(SYMHDRISO646):
432	-$(RM) $@; $(SYMLINK) ../iso646.h $@
433
434rpcsvc/%.h:	rpcsvc/%.x
435	$(RPCGEN) $(RPCGENFLAGS) $< -o $@
436
437rpcsvc/nis.h:	rpcsvc/nis.x
438	$(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\
439	$(SED) -e '/EDIT_START/,$$ d' > $@
440