xref: /xnu-8792.81.2/bsd/sys/Makefile (revision 19c3b8c28c31cb8130e034cfb5df6bf9ba342d90)
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 constrained_ctypes.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 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 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 time.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	constrained_ctypes.h \
72	content_protection.h \
73	csr.h \
74	decmpfs.h \
75	disk.h \
76	disklabel.h \
77	domain.h \
78	event.h \
79	event_log.h \
80	fcntl.h \
81	fileport.h \
82	fsctl.h \
83	fsevents.h \
84	fsgetpath.h \
85	fslog.h \
86	guarded.h \
87	imgsrc.h \
88	ipcs.h \
89	kas_info.h \
90	kdebug.h \
91	kdebug_private.h \
92	kdebug_triage.h \
93	kern_control.h \
94	kern_debug.h \
95	kern_event.h \
96	kern_memorystatus.h \
97	kern_memorystatus_freeze.h \
98	kern_memorystatus_notify.h \
99	kern_overrides.h \
100	kern_sysctl.h \
101	mbuf.h \
102	mman.h \
103	monotonic.h \
104	perfmon_private.h \
105	persona.h \
106	preoslog.h \
107	priv.h \
108	proc.h \
109	proc_info.h \
110	proc_uuid_policy.h \
111	process_policy.h \
112	reason.h \
113	resource.h \
114	resource_private.h \
115	sfi.h \
116	shm_internal.h \
117	snapshot.h \
118	socket.h \
119	socketvar.h \
120	sockio.h \
121	spawn.h \
122	spawn_internal.h \
123	stackshot.h \
124	sys_domain.h \
125	tree.h \
126	ulock.h \
127	unpcb.h \
128	ux_exception.h \
129	variant_internal.h \
130	vsock.h \
131	work_interval.h \
132	process_policy.h \
133	proc_uuid_policy.h \
134	priv.h \
135	pgo.h \
136	memory_maintenance.h \
137	commpage.h \
138	$(EXTRA_PRIVATE_DATAFILES))
139
140# Installs header file for Apple internal use by DriverKit drivers -
141#	  $(DSTROOT)/System/DriverKit/System/usr/local/include/
142DRIVERKIT_PRIVATE_DATAFILES = \
143	appleapiopts.h kdebug.h kdebug_private.h perfmon_private.h queue.h
144
145# Installs header file for kernel extensions -
146#	  $(DSTROOT)/System/Library/Frameworks/Kernel.framework/Headers
147#	  $(DSTROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders
148KERNELFILES = \
149	appleapiopts.h	 attr.h \
150	buf.h cdefs.h conf.h constrained_ctypes.h \
151	dir.h dirent.h disk.h disklabel.h dkstat.h  \
152	errno.h ev.h event.h fcntl.h file.h filio.h \
153	ioccom.h ioctl.h ipc.h \
154	ioctl_compat.h  kernel.h kernel_types.h kern_event.h lock.h lockf.h \
155	kauth.h kdebug.h kdebug_private.h kdebug_kernel.h md5.h kern_control.h \
156	imgact.h malloc.h namei.h mman.h mbuf.h mount.h netport.h param.h paths.h \
157	perfmon_private.h proc.h  queue.h random.h resource.h \
158	sbuf.h posix_sem.h posix_shm.h resource_private.h sem.h shm.h \
159	select.h signal.h socket.h socketvar.h sockio.h stat.h stdio.h \
160	sysctl.h syslimits.h syslog.h systm.h sys_domain.h  time.h \
161	types.h ubc.h ucontext.h ucred.h uio.h un.h unistd.h unpcb.h \
162	utfconv.h unicode.h vm.h vmparam.h vnode.h vnode_if.h vsock.h xattr.h \
163	_select.h _structs.h _types.h _endian.h protosw.h domain.h \
164	kpi_mbuf.h kpi_socket.h kpi_socketfilter.h \
165	ttycom.h termios.h msg.h \
166	wait.h \
167	spawn.h timex.h commpage.h
168# The last line was added to export needed headers for the MAC calls
169# whose source is outside of the xnu/bsd tree.
170
171# Installs header file for Apple internal use for kernel extensions -
172#	  $(DSTROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders
173PRIVATE_KERNELFILES = \
174	acct.h \
175	codesign.h \
176	cprotect.h \
177	content_protection.h \
178	csr.h \
179	decmpfs.h \
180	disktab.h \
181	eventhandler.h \
182	event_log.h \
183	fbt.h \
184	fileport.h \
185	fsctl.h \
186	fslog.h \
187	kasl.h \
188	kern_memorystatus.h \
189	kern_memorystatus_freeze.h \
190	kern_memorystatus_notify.h \
191	kpi_private.h \
192	ktrace.h \
193	kdebug_triage.h \
194	linker_set.h \
195	mach_swapon.h \
196	monotonic.h \
197	msgbuf.h \
198	eventvar.h \
199	persona.h \
200	preoslog.h \
201	proc_info.h \
202	pthread_shims.h \
203	quota.h \
204	reboot.h \
205	resourcevar.h \
206	sem_internal.h \
207	shm_internal.h \
208	signalvar.h \
209	stackshot.h \
210	timeb.h times.h \
211	tprintf.h \
212	tty.h  ttychars.h \
213	ttydefaults.h ttydev.h \
214	user.h \
215	vfs_context.h \
216	vmmeter.h \
217	reason.h \
218	spawn_internal.h \
219	priv.h \
220	pgo.h \
221	memory_maintenance.h \
222	doc_tombstone.h \
223	fsevents.h \
224	work_interval.h \
225	kern_sysctl.h \
226	vsock_transport.h \
227	trust_caches.h \
228	code_signing.h \
229
230XNU_ONLY_EXPORTS = \
231	bsdtask_info.h \
232	file_internal.h \
233	filedesc.h \
234	guarded.h \
235	mount_internal.h \
236	munge.h \
237	pipe.h \
238	proc_internal.h \
239	proc_require.h \
240	proc_ro.h \
241	pthread_internal.h \
242	resourcevar.h \
243	semaphore.h \
244	tree.h \
245	uio_internal.h \
246	ulock.h \
247	ux_exception.h \
248	vnode_internal.h \
249	vsock_domain.h
250
251# /usr/include
252INSTALL_MI_LIST	= ${DATAFILES}
253
254INSTALL_MODULEMAP_MI_LIST = ${MODULEMAPFILES}
255
256INSTALL_DRIVERKIT_MI_LIST = ${DRIVERKIT_DATAFILES}
257
258INSTALL_MI_GEN_LIST = syscall.h _posix_availability.h _symbol_aliasing.h
259
260INSTALL_DRIVERKIT_MI_GEN_LIST = _posix_availability.h _symbol_aliasing.h
261
262INSTALL_MI_DIR = sys
263
264EXPORT_MI_LIST	= $(sort ${KERNELFILES} ${PRIVATE_KERNELFILES} ${XNU_ONLY_EXPORTS})
265
266EXPORT_MI_GEN_LIST = syscall.h sysproto.h
267
268EXPORT_MI_DIR = sys
269
270# /usr/local/include
271INSTALL_MI_LCL_LIST = $(sort \
272	codesign.h content_protection.h csr.h decmpfs.h fsevents.h kdebug_private.h \
273	kern_memorystatus.h perfmon_private.h preoslog.h reason.h resource_private.h \
274	stackshot.h work_interval.h event_log.h \
275	${EXTRA_PRIVATE_DATAFILES})
276
277# /System/Library/Frameworks/System.framework/PrivateHeaders
278INSTALL_SF_MI_LCL_LIST = ${DATAFILES} ${PRIVATE_DATAFILES}
279
280INSTALL_SF_MI_LCL_GEN_LIST = ${INSTALL_MI_GEN_LIST}
281
282INSTALL_DRIVERKIT_MI_LCL_LIST = ${DRIVERKIT_PRIVATE_DATAFILES}
283
284# /System/Library/Frameworks/Kernel.framework/PrivateHeaders
285INSTALL_KF_MI_LCL_LIST =  ${KERNELFILES} ${PRIVATE_KERNELFILES}
286
287INSTALL_KF_MI_LCL_GEN_LIST = sysproto.h
288
289# /System/Library/Frameworks/Kernel.framework/Headers
290INSTALL_KF_MI_LIST = ${KERNELFILES}
291
292INSTALL_KF_MI_GEN_LIST =
293
294MAKESYSCALLS = $(SRCROOT)/bsd/kern/makesyscalls.sh
295
296$(OBJROOT)/cscope.genhdrs:
297	$(_v)mkdir -p $(OBJROOT)/cscope.genhdrs
298
299$(OBJROOT)/syscall.codes: $(TARGET)/bsd.syscalls.master
300	@$(LOG_GENERATE) "$(ColorLF)$@$(Color0) from $(ColorF)$(<F)$(Color0)"
301	$(_v)$(MAKESYSCALLS) $< trace > $@
302
303
304$(OBJROOT)/trace.codes: $(SRCROOT)/bsd/kern/trace_codes $(OBJROOT)/syscall.codes
305	$(_v)sort -g $(SRCROOT)/bsd/kern/trace_codes $(OBJROOT)/syscall.codes >$@
306
307syscall.h: $(TARGET)/bsd.syscalls.master $(OBJROOT)/cscope.genhdrs
308	@$(LOG_GENERATE) "$(ColorLF)bsd/sys/$@$(Color0) from $(ColorF)$(<F)$(Color0)"
309	@echo "$(OBJPATH)/bsd/sys/$@" > $(OBJROOT)/cscope.genhdrs/$@.path
310	$(_v)$(MAKESYSCALLS) $< header > /dev/null
311
312sysproto.h: $(TARGET)/bsd.syscalls.master $(OBJROOT)/cscope.genhdrs
313	@$(LOG_GENERATE) "bsd/sys/$@$(Color0) from $(ColorF)$(<F)$(Color0)"
314	@echo "$(OBJPATH)/bsd/sys/$@" > $(OBJROOT)/cscope.genhdrs/$@.path
315	$(_v)$(MAKESYSCALLS) $< proto > /dev/null
316
317MAKE_POSIX_AVAILABILITY = $(SRCROOT)/bsd/sys/make_posix_availability.sh
318_posix_availability.h: $(MAKE_POSIX_AVAILABILITY)
319	@$(LOG_GENERATE) "bsd/sys/$@$(Color0)"
320	$(_v)$(MAKE_POSIX_AVAILABILITY) "$@"
321
322MAKE_SYMBOL_ALIASING = $(SRCROOT)/bsd/sys/make_symbol_aliasing.sh
323_symbol_aliasing.h: $(MAKE_SYMBOL_ALIASING)
324	@$(LOG_GENERATE) "bsd/sys/$@$(Color0)"
325	$(_v)$(MAKE_SYMBOL_ALIASING) "$(SDKROOT)" "$@"
326
327# generated headers needed early (used by iig during installhdrs of iokit/DriverKit)
328SETUP_GEN_LIST = _posix_availability.h _symbol_aliasing.h
329
330do_build_setup:: $(SETUP_GEN_LIST)
331
332TRACE_CODES_DEST = \
333	$(DSTROOT)/$(INSTALL_SHARE_MISC_DIR)/trace.codes
334
335$(TRACE_CODES_DEST): $(OBJROOT)/trace.codes
336	$(_v)$(MKDIR) $(DSTROOT)/$(INSTALL_SHARE_MISC_DIR)
337	@$(LOG_INSTALL) "$(@F)"
338	$(_v)$(INSTALL) $(INSTALL_FLAGS) $(OBJROOT)/trace.codes $@
339
340do_textfiles_install_mi:: $(TRACE_CODES_DEST)
341
342include $(MakeInc_rule)
343include $(MakeInc_dir)
344