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