xref: /xnu-8020.140.41/bsd/sys/Makefile (revision 27b03b360a988dfd3dfdf34262bb0042026747cc)
1export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
2export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
3export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
4export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
5
6include $(MakeInc_cmd)
7include $(MakeInc_def)
8
9INSTINC_SUBDIRS = \
10	_types
11
12EXPINC_SUBDIRS = \
13	_types
14
15# Files that are public on macOS, but private on embedded
16EMBEDDED_PRIVATE_DATAFILES = \
17	disk.h ioctl_compat.h kdebug.h kernel_types.h ttychars.h ttydev.h vnode.h
18
19ifeq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS) $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),)
20EXTRA_DATAFILES = $(EMBEDDED_PRIVATE_DATAFILES)
21else
22EXTRA_PRIVATE_DATAFILES = $(EMBEDDED_PRIVATE_DATAFILES)
23endif
24
25# Installs header file for user level -
26#	  $(DSTROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
27#	  $(DSTROOT)/usr/include/
28# Most of these are covered by CoreOSModuleMaps because some of them are mixed
29# in with related headers in other directories from other projects, or mixed
30# in with headers from other projects in sys/.
31DATAFILES = $(sort \
32	appleapiopts.h	acct.h aio.h attr.h \
33	buf.h cdefs.h clonefile.h conf.h \
34	dir.h dirent.h dkstat.h dtrace.h dtrace_glue.h dtrace_impl.h \
35	errno.h ev.h event.h fasttrap.h fasttrap_isa.h fcntl.h file.h filedesc.h filio.h fsgetpath.h gmon.h \
36	ioccom.h ioctl.h \
37	ipc.h kernel.h kern_event.h lctx.h loadable_fs.h lock.h lockf.h \
38	kauth.h kdebug_signpost.h kern_control.h lockstat.h malloc.h \
39	mbuf.h mman.h mount.h msg.h msgbuf.h netport.h param.h paths.h pipe.h poll.h \
40	proc.h  proc_info.h ptrace.h queue.h quota.h reboot.h resource.h resourcevar.h \
41	sbuf.h posix_sem.h posix_shm.h random.h sdt.h\
42	select.h sem.h semaphore.h shm.h signal.h signalvar.h snapshot.h socket.h socketvar.h sockio.h stat.h stdio.h \
43	sysctl.h syslimits.h syslog.h sys_domain.h termios.h  time.h \
44	timeb.h times.h tprintf.h trace.h tty.h ttycom.h \
45	ttydefaults.h types.h ubc.h ucontext.h ucred.h uio.h un.h unistd.h unpcb.h \
46	user.h utfconv.h utsname.h vadvise.h vcmd.h \
47	vm.h vmmeter.h vmparam.h vnioctl.h vnode_if.h vsock.h vstat.h wait.h xattr.h \
48	_select.h _structs.h _types.h _endian.h domain.h protosw.h \
49	spawn.h timex.h commpage.h log_data.h \
50	$(EXTRA_DATAFILES))
51
52MODULEMAPFILES = \
53	darwin_cdefs.modulemap \
54	darwin_posix_sys_types.modulemap
55
56# Installs header file for DriverKit drivers -
57#	  $(DSTROOT)/System/DriverKit/System/usr/include/
58DRIVERKIT_DATAFILES = \
59	cdefs.h _types.h _endian.h
60
61# Installs header file for Apple internal use in user level -
62#	  $(DSTROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
63# These are covered by CoreOSModuleMaps because they're mixed in with headers
64# from other projects in sys/.
65PRIVATE_DATAFILES = $(sort \
66	attr.h \
67	cdefs.h \
68	clonefile.h \
69	coalition.h \
70	codesign.h \
71	content_protection.h \
72	csr.h \
73	decmpfs.h \
74	disk.h \
75	disklabel.h \
76	domain.h \
77	event.h \
78	fcntl.h \
79	fileport.h \
80	fsctl.h \
81	fsevents.h \
82	fsgetpath.h \
83	fslog.h \
84	guarded.h \
85	imgsrc.h \
86	ipcs.h \
87	kas_info.h \
88	kdebug.h \
89	kdebug_private.h \
90	kdebug_triage.h \
91	kern_control.h \
92	kern_debug.h \
93	kern_event.h \
94	kern_memorystatus.h \
95	kern_memorystatus_freeze.h \
96	kern_memorystatus_notify.h \
97	kern_overrides.h \
98	kern_sysctl.h \
99	mbuf.h \
100	mman.h \
101	monotonic.h \
102	perfmon_private.h \
103	persona.h \
104	priv.h \
105	proc.h \
106	proc_info.h \
107	proc_uuid_policy.h \
108	process_policy.h \
109	reason.h \
110	resource.h \
111	resource_private.h \
112	sfi.h \
113	shm_internal.h \
114	snapshot.h \
115	socket.h \
116	socketvar.h \
117	sockio.h \
118	spawn.h \
119	spawn_internal.h \
120	stackshot.h \
121	sys_domain.h \
122	tree.h \
123	ulock.h \
124	unpcb.h \
125	ux_exception.h \
126	vsock.h \
127	work_interval.h \
128	process_policy.h \
129	proc_uuid_policy.h \
130	priv.h \
131	pgo.h \
132	memory_maintenance.h \
133	commpage.h \
134	$(EXTRA_PRIVATE_DATAFILES))
135
136# Installs header file for Apple internal use by DriverKit drivers -
137#	  $(DSTROOT)/System/DriverKit/System/usr/local/include/
138DRIVERKIT_PRIVATE_DATAFILES = \
139	appleapiopts.h kdebug.h kdebug_private.h perfmon_private.h queue.h
140
141# Installs header file for kernel extensions -
142#	  $(DSTROOT)/System/Library/Frameworks/Kernel.framework/Headers
143#	  $(DSTROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders
144KERNELFILES = \
145	appleapiopts.h	 attr.h \
146	buf.h cdefs.h conf.h \
147	dir.h dirent.h disk.h disklabel.h dkstat.h  \
148	errno.h ev.h event.h fcntl.h file.h filio.h \
149	ioccom.h ioctl.h ipc.h \
150	ioctl_compat.h  kernel.h kernel_types.h kern_event.h lock.h lockf.h \
151	kauth.h kdebug.h kdebug_private.h kdebug_kernel.h md5.h kern_control.h \
152	imgact.h malloc.h namei.h mman.h mbuf.h mount.h netport.h param.h paths.h \
153	perfmon_private.h proc.h  queue.h random.h resource.h \
154	sbuf.h posix_sem.h posix_shm.h resource_private.h sem.h shm.h \
155	select.h signal.h socket.h socketvar.h sockio.h stat.h stdio.h \
156	sysctl.h syslimits.h syslog.h systm.h sys_domain.h  time.h \
157	types.h ubc.h ucontext.h ucred.h uio.h un.h unistd.h unpcb.h \
158	utfconv.h unicode.h vm.h vmparam.h vnode.h vnode_if.h vsock.h xattr.h \
159	_select.h _structs.h _types.h _endian.h protosw.h domain.h \
160	kpi_mbuf.h kpi_socket.h kpi_socketfilter.h \
161	ttycom.h termios.h msg.h \
162	wait.h \
163	spawn.h timex.h commpage.h
164# The last line was added to export needed headers for the MAC calls
165# whose source is outside of the xnu/bsd tree.
166
167# Installs header file for Apple internal use for kernel extensions -
168#	  $(DSTROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders
169PRIVATE_KERNELFILES = \
170	acct.h \
171	codesign.h \
172	cprotect.h \
173	content_protection.h \
174	csr.h \
175	decmpfs.h \
176	disktab.h \
177	eventhandler.h \
178	fbt.h \
179	fileport.h \
180	fsctl.h \
181	fslog.h \
182	kasl.h \
183	kern_memorystatus.h \
184	kern_memorystatus_freeze.h \
185	kern_memorystatus_notify.h \
186	kpi_private.h \
187	ktrace.h \
188	kdebug_triage.h \
189	linker_set.h \
190	mach_swapon.h \
191	monotonic.h \
192	msgbuf.h \
193	eventvar.h \
194	persona.h \
195	proc_info.h \
196	pthread_shims.h \
197	quota.h \
198	reboot.h \
199	resourcevar.h \
200	sem_internal.h \
201	shm_internal.h \
202	signalvar.h \
203	stackshot.h \
204	timeb.h times.h \
205	tty.h  ttychars.h \
206	ttydefaults.h ttydev.h \
207	user.h \
208	vfs_context.h \
209	vmmeter.h \
210	reason.h \
211	spawn_internal.h \
212	priv.h \
213	pgo.h \
214	memory_maintenance.h \
215	doc_tombstone.h \
216	fsevents.h \
217	work_interval.h \
218	kern_sysctl.h \
219	vsock_transport.h \
220
221XNU_ONLY_EXPORTS = \
222	bsdtask_info.h \
223	file_internal.h \
224	filedesc.h \
225	guarded.h \
226	mount_internal.h \
227	munge.h \
228	pipe.h \
229	proc_internal.h \
230	proc_require.h \
231	proc_ro.h \
232	pthread_internal.h \
233	resourcevar.h \
234	semaphore.h \
235	tree.h \
236	uio_internal.h \
237	ulock.h \
238	ux_exception.h \
239	vnode_internal.h \
240	vsock_domain.h
241
242# /usr/include
243INSTALL_MI_LIST	= ${DATAFILES}
244
245INSTALL_MODULEMAP_MI_LIST = ${MODULEMAPFILES}
246
247INSTALL_DRIVERKIT_MI_LIST = ${DRIVERKIT_DATAFILES}
248
249INSTALL_MI_GEN_LIST = syscall.h _posix_availability.h _symbol_aliasing.h
250
251INSTALL_DRIVERKIT_MI_GEN_LIST = _posix_availability.h _symbol_aliasing.h
252
253INSTALL_MI_DIR = sys
254
255EXPORT_MI_LIST	= $(sort ${KERNELFILES} ${PRIVATE_KERNELFILES} ${XNU_ONLY_EXPORTS})
256
257EXPORT_MI_GEN_LIST = syscall.h sysproto.h
258
259EXPORT_MI_DIR = sys
260
261# /usr/local/include
262INSTALL_MI_LCL_LIST = $(sort \
263	codesign.h content_protection.h decmpfs.h fsevents.h kdebug_private.h \
264	kern_memorystatus.h perfmon_private.h reason.h resource_private.h \
265	stackshot.h work_interval.h \
266	${EXTRA_PRIVATE_DATAFILES})
267
268# /System/Library/Frameworks/System.framework/PrivateHeaders
269INSTALL_SF_MI_LCL_LIST = ${DATAFILES} ${PRIVATE_DATAFILES}
270
271INSTALL_SF_MI_LCL_GEN_LIST = ${INSTALL_MI_GEN_LIST}
272
273INSTALL_DRIVERKIT_MI_LCL_LIST = ${DRIVERKIT_PRIVATE_DATAFILES}
274
275# /System/Library/Frameworks/Kernel.framework/PrivateHeaders
276INSTALL_KF_MI_LCL_LIST =  ${KERNELFILES} ${PRIVATE_KERNELFILES}
277
278INSTALL_KF_MI_LCL_GEN_LIST = sysproto.h
279
280# /System/Library/Frameworks/Kernel.framework/Headers
281INSTALL_KF_MI_LIST = ${KERNELFILES}
282
283INSTALL_KF_MI_GEN_LIST =
284
285MAKESYSCALLS = $(SRCROOT)/bsd/kern/makesyscalls.sh
286
287$(OBJROOT)/cscope.genhdrs:
288	$(_v)mkdir -p $(OBJROOT)/cscope.genhdrs
289
290$(OBJROOT)/syscall.codes: $(TARGET)/bsd.syscalls.master
291	@$(LOG_GENERATE) "$(ColorLF)$@$(Color0) from $(ColorF)$(<F)$(Color0)"
292	$(_v)$(MAKESYSCALLS) $< trace > $@
293
294$(OBJROOT)/trace.codes: $(SRCROOT)/bsd/kern/trace_codes $(OBJROOT)/syscall.codes
295	$(_v)sort -g $(SRCROOT)/bsd/kern/trace_codes $(OBJROOT)/syscall.codes >$@
296
297syscall.h: $(TARGET)/bsd.syscalls.master $(OBJROOT)/cscope.genhdrs
298	@$(LOG_GENERATE) "$(ColorLF)bsd/sys/$@$(Color0) from $(ColorF)$(<F)$(Color0)"
299	@echo "$(OBJPATH)/bsd/sys/$@" > $(OBJROOT)/cscope.genhdrs/$@.path
300	$(_v)$(MAKESYSCALLS) $< header > /dev/null
301
302sysproto.h: $(TARGET)/bsd.syscalls.master $(OBJROOT)/cscope.genhdrs
303	@$(LOG_GENERATE) "bsd/sys/$@$(Color0) from $(ColorF)$(<F)$(Color0)"
304	@echo "$(OBJPATH)/bsd/sys/$@" > $(OBJROOT)/cscope.genhdrs/$@.path
305	$(_v)$(MAKESYSCALLS) $< proto > /dev/null
306
307MAKE_POSIX_AVAILABILITY = $(SRCROOT)/bsd/sys/make_posix_availability.sh
308_posix_availability.h: $(MAKE_POSIX_AVAILABILITY)
309	@$(LOG_GENERATE) "bsd/sys/$@$(Color0)"
310	$(_v)$(MAKE_POSIX_AVAILABILITY) "$@"
311
312MAKE_SYMBOL_ALIASING = $(SRCROOT)/bsd/sys/make_symbol_aliasing.sh
313_symbol_aliasing.h: $(MAKE_SYMBOL_ALIASING)
314	@$(LOG_GENERATE) "bsd/sys/$@$(Color0)"
315	$(_v)$(MAKE_SYMBOL_ALIASING) "$(SDKROOT)" "$@"
316
317# generated headers needed early (used by iig during installhdrs of iokit/DriverKit)
318SETUP_GEN_LIST = _posix_availability.h _symbol_aliasing.h
319
320do_build_setup:: $(SETUP_GEN_LIST)
321
322TRACE_CODES_DEST = \
323	$(DSTROOT)/$(INSTALL_SHARE_MISC_DIR)/trace.codes
324
325$(TRACE_CODES_DEST): $(OBJROOT)/trace.codes
326	$(_v)$(MKDIR) $(DSTROOT)/$(INSTALL_SHARE_MISC_DIR)
327	@$(LOG_INSTALL) "$(@F)"
328	$(_v)$(INSTALL) $(INSTALL_FLAGS) $(OBJROOT)/trace.codes $@
329
330do_textfiles_install_mi:: $(TRACE_CODES_DEST)
331
332include $(MakeInc_rule)
333include $(MakeInc_dir)
334