xref: /xnu-10002.81.5/osfmk/mach/Makefile (revision 5e3eaea39dcf651e66cb99ba7d70e32cc4a99587)
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 = machine
10INSTINC_SUBDIRS_X86_64 = i386
11INSTINC_SUBDIRS_X86_64H = i386
12INSTINC_SUBDIRS_ARM = arm arm64
13INSTINC_SUBDIRS_ARM64 = arm arm64
14
15EXPINC_SUBDIRS = machine
16EXPINC_SUBDIRS_X86_64 = i386
17EXPINC_SUBDIRS_X86_64H = i386
18EXPINC_SUBDIRS_ARM = arm arm64
19EXPINC_SUBDIRS_ARM64 = arm arm64
20
21MIG_TYPES = \
22	clock_types.defs \
23	mach_types.defs \
24	std_types.defs
25
26MIG_DEFS =	\
27	audit_triggers.defs \
28	clock.defs \
29	clock_priv.defs \
30	clock_reply.defs \
31	exc.defs \
32	host_notify_reply.defs \
33	host_priv.defs \
34	host_security.defs \
35	mach_exc.defs \
36	mach_host.defs \
37	mach_port.defs \
38	mach_vm.defs \
39	mach_voucher.defs \
40	mach_voucher_attr_control.defs \
41	memory_entry.defs \
42	memory_error_notification.defs \
43	notify.defs \
44	processor.defs \
45	processor_set.defs \
46	task.defs \
47	task_access.defs \
48	telemetry_notification.defs \
49	thread_act.defs \
50	vm_map.defs
51
52MIG_PRIVATE_DEFS = \
53	mach_eventlink.defs \
54	restartable.defs \
55	sysdiagnose_notification.defs
56
57MACH_PRIVATE_DEFS = \
58	coalition_notification.defs \
59	fairplayd_notification.defs \
60	arcade_upcall.defs \
61	ktrace_background.defs \
62	mach_notify.defs \
63	mach_test_upcall.defs \
64	memory_error_notification.defs \
65	upl.defs \
66	vfs_nspace.defs \
67	vm32_map.defs \
68	iocompressionstats_notification.defs
69
70#
71# MIG-generated headers that are traditionally used by user
72# level code.
73#
74MIG_USHDRS = \
75	audit_triggers_server.h \
76	clock_reply_server.h \
77	coalition_notification_server.h \
78	exc_server.h \
79	fairplayd_notification_server.h \
80	arcade_upcall_server.h \
81	memory_error_notification_server.h \
82	mach_exc_server.h \
83	notify_server.h \
84	task_access_server.h \
85	telemetry_notification_server.h \
86	sysdiagnose_notification_server.h \
87	iocompressionstats_notification_server.h \
88	vfs_nspace_server.h
89
90MIG_UUHDRS = \
91	clock.h \
92	clock_priv.h \
93	host_priv.h \
94	host_security.h \
95	ktrace_background.h \
96	mach_host.h \
97	mach_port.h \
98	mach_vm.h \
99	mach_voucher.h \
100	mach_voucher_attr_control.h \
101	memory_entry.h \
102	processor.h \
103	processor_set.h \
104	task.h \
105	task_access.h \
106	thread_act.h \
107	upl.h \
108	vm_map.h \
109	vfs_nspace.h
110
111MIGINCLUDES = ${MIG_UUHDRS} ${MIG_USHDRS}
112
113# Files that are public on macOS, but private on embedded
114EMBEDDED_PRIVATE_DATAFILES = \
115	shared_region.h \
116	dyld_pager.h
117
118ifeq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS) $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),)
119EXTRA_DATAFILES = $(EMBEDDED_PRIVATE_DATAFILES)
120else
121EXTRA_PRIVATE_DATAFILES = $(EMBEDDED_PRIVATE_DATAFILES)
122endif
123
124# machine.h is covered by machine/mach_machine.modulemap.
125DATAFILES = $(sort \
126	audit_triggers_types.h \
127        boolean.h \
128        clock_types.h \
129        dyld_kernel.h \
130        error.h \
131	exception.h \
132	exception_types.h \
133	host_notify.h \
134        host_info.h \
135	host_reboot.h \
136	host_special_ports.h \
137	kern_return.h \
138        kmod.h \
139        mach_param.h \
140	mach_time.h \
141	mach_traps.h \
142        mach_types.h \
143	mach_voucher_types.h \
144	machine.h \
145        mach_syscalls.h \
146        memory_object_types.h \
147        message.h \
148	mig.h \
149	mig_errors.h \
150	mig_voucher_support.h \
151	mig_strncpy_zerofill_support.h \
152	ndr.h \
153        notify.h \
154	policy.h \
155	port.h \
156        processor_info.h \
157	rpc.h \
158	sdt.h \
159        semaphore.h \
160	shared_memory_server.h \
161	std_types.h \
162	sync_policy.h \
163        syscall_sw.h \
164	task_info.h \
165	task_inspect.h \
166	task_policy.h \
167	task_special_ports.h \
168        thread_info.h \
169	thread_policy.h \
170	thread_special_ports.h \
171        thread_status.h \
172	thread_switch.h \
173	time_value.h \
174        vm_attributes.h \
175        vm_behavior.h \
176	vm_inherit.h \
177	vm_param.h \
178        vm_prot.h \
179	vm_purgable.h \
180        vm_region.h \
181	vm_statistics.h \
182	vm_sync.h \
183	vm_types.h \
184	${EXTRA_DATAFILES} \
185	${MIG_TYPES} \
186	${MIG_DEFS})
187
188# mach.modulemap additionally includes headers installed by Libsyscall
189# ../../libsyscall/xcodescripts/mach_install_mig.sh: MIGS, MACH_HDRS.
190# mach.modulemap additionally includes hv_kern_types.h from ../arm64/hv
191# and sdt.h from ../../bsd/sys
192MODULEMAPFILES = \
193	mach.modulemap
194
195INSTALL_MI_LIST	= \
196	bootstrap.h \
197	${DATAFILES}
198
199INSTALL_MODULEMAP_MI_LIST = ${MODULEMAPFILES}
200
201EXCLAVES_DATAFILES = \
202	exclaves.h
203
204# installed into System.framework's PrivateHeaders/mach subdirectory
205PRIVATE_DATAFILES = $(sort \
206	bootstrap.h \
207	coalition.h \
208	coalition_notification.defs \
209	fairplayd_notification.defs \
210	iocompressionstats_notification.defs \
211	arcade_register.defs \
212	arcade_upcall.defs \
213	host_info.h \
214	ktrace_background.defs \
215	mach_eventlink_types.h \
216	mach_host.defs \
217	mach_time_private.h \
218	mach_traps.h \
219	memory_error_notification.defs \
220	memory_object_types.h \
221	mig.h \
222	mk_timer.h \
223	processor_info.h \
224	resource_notify.defs \
225	resource_monitors.h \
226	semaphore.h \
227	sfi_class.h \
228	syscall_sw.h \
229	sysdiagnose_notification.defs \
230	task_info.h \
231	task_inspect.h \
232	task_policy.h \
233	task_policy_private.h \
234	thread_policy.h \
235	thread_policy_private.h \
236	thread_switch.h \
237	vfs_nspace.defs \
238	vm_prot.h \
239	vm_reclaim.h \
240	${EXCLAVES_DATAFILES} \
241	${EXTRA_PRIVATE_DATAFILES} \
242	${MIG_PRIVATE_DEFS})
243
244# mach_private.modulemap additionally includes headers installed by Libsyscall
245# ../../libsyscall/xcodescripts/mach_install_mig.sh: MIGS_PRIVATE, MACH_PRIVATE_HDRS
246PRIVATE_MODULEMAPFILES = \
247	mach_private.modulemap
248
249INSTALL_MI_LCL_LIST = $(sort coalition.h mach_time_private.h mk_timer.h resource_monitors.h task_policy_private.h thread_policy_private.h ${EXCLAVES_DATAFILES} ${EXTRA_PRIVATE_DATAFILES})
250
251INSTALL_MODULEMAP_MI_LCL_LIST = ${PRIVATE_MODULEMAPFILES}
252
253INSTALL_SF_MI_LCL_LIST = ${INSTALL_MI_LIST} ${PRIVATE_DATAFILES}
254
255INSTALL_KF_MI_LIST = $(sort \
256	mach_interface.h \
257	$(filter-out mach_traps.h mach_syscalls.h thread_switch.h, ${DATAFILES} ${EXTRA_PRIVATE_DATAFILES}))
258
259INSTALL_KF_MI_LCL_LIST = $(sort \
260	coalition.h \
261	mach_interface.h \
262	mach_time_private.h \
263	task_policy_private.h \
264	thread_policy_private.h \
265	${EXCLAVES_DATAFILES} \
266	$(filter-out mach_traps.h mach_syscalls.h thread_switch.h, ${DATAFILES} ${EXTRA_PRIVATE_DATAFILES}))
267
268INSTALL_MI_GEN_LIST =
269
270INSTALL_MI_DIR = mach
271
272EXPORT_MI_LIST	= $(sort \
273	coalition.h \
274	mach_interface.h \
275	mach_time_private.h \
276	memory_object_control.h \
277	resource_monitors.h \
278	task_policy_private.h \
279	thread_policy_private.h \
280	mach_eventlink_types.h \
281	sfi_class.h \
282	${EXCLAVES_DATAFILES} \
283	${DATAFILES} \
284	${EXTRA_PRIVATE_DATAFILES})
285
286EXPORT_MI_GEN_LIST = \
287	${MIGINCLUDES}
288
289EXPORT_MI_DIR = mach
290
291${MIGINCLUDES} : ${MIG_TYPES}
292
293${MIG_UUHDRS} : \
294	%.h : %.defs
295	@$(LOG_MIG) $@
296	$(_v)$(MIG) $(MIGFLAGS)		\
297		-server /dev/null	\
298		-user /dev/null		\
299		-header $@		\
300		$<
301
302${MIG_USHDRS} : \
303	%_server.h : %.defs
304	@$(LOG_MIG) $@
305	$(_v)$(MIG) $(MIGFLAGS)		\
306		-server /dev/null	\
307		-user /dev/null		\
308		-header /dev/null	\
309		-sheader $@		\
310		$<
311
312#
313# Build path
314#
315
316INCFLAGS_MAKEFILE= -I..
317
318MIGKSFLAGS      = -DMACH_KERNEL_PRIVATE -DKERNEL_SERVER=1 -mach_msg2
319MIGKUFLAGS      = -DMACH_KERNEL_PRIVATE -DKERNEL_USER=1 -maxonstack 1024
320#
321# MIG-generated headers that are traditionally used by kernel
322# level code.
323#
324
325# sender-side ("user") headers generated by MIG from corresponding .defs
326MIG_KUHDRS = \
327	audit_triggers.h \
328	clock_reply.h \
329	exc.h \
330	host_notify_reply.h \
331	ktrace_background.h \
332	mach_exc.h \
333	mach_notify.h \
334	mach_test_upcall.h \
335	resource_notify.h \
336	task_access.h \
337	upl.h \
338	vm_map.h
339
340# sender-side ("user") source files generated by MIG from corresponding .defs
341MIG_KUSRC = \
342	audit_triggers_user.c \
343	clock_reply_user.c \
344	coalition_notification_user.c \
345	exc_user.c \
346	fairplayd_notification_user.c \
347	arcade_upcall_user.c \
348	host_notify_reply_user.c \
349	ktrace_background_user.c \
350	memory_error_notification_user.c \
351	mach_exc_user.c \
352	mach_notify_user.c \
353	mach_test_upcall_user.c \
354	resource_notify_user.c \
355	task_access_user.c \
356	telemetry_notification_user.c \
357	iocompressionstats_notification_user.c \
358	upl_user.c \
359	vfs_nspace_user.c \
360	vm_map_user.c \
361	sysdiagnose_notification_user.c
362
363MIG_KSHDRS = \
364	arcade_register_server.h \
365	clock_server.h \
366	mach_eventlink_server.h \
367	exc_server.h \
368	host_priv_server.h \
369	host_security_server.h \
370	mach_exc_server.h \
371	mach_host_server.h \
372	mach_notify_server.h \
373	mach_port_server.h \
374	mach_vm_server.h \
375	mach_voucher_server.h \
376	memory_entry_server.h \
377	processor_server.h \
378	processor_set_server.h \
379	restartable_server.h \
380	task_server.h \
381	thread_act_server.h \
382	upl_server.h \
383	vm_map_server.h \
384	vm32_map_server.h
385
386MIG_KSSRC = \
387	arcade_register_server.c \
388	clock_server.c \
389	mach_eventlink_server.c \
390	exc_server.c \
391	host_priv_server.c \
392	host_security_server.c \
393	mach_exc_server.c \
394	mach_host_server.c \
395	mach_notify_server.c \
396	mach_port_server.c \
397	mach_vm_server.c \
398	mach_voucher_server.c \
399	memory_entry_server.c \
400	processor_server.c \
401	processor_set_server.c \
402	restartable_server.c \
403	task_server.c \
404	thread_act_server.c \
405	upl_server.c \
406	vm_map_server.c \
407	vm32_map_server.c
408
409#
410# JMM -
411# Since there are two generated header files with the same name, one for
412# install and export, the other for internal use (and they are different)
413# we can't explicitly list two rules for the same target.  So rules for
414# generating internal headers will be handled implicitly by creating rules
415# to generate the internal C sources, and the headers get created as a
416# side-effect.
417#
418#
419# This is all temporary scaffolding, as we are moving to a model where
420# the MIG-generated code is identical in all environments.  At first, it
421# will contain some environment-specific ifdefs, but over time should not
422# even require that as we move towards making all the environments look
423# the same.
424#
425COMP_FILES = ${MIG_KUSRC} ${MIG_KSSRC}
426
427do_build_all:: $(COMP_FILES)
428
429${COMP_FILES} : ${MIG_TYPES}
430
431${MIG_KUSRC} : \
432	%_user.c : %.defs
433	@$(LOG_MIG) $@
434	$(_v)${MIG} ${MIGFLAGS} ${MIGKUFLAGS}        \
435		-user    $*_user.c              \
436		-header  $*.h              \
437		-server  /dev/null		\
438		-sheader /dev/null		\
439		$<
440
441${MIG_KSSRC}: \
442	%_server.c : %.defs
443	@$(LOG_MIG) $@
444	$(_v)${MIG} ${MIGFLAGS} ${MIGKSFLAGS}        \
445		-user    /dev/null              \
446		-header  /dev/null              \
447		-server  $*_server.c		\
448		-sheader $*_server.h		\
449		$<
450
451include $(MakeInc_rule)
452include $(MakeInc_dir)
453