xnu-4570.51.1.tar.gz
[apple/xnu.git] / osfmk / conf / Makefile.template
1 #
2 # Mach Operating System
3 # Copyright (c) 1986 Carnegie-Mellon University
4 # All rights reserved. The CMU software License Agreement specifies
5 # the terms and conditions for use and redistribution.
6 #
7
8 export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
9 export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
10 export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
11 export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
12
13 include $(MakeInc_cmd)
14 include $(MakeInc_def)
15
16 #
17 # XXX: CFLAGS
18 #
19 CFLAGS+= -include meta_features.h -DMACH_KERNEL_PRIVATE -DMACH_KERNEL
20 SFLAGS+= -include meta_features.h
21
22 # Objects that don't want -Wcast-align warning (8474835)
23 OBJS_NO_CAST_ALIGN = \
24 atm_notification_user.o \
25 model_dep.o \
26 video_console.o \
27 kdp_udp.o \
28 kdp_machdep.o \
29 host.o \
30 processor.o \
31 sched_prim.o \
32 task.o \
33 thread.o \
34 threadinfo.o \
35 gssd_mach.o \
36 UNDRequest.o \
37 panic_dialog.o \
38 bsd_i386.o \
39 commpage.o \
40 cpu_threads.o \
41 cpuid.o \
42 locks_i386.o \
43 machine_task.o \
44 mp_desc.o \
45 pcb.o \
46 pcb_native.o \
47 kdp_x86_common.o \
48 memory_object.o \
49 vm_apple_protect.o \
50 vm_map.o \
51 startup64.o \
52 affinity.o \
53 sched_grrr.o \
54 sched_proto.o \
55 stack.o \
56 task_policy.o \
57 wait_queue.o \
58 bsd_kern.o \
59 pmc.o \
60 status.o \
61 machine_routines.o \
62 loose_ends.o \
63 fips_sha1.o \
64 prng_yarrow.o \
65 sha1mod.o \
66 sleh.o \
67 ccdigest_final_64be.o \
68 ccdigest_init.o \
69 ccdigest_update.o \
70 cchmac_final.o \
71 cchmac_init.o \
72 ccsha1.o \
73 ipc_object.o \
74 ccmode_ctr_crypt.o \
75 ccmode_factory_ctr_crypt.o \
76 ccmode_ctr_init.o \
77 ccmode_ctr_setctr.o \
78 ipc_kmsg.o \
79 ipc_right.o \
80 bsd_vm.o \
81 vm_map_store.o \
82 vm_map_store_ll.o \
83 vm_map_store_rb.o \
84 vm_debug.o
85
86 # Objects that don't want -Wsign-compare warning (15294427)
87 OBJS_NO_SIGN_COMPARE = \
88 atm_notification_user.o
89
90 $(foreach file,$(OBJS_NO_CAST_ALIGN),$(eval $(call add_perfile_cflags,$(file),-Wno-cast-align)))
91 $(foreach file,$(OBJS_NO_SIGN_COMPARE),$(eval $(call add_perfile_cflags,$(file),-Wno-sign-compare)))
92
93 #
94 # XXX: INCFLAGS to include libsa prototypes
95 #
96 INCFLAGS_MAKEFILE= -I$(SOURCE)libsa
97
98 #
99 # Directories for mig generated files
100 #
101 COMP_SUBDIRS = \
102 atm \
103 default_pager \
104 device \
105 mach \
106 UserNotification \
107 gssd \
108 kextd \
109 lockd
110
111 #
112 # Make sure we don't remove this by accident if interrupted at the wrong
113 # time.
114 #
115 .PRECIOUS: Makefile
116
117 #
118 # Theses macros are filled in by the config program depending on the
119 # current configuration. The MACHDEP macro is replaced by the
120 # contents of the machine dependent makefile template and the others
121 # are replaced by the corresponding symbol definitions for the
122 # configuration.
123 #
124
125 %OBJS
126
127 %CFILES
128
129 %CXXFILES
130
131 %SFILES
132
133 %MACHDEP
134
135 # Rebuild if per-file overrides change
136 ${OBJS}: $(firstword $(MAKEFILE_LIST))
137
138 # Rebuild if global compile flags change
139 $(COBJS): .CFLAGS
140 .CFLAGS: ALWAYS
141 $(_v)$(REPLACECONTENTS) $@ $(KCC) $(CFLAGS) $(INCFLAGS)
142 $(CXXOBJS): .CXXFLAGS
143 .CXXFLAGS: ALWAYS
144 $(_v)$(REPLACECONTENTS) $@ $(KC++) $(CXXFLAGS) $(INCFLAGS)
145 $(SOBJS): .SFLAGS
146 .SFLAGS: ALWAYS
147 $(_v)$(REPLACECONTENTS) $@ $(S_KCC) $(SFLAGS) $(INCFLAGS)
148
149 $(COMPONENT).filelist: $(OBJS)
150 $(_v)for hib_file in ${HIB_FILES}; \
151 do \
152 $(SEG_HACK) -n __HIB -o $${hib_file}__ $${hib_file} || exit 1; \
153 mv $${hib_file}__ $${hib_file} || exit 1; \
154 done
155 @echo "$(ColorL)LDFILELIST$(Color0) $(ColorLF)$(COMPONENT)$(Color0)"
156 $(_v)for obj in ${OBJS}; do \
157 echo $(TARGET)/$(CURRENT_KERNEL_CONFIG)/$${obj}; \
158 done > $(COMPONENT).filelist
159
160 do_all: $(COMPONENT).filelist
161
162 do_build_all:: do_all
163
164 # genassym.o actually is an assembly file,
165 # we name it genassym.o to help with the automatic
166 # dependency generation
167
168 GENASSYM_LOCATION = $(CURRENT_ARCH_CONFIG_LC)
169
170 ifeq ($(CURRENT_ARCH_CONFIG_LC),x86_64)
171 GENASSYM_LOCATION = i386
172 else ifeq ($(CURRENT_ARCH_CONFIG_LC),x86_64h)
173 GENASSYM_LOCATION = i386
174 endif
175
176 -include genassym.d
177 genassym.o: .CFLAGS $(firstword $(MAKEFILE_LIST))
178 genassym.o: $(SOURCE_DIR)/$(COMPONENT)/$(GENASSYM_LOCATION)/genassym.c
179 @echo "[$(CMD_MC)] $(ColorH)GENASSYM$(Color0) $(ColorLF)$<$(Color0)"
180 $(_v)${GENASSYM_KCC} ${CFLAGS} ${CFLAGS_NOLTO_FLAG} -MD -S -o ${@} ${INCFLAGS} $<
181
182 assym.s: genassym.o
183 $(_v)sed -e '/^[[:space:]]*DEFINITION__define__/!d;{N;s/\n//;}' -e 's/^[[:space:]]*DEFINITION__define__\([^:]*\):.*ascii.*\"[\$$]*\([-0-9\#]*\)\".*$$/#define \1 \2/' -e 'p' -e 's/#//2' -e 's/^[[:space:]]*#define \([A-Za-z0-9_]*\)[[:space:]]*[\$$#]*\([-0-9]*\).*$$/#define \1_NUM \2/' genassym.o > $@
184
185 ${SOBJS}: assym.s
186
187 %RULES
188
189 include $(MakeInc_rule)
190 include $(MakeInc_dir)