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