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