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