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 # Copyright 2015 Nexenta Systems, Inc. All rights reserved.
23 #
24 # Copyright 2010 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 #
27 # Copyright 2013 Garrett D'Amore <garrett@damore.org>
28 #
29 # head/Makefile
30 #
31 # include global definitions
32 include ../Makefile.master
33
34 sparc_HDRS=
35 i386_HDRS= stack_unwind.h
36
37 # Headers are listed one per line so that TeamWare can auto-merge most changes
38
39 KRB5HDRS= mit_copyright.h mit-sipb-copyright.h
40
41 ATTRDB_HDRS= secdb.h auth_attr.h exec_attr.h prof_attr.h user_attr.h \
42 auth_list.h
43
44 HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
45 aio.h \
46 alloca.h \
47 apptrace.h \
48 apptrace_impl.h \
49 ar.h \
50 archives.h \
51 assert.h \
52 atomic.h \
53 attr.h \
54 complex.h \
55 config_admin.h \
56 cpio.h \
57 crypt.h \
58 ctype.h \
59 deflt.h \
60 devid.h \
61 devmgmt.h \
62 devpoll.h \
63 dial.h \
64 dirent.h \
65 dlfcn.h \
66 door.h \
67 elf.h \
68 err.h \
69 errno.h \
70 euc.h \
71 exacct.h \
72 exacct_impl.h \
73 execinfo.h \
74 fatal.h \
75 fcntl.h \
76 fenv.h \
77 float.h \
78 floatingpoint.h \
79 fmtmsg.h \
80 fnmatch.h \
81 ftw.h \
82 gelf.h \
83 getopt.h \
84 getwidth.h \
85 glob.h \
86 grp.h \
87 iconv.h \
88 ieeefp.h \
89 ifaddrs.h \
90 inttypes.h \
91 iso646.h \
92 klpd.h \
93 langinfo.h \
94 lastlog.h \
95 lber.h \
96 ldap.h \
97 libelf.h \
98 libgen.h \
99 libintl.h \
100 libw.h \
101 libzonecfg.h \
102 limits.h \
103 linenum.h \
104 link.h \
105 listen.h \
106 locale.h \
107 macros.h \
108 malloc.h \
109 math.h \
110 mdmn_changelog.h \
111 memory.h \
112 meta.h \
113 meta_runtime.h \
114 metadyn.h \
115 mon.h \
116 monetary.h \
117 mp.h \
118 mqueue.h \
119 nan.h \
120 ndbm.h \
121 ndpd.h \
122 netconfig.h \
123 netdb.h \
124 netdir.h \
125 nl_types.h \
126 nlist.h \
127 note.h \
128 nsctl.h \
129 nsswitch.h \
130 nss_common.h \
131 nss_dbdefs.h \
132 nss_netdir.h \
133 paths.h \
134 pcsample.h \
135 pfmt.h \
136 pkgdev.h \
137 pkginfo.h \
138 pkglocs.h \
139 pkgstrct.h \
140 pkgtrans.h \
141 poll.h \
142 port.h \
143 priv.h \
144 priv_utils.h \
145 proc_service.h \
146 procfs.h \
147 prof.h \
148 project.h \
149 pthread.h \
150 pty.h \
151 pw.h \
152 pwd.h \
153 rctl.h \
154 re_comp.h \
155 regex.h \
156 regexp.h \
157 resolv.h \
158 rje.h \
159 rtld_db.h \
160 sac.h \
161 sched.h \
162 schedctl.h \
163 sdssc.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 stdarg.h \
173 stdbool.h \
174 stddef.h \
175 stdint.h \
176 stdio.h \
177 stdio_ext.h \
178 stdio_tag.h \
179 stdio_impl.h \
180 stdlib.h \
181 storclass.h \
182 string.h \
183 strings.h \
184 stropts.h \
185 synch.h \
186 sysexits.h \
187 syslog.h \
188 syms.h \
189 tar.h \
190 termio.h \
191 termios.h \
192 tgmath.h \
193 thread.h \
194 thread_db.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
221 ISOHDRS = \
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_iso.h \
236 string_iso.h \
237 time_iso.h \
238 wchar_c99.h \
239 wchar_iso.h \
240 wctype_iso.h
241
242 ARPAHDRS = \
243 ftp.h \
244 inet.h \
245 nameser.h \
246 telnet.h \
247 tftp.h \
248 nameser_compat.h
249
250 AUDIOHDRS = \
251 au.h
252
253 UUIDHDRS = \
254 uuid.h
255
256 # rpcsvc headers which are just headers (not derived from a .x file)
257 RPCSVC_SRC_HDRS = \
258 bootparam.h \
259 daemon_utils.h \
260 dbm.h \
261 nis_db.h \
262 nislib.h \
263 svc_dg_priv.h \
264 yp_prot.h \
265 ypclnt.h \
266 yppasswd.h \
267 ypupd.h \
268 rpc_sztypes.h
269
270 # rpcsvc headers which are generated from .x files
271 RPCSVC_GEN_HDRS = \
272 bootparam_prot.h \
273 mount.h \
274 nfs_prot.h \
275 nfs4_prot.h \
276 nis.h \
277 rex.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
286 LVMRPCHDRS = \
287 mhdx.h mdiox.h meta_basic.h metad.h metamed.h metamhd.h metacl.h
288
289 SYMHDRASSERT = $(ROOT)/usr/include/iso/assert_iso.h
290 SYMHDRERRNO = $(ROOT)/usr/include/iso/errno_iso.h
291 SYMHDRFLOAT = $(ROOT)/usr/include/iso/float_iso.h
292 SYMHDRISO646 = $(ROOT)/usr/include/iso/iso646_iso.h
293
294 RPCGENFLAGS = -C -h
295 rpcsvc/rwall.h := RPCGENFLAGS += -M
296 meta_basic.h := RPCGENFLAGS += -M
297 metad.h := RPCGENFLAGS += -M
298 metamed.h := RPCGENFLAGS += -M
299 mhdx.h := RPCGENFLAGS += -M
300 mdiox.h := RPCGENFLAGS += -M
301 metamhd.h := RPCGENFLAGS += -M
302 metacl.h := RPCGENFLAGS += -M
303
304 # rpcsvc rpcgen source (.x files)
305 #
306 # yp.x is an attempt at codifying what was hand coded in RPCL.
307 # Unfortunately it doesn't quite work. (The handcoded stuff isn't
308 # expressable in RPCL) this is due to the fact that YP was written
309 # before rpcgen existed. Hence, yp_prot.h cannot be derived from yp.x
310 #
311 # There is no `.h' for nis_object.x because it is included by nis.x and
312 # the resulting .h is nis.h.
313
314 RPCSVCPROTS = \
315 $(RPCSVC_GEN_HDRS:%.h=%.x) nis_object.x yp.x
316
317 LVMSVCPROTS = \
318 $(LVMRPCHDRS:%.h=%.x)
319
320 RPCSVCHDRS= $(RPCSVC_SRC_HDRS) $(RPCSVC_GEN_HDRS)
321
322 PROTOHDRS= dumprestore.h routed.h ripngd.h rwhod.h timed.h
323
324 ROOTHDRS= $(HDRS:%=$(ROOT)/usr/include/%) \
325 $(KRB5HDRS:%=$(ROOT)/usr/include/kerberosv5/%) \
326 $(ISOHDRS:%=$(ROOT)/usr/include/iso/%) \
327 $(ARPAHDRS:%=$(ROOT)/usr/include/arpa/%) \
328 $(AUDIOHDRS:%=$(ROOT)/usr/include/audio/%) \
329 $(UUIDHDRS:%=$(ROOT)/usr/include/uuid/%) \
330 $(RPCSVCHDRS:%=$(ROOT)/usr/include/rpcsvc/%) \
331 $(RPCSVCPROTS:%=$(ROOT)/usr/include/rpcsvc/%) \
332 $(LVMRPCHDRS:%=$(ROOT)/usr/include/%) \
333 $(PROTOHDRS:%=$(ROOT)/usr/include/protocols/%)
334
335 DIRS= iso arpa audio rpcsvc protocols security uuid kerberosv5
336 ROOTDIRS= $(DIRS:%=$(ROOT)/usr/include/%)
337
338 SED= sed
339
340 # check files really don't exist
341 #
342 # should do something with the rpcsvc headers
343
344 iso/%.check: iso/%.h
345 $(DOT_H_CHECK)
346
347 arpa/%.check: arpa/%.h
348 $(DOT_H_CHECK)
349
350 audio/%.check: audio/%.h
351 $(DOT_H_CHECK)
352
353 rpcsvc/%.check: rpcsvc/%.h
354 $(DOT_H_CHECK)
355
356 rpcsvc/%.check: rpcsvc/%.x
357 $(DOT_X_CHECK)
358
359 protocols/%.check: protocols/%.h
360 $(DOT_H_CHECK)
361
362 kerberosv5/%.check: kerberosv5/%.h
363 $(DOT_H_CHECK)
364
365 uuid/%.check: uuid/%.h
366 $(DOT_H_CHECK)
367
368 # Note that the derived headers (rpcgen) are not checked at this time. These
369 # need work at the source level and rpcgen itself has a bug which causes a
370 # cstyle violation. Furthermore, there seems to be good reasons for the
371 # generated headers to not pass all of the hdrchk rules.
372 #
373 # Add the following to the CHECKHDRS list to activate the .x checks:
374 # $(RPCSVCPROTS:%.x=rpcsvc/%.check) \
375 #
376 CHECKHDRS= $(HDRS:%.h=%.check) \
377 $(KRB5HDRS:%.h=kerberosv5/%.check) \
378 $(ISOHDRS:%.h=iso/%.check) \
379 $(ARPAHDRS:%.h=arpa/%.check) \
380 $(AUDIOHDRS:%.h=audio/%.check) \
381 $(UUIDHDRS:%.h=uuid/%.check) \
382 $(RPCSVC_SRC_HDRS:%.h=rpcsvc/%.check) \
383 $(PROTOHDRS:%.h=protocols/%.check)
384
385 # headers which won't quite meet the standards...
386 #
387 # assert.h is required by ansi-c to *not* be idempotent (section 4.1.2).
388 # Hence the trailing guard is not the last thing in the file nor can it
389 # be without playing silly games.
390
391 assert.check := HDRCHK_TAIL = | grep -v "end guard wrong" | true
392
393 # install rules
394
395 $(ROOT)/usr/include/security/%: security/%
396 $(INS.file)
397
398 $(ROOT)/usr/include/protocols/%: protocols/%
399 $(INS.file)
400
401 $(ROOT)/usr/include/rpcsvc/%: rpcsvc/%
402 $(INS.file)
403
404 $(ROOT)/usr/include/kerberosv5/%: kerberosv5/%
405 $(INS.file)
406
407 $(ROOT)/usr/include/arpa/%: arpa/%
408 $(INS.file)
409
410 $(ROOT)/usr/include/audio/%: audio/%
411 $(INS.file)
412
413 $(ROOT)/usr/include/iso/%: iso/%
414 $(INS.file)
415
416 $(ROOT)/usr/include/uuid/%: uuid/%
417 $(INS.file)
418
419 $(ROOT)/usr/include/%: %
420 $(INS.file)
421
422 .KEEP_STATE:
423
424 .PARALLEL: $(ROOTHDRS) $(CHECKHDRS)
425
426 install_h: $(ROOTDIRS) .WAIT $(ROOTHDRS) $(SYMHDRASSERT) $(SYMHDRERRNO) \
427 $(SYMHDRFLOAT) $(SYMHDRISO646)
428
429 check: $(CHECKHDRS)
430
431 clean clobber:
432 $(RM) $(LVMRPCHDRS);
433 cd rpcsvc ; $(RM) $(RPCSVC_GEN_HDRS)
434
435 $(ROOTDIRS):
436 $(INS.dir)
437
438 $(SYMHDRASSERT):
439 -$(RM) $@; $(SYMLINK) ../assert.h $@
440
441 $(SYMHDRERRNO):
442 -$(RM) $@; $(SYMLINK) ../errno.h $@
443
444 $(SYMHDRFLOAT):
445 -$(RM) $@; $(SYMLINK) ../float.h $@
446
447 $(SYMHDRISO646):
448 -$(RM) $@; $(SYMLINK) ../iso646.h $@
449
450 rpcsvc/%.h: rpcsvc/%.x
451 $(RPCGEN) $(RPCGENFLAGS) $< -o $@
452
453 rpcsvc/nis.h: rpcsvc/nis.x
454 $(RPCGEN) $(RPCGENFLAGS) rpcsvc/nis.x |\
455 $(SED) -e '/EDIT_START/,$$ d' > $@
456
457 meta_basic.h: ../uts/common/sys/lvm/meta_basic.x
458 $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/meta_basic.x | \
459 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
460 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
461 { print $0 } \
462 ' > $@
463
464 metad.h: metad.x
465 $(RPCGEN) $(RPCGENFLAGS) metad.x | \
466 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
467 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
468 { print $0 } \
469 ' > $@
470
471 mhdx.h: ../uts/common/sys/lvm/mhdx.x
472 $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mhdx.x | \
473 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
474 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
475 { print $0 } \
476 ' > $@
477
478 mdiox.h: ../uts/common/sys/lvm/mdiox.x
479 $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/mdiox.x | \
480 nawk '{sub(/sys\/lvm\/md_mhdx/, "mhdx"); print $$0}' | \
481 nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \
482 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
483 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
484 { print $0 } \
485 ' > $@
486
487 metamed.h: ../uts/common/sys/lvm/metamed.x
488 $(RPCGEN) $(RPCGENFLAGS) ../uts/common/sys/lvm/metamed.x | \
489 nawk '{sub(/sys\/lvm\/md_basic/, "meta_basic"); print $$0}' | \
490 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
491 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
492 { print $0 } \
493 ' > $@
494
495 metamhd.h: metamhd.x
496 $(RPCGEN) $(RPCGENFLAGS) metamhd.x | \
497 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
498 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
499 { print $0 } \
500 ' > $@
501
502 metacl.h: metacl.x
503 $(RPCGEN) $(RPCGENFLAGS) metacl.x | \
504 awk '/<synch.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
505 /<thread.h>/ { print "#ifdef _REENTRANT"; print $$0; print "#endif\t/* _REENTRANT */"; next } \
506 { print $0 } \
507 ' > $@