xref: /xnu-11215/osfmk/device/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
9MIG_DEFS =	\
10	device.defs
11
12MIG_HDRS = \
13
14# Files that are public on macOS, but private on embedded
15EMBEDDED_PRIVATE_DATAFILES = \
16	device_types.defs \
17	${MIG_DEFS}
18
19ifeq ($(filter $(SUPPORTED_EMBEDDED_PLATFORMS) $(SUPPORTED_SIMULATOR_PLATFORMS),$(PLATFORM)),)
20EXTRA_DATAFILES = $(EMBEDDED_PRIVATE_DATAFILES)
21else
22# Temporarily install some private defs in both usr/include and usr/local/include.
23# They belong in usr/local/include, but installing them in both locations will allow
24# clients that compile them by full path to switch without lock-step submissions.
25EXTRA_DATAFILES = device.defs device_types.defs
26EXTRA_PRIVATE_DATAFILES = $(EMBEDDED_PRIVATE_DATAFILES)
27endif
28
29DATAFILES = $(sort \
30	device_types.h device_port.h \
31	${EXTRA_DATAFILES})
32
33MODULEMAPFILES = \
34	device.modulemap
35
36PRIVATE_DATAFILES = $(sort \
37	device_types.h \
38	${EXTRA_PRIVATE_DATAFILES})
39
40# device_types.h has some userspace IOKit types that are used by
41# IOTypes.h clients. The types are guarded by `IOKIT` because they
42# conflict with internal xnu types. However, once device_types.h
43# is part of the Darwin module, it gets processed before IOTypes.h
44# defines IOKIT. Later when IOTypes.h includes the header, it's
45# too late and the types don't get defined. Remove the IOKIT guard
46# in userspace to fix that problem and always define the IOKit types.
47KERNEL_ONLY_GUARDS_UNIFDEF = -DIOKIT
48
49MIGINCLUDES = \
50
51INSTALL_MI_LIST	= ${DATAFILES} ${_MIG_HDRS_} ${MIGINCLUDES}
52
53INSTALL_MODULEMAP_MI_LIST = ${MODULEMAPFILES}
54
55INSTALL_MI_LCL_LIST = ${EXTRA_PRIVATE_DATAFILES}
56
57INSTALL_SF_MI_LCL_LIST = ${DATAFILES} ${PRIVATE_DATAFILES} ${_MIG_HDRS_} ${MIGINCLUDES}
58
59INSTALL_MI_DIR = device
60
61EXPORT_MI_LIST	= ${DATAFILES} ${_MIG_HDRS_} ${MIGINCLUDES}
62
63EXPORT_MI_DIR = device
64
65#
66# Build path
67#
68INCFLAGS_MAKEFILE= -I..
69
70DEVICE_FILES    = device_server.h device_server.c
71
72COMP_FILES	= ${DEVICE_FILES}
73
74do_build_all:: $(COMP_FILES)
75
76${DEVICE_FILES}: device.defs
77	@$(LOG_MIG) "$@"
78	$(_v)${MIG} ${MIGFLAGS} ${MIGKSFLAGS}	\
79	-header /dev/null			\
80	-user /dev/null				\
81	-sheader device_server.h		\
82	-server device_server.c			\
83	$<
84
85include $(MakeInc_rule)
86include $(MakeInc_dir)
87