xref: /xnu-8796.101.5/osfmk/mach/Makefile (revision aca3beaa3dfbd42498b42c5e5ce20a938e6554e5)
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
201# installed into System.framework's PrivateHeaders/mach subdirectory
202PRIVATE_DATAFILES = $(sort \
203	bootstrap.h \
204	coalition.h \
205	coalition_notification.defs \
206	fairplayd_notification.defs \
207	iocompressionstats_notification.defs \
208	arcade_register.defs \
209	arcade_upcall.defs \
210	host_info.h \
211	ktrace_background.defs \
212	mach_eventlink_types.h \
213	mach_host.defs \
214	mach_traps.h \
215	memory_error_notification.defs \
216	memory_object_types.h \
217	mig.h \
218	mk_timer.h \
219	processor_info.h \
220	resource_notify.defs \
221	resource_monitors.h \
222	semaphore.h \
223	sfi_class.h \
224	syscall_sw.h \
225	sysdiagnose_notification.defs \
226	task_info.h \
227	task_inspect.h \
228	task_policy.h \
229	task_policy_private.h \
230	thread_policy.h \
231	thread_policy_private.h \
232	thread_switch.h \
233	vfs_nspace.defs \
234	vm_prot.h \
235	vm_reclaim.h \
236	${EXTRA_PRIVATE_DATAFILES} \
237	${MIG_PRIVATE_DEFS})
238
239# mach_private.modulemap additionally includes headers installed by Libsyscall
240# ../../libsyscall/xcodescripts/mach_install_mig.sh: MIGS_PRIVATE, MACH_PRIVATE_HDRS
241PRIVATE_MODULEMAPFILES = \
242	mach_private.modulemap
243
244INSTALL_MI_LCL_LIST = $(sort resource_monitors.h task_policy_private.h thread_policy_private.h ${EXTRA_PRIVATE_DATAFILES})
245
246INSTALL_MODULEMAP_MI_LCL_LIST = ${PRIVATE_MODULEMAPFILES}
247
248INSTALL_SF_MI_LCL_LIST = ${INSTALL_MI_LIST} ${PRIVATE_DATAFILES}
249
250INSTALL_KF_MI_LIST = $(sort \
251	mach_interface.h \
252	$(filter-out mach_traps.h mach_syscalls.h thread_switch.h, ${DATAFILES} ${EXTRA_PRIVATE_DATAFILES}))
253
254INSTALL_KF_MI_LCL_LIST = $(sort \
255	coalition.h \
256	mach_interface.h \
257	task_policy_private.h \
258	thread_policy_private.h \
259	$(filter-out mach_traps.h mach_syscalls.h thread_switch.h, ${DATAFILES} ${EXTRA_PRIVATE_DATAFILES}))
260
261INSTALL_MI_GEN_LIST =
262
263INSTALL_MI_DIR = mach
264
265EXPORT_MI_LIST	= $(sort \
266	coalition.h \
267	mach_interface.h \
268	memory_object_control.h \
269	resource_monitors.h \
270	task_policy_private.h \
271	thread_policy_private.h \
272	mach_eventlink_types.h \
273	sfi_class.h \
274	${DATAFILES} \
275	${EXTRA_PRIVATE_DATAFILES})
276
277EXPORT_MI_GEN_LIST = \
278	${MIGINCLUDES}
279
280EXPORT_MI_DIR = mach
281
282${MIGINCLUDES} : ${MIG_TYPES}
283
284${MIG_UUHDRS} : \
285	%.h : %.defs
286	@$(LOG_MIG) $@
287	$(_v)$(MIG) $(MIGFLAGS)		\
288		-server /dev/null	\
289		-user /dev/null		\
290		-header $@		\
291		$<
292
293${MIG_USHDRS} : \
294	%_server.h : %.defs
295	@$(LOG_MIG) $@
296	$(_v)$(MIG) $(MIGFLAGS)		\
297		-server /dev/null	\
298		-user /dev/null		\
299		-header /dev/null	\
300		-sheader $@		\
301		$<
302
303#
304# Build path
305#
306
307INCFLAGS_MAKEFILE= -I..
308
309MIGKSFLAGS      = -DMACH_KERNEL_PRIVATE -DKERNEL_SERVER=1
310MIGKUFLAGS      = -DMACH_KERNEL_PRIVATE -DKERNEL_USER=1 -maxonstack 1024
311#
312# MIG-generated headers that are traditionally used by kernel
313# level code.
314#
315
316# sender-side ("user") headers generated by MIG from corresponding .defs
317MIG_KUHDRS = \
318	audit_triggers.h \
319	clock_reply.h \
320	exc.h \
321	host_notify_reply.h \
322	ktrace_background.h \
323	mach_exc.h \
324	mach_notify.h \
325	mach_test_upcall.h \
326	resource_notify.h \
327	task_access.h \
328	upl.h \
329	vm_map.h
330
331# sender-side ("user") source files generated by MIG from corresponding .defs
332MIG_KUSRC = \
333	audit_triggers_user.c \
334	clock_reply_user.c \
335	coalition_notification_user.c \
336	exc_user.c \
337	fairplayd_notification_user.c \
338	arcade_upcall_user.c \
339	host_notify_reply_user.c \
340	ktrace_background_user.c \
341	memory_error_notification_user.c \
342	mach_exc_user.c \
343	mach_notify_user.c \
344	mach_test_upcall_user.c \
345	resource_notify_user.c \
346	task_access_user.c \
347	telemetry_notification_user.c \
348	iocompressionstats_notification_user.c \
349	upl_user.c \
350	vfs_nspace_user.c \
351	vm_map_user.c \
352	sysdiagnose_notification_user.c
353
354MIG_KSHDRS = \
355	arcade_register_server.h \
356	clock_server.h \
357	mach_eventlink_server.h \
358	exc_server.h \
359	host_priv_server.h \
360	host_security_server.h \
361	mach_exc_server.h \
362	mach_host_server.h \
363	mach_notify_server.h \
364	mach_port_server.h \
365	mach_vm_server.h \
366	mach_voucher_server.h \
367	memory_entry_server.h \
368	processor_server.h \
369	processor_set_server.h \
370	restartable_server.h \
371	task_server.h \
372	thread_act_server.h \
373	upl_server.h \
374	vm_map_server.h \
375	vm32_map_server.h
376
377MIG_KSSRC = \
378	arcade_register_server.c \
379	clock_server.c \
380	mach_eventlink_server.c \
381	exc_server.c \
382	host_priv_server.c \
383	host_security_server.c \
384	mach_exc_server.c \
385	mach_host_server.c \
386	mach_notify_server.c \
387	mach_port_server.c \
388	mach_vm_server.c \
389	mach_voucher_server.c \
390	memory_entry_server.c \
391	processor_server.c \
392	processor_set_server.c \
393	restartable_server.c \
394	task_server.c \
395	thread_act_server.c \
396	upl_server.c \
397	vm_map_server.c \
398	vm32_map_server.c
399
400#
401# JMM -
402# Since there are two generated header files with the same name, one for
403# install and export, the other for internal use (and they are different)
404# we can't explicitly list two rules for the same target.  So rules for
405# generating internal headers will be handled implicitly by creating rules
406# to generate the internal C sources, and the headers get created as a
407# side-effect.
408#
409#
410# This is all temporary scaffolding, as we are moving to a model where
411# the MIG-generated code is identical in all environments.  At first, it
412# will contain some environment-specific ifdefs, but over time should not
413# even require that as we move towards making all the environments look
414# the same.
415#
416COMP_FILES = ${MIG_KUSRC} ${MIG_KSSRC}
417
418do_build_all:: $(COMP_FILES)
419
420${COMP_FILES} : ${MIG_TYPES}
421
422${MIG_KUSRC} : \
423	%_user.c : %.defs
424	@$(LOG_MIG) $@
425	$(_v)${MIG} ${MIGFLAGS} ${MIGKUFLAGS}        \
426		-user    $*_user.c              \
427		-header  $*.h              \
428		-server  /dev/null		\
429		-sheader /dev/null		\
430		$<
431
432${MIG_KSSRC}: \
433	%_server.c : %.defs
434	@$(LOG_MIG) $@
435	$(_v)${MIG} ${MIGFLAGS} ${MIGKSFLAGS}        \
436		-user    /dev/null              \
437		-header  /dev/null              \
438		-server  $*_server.c		\
439		-sheader $*_server.h		\
440		$<
441
442include $(MakeInc_rule)
443include $(MakeInc_dir)
444