1#
2# Copyright (c) 2000-2011 Apple Inc. All rights reserved.
3#
4# @APPLE_LICENSE_HEADER_START@
5# 
6# The contents of this file constitute Original Code as defined in and
7# are subject to the Apple Public Source License Version 1.1 (the
8# "License").  You may not use this file except in compliance with the
9# License.  Please obtain a copy of the License at
10# http://www.apple.com/publicsource and read it before using this file.
11# 
12# This Original Code and all software distributed under the License are
13# distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16# FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
17# License for the specific language governing rights and limitations
18# under the License.
19# 
20# @APPLE_LICENSE_HEADER_END@
21#
22
23#
24# Mach Operating System
25# Copyright (c) 1986 Carnegie-Mellon University
26# All rights reserved.  The CMU software License Agreement specifies
27# the terms and conditions for use and redistribution.
28#
29
30#
31# Export IDENT for sub-makefiles
32#
33export IDENT
34
35export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
36export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
37export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
38export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
39
40include $(MakeInc_cmd)
41include $(MakeInc_def)
42
43#
44# XXX: CFLAGS
45#
46CFLAGS+= -include meta_features.h -DARCH_PRIVATE -DDRIVER_PRIVATE \
47	-D_KERNEL_BUILD -DKERNEL_BUILD -DMACH_KERNEL -DBSD_BUILD \
48	-DBSD_KERNEL_PRIVATE -DLP64KERN=1 -DLP64_DEBUG=0  -I. $(CFLAGS_INLINE_CONFIG)
49
50dp_backing_file.o_CFLAGS_ADD	+= -Wshorten-64-to-32
51ubc_subr.o_CFLAGS_ADD			+= -Wshorten-64-to-32
52vnode_pager.o_CFLAGS_ADD		+= -Wshorten-64-to-32
53vm_unix.o_CFLAGS_ADD			+= -Wshorten-64-to-32
54
55# Objects that don't want -Wsign-compare
56OBJS_NO_SIGN_COMPARE =		\
57		radix.o	\
58		route.o	\
59		rtsock.o	\
60		dhcp_options.o	\
61		igmp.o	\
62		in_cksum.o	\
63		ip_divert.o	\
64		ip_dummynet.o	\
65		ip_flow.o	\
66		ip_fw2.o	\
67		ip_fw2_compat.o	\
68		ip_icmp.o	\
69		ip_input.o	\
70		ip_mroute.o	\
71		ip_output.o	\
72		raw_ip.o	\
73		tcp_input.o	\
74		tcp_output.o	\
75		tcp_subr.o	\
76		tcp_usrreq.o	\
77		tcp_timer.o	\
78		udp_usrreq.o	\
79		ah_input.o	\
80		ah_core.o	\
81		ah_output.o	\
82		esp_core.o	\
83		esp_input.o	\
84		esp_output.o	\
85		esp_rijndael.o	\
86		ipsec.o	\
87		dest6.o	\
88		frag6.o	\
89		icmp6.o	\
90		in6.o	\
91		in6_src.o	\
92		in6_cksum.o	\
93		ip6_fw.o	\
94		ip6_forward.o	\
95		in6_ifattach.o	\
96		ip6_input.o	\
97		ip6_mroute.o	\
98		ip6_output.o	\
99		ipcomp_input.o	\
100		ipcomp_output.o	\
101		in6_proto.o	\
102		mld6.o	\
103		nd6.o	\
104		nd6_nbr.o	\
105		nd6_prproxy.o	\
106		nd6_rtr.o	\
107		raw_ip6.o	\
108		route6.o	\
109		scope6.o	\
110		udp6_usrreq.o	\
111		key.o	\
112		keysock.o	\
113		keydb.o	\
114		des_setkey.o	\
115		uipc_mbuf.o	\
116		uipc_mbuf2.o	\
117		uipc_socket.o	\
118		uipc_socket2.o
119
120$(foreach file,$(OBJS_NO_SIGN_COMPARE),$(eval $(call add_perfile_cflags,$(file),-Wno-sign-compare)))
121
122# Objects that want -Wcast-align warning treated as error
123OBJS_ERROR_CAST_ALIGN =			\
124		kern_control.o		\
125		mcache.o		\
126		sys_socket.o		\
127		uipc_mbuf.o		\
128		uipc_mbuf2.o		\
129		uipc_socket.o		\
130		uipc_socket2.o		\
131		uipc_syscalls.o		\
132		bpf.o			\
133		bpf_filter.o		\
134		bridgestp.o		\
135		bsd_comp.o		\
136		devtimer.o		\
137		dlil.o			\
138		ether_if_module.o	\
139		ether_inet_pr_module.o	\
140		ether_inet6_pr_module.o	\
141		flowhash.o		\
142		if.o			\
143		if_bridge.o		\
144		if_gif.o		\
145		if_llreach.o		\
146		if_loop.o		\
147		if_media.o		\
148		if_mib.o		\
149		if_pflog.o		\
150		if_stf.o		\
151		if_utun.o		\
152		if_utun_crypto.o	\
153		if_utun_crypto_ipsec.o	\
154		if_vlan.o		\
155		init.o			\
156		iptap.o			\
157		kext_net.o		\
158		kpi_interface.o		\
159		kpi_interfacefilter.o	\
160		kpi_protocol.o		\
161		kpi_protocol.o		\
162		ndrv.o			\
163		net_osdep.o		\
164		net_str_id.o		\
165		netsrc.o		\
166		ntstat.o		\
167		pf.o			\
168		pf_if.o			\
169		pf_ioctl.o		\
170		pf_norm.o		\
171		pf_osfp.o		\
172		pf_ruleset.o		\
173		pf_table.o		\
174		ppp_deflate.o		\
175		radix.o			\
176		raw_cb.o		\
177		raw_usrreq.o		\
178		route.o			\
179		rtsock.o		\
180		dhcp_options.o		\
181		altq_cbq.o		\
182		altq_fairq.o		\
183		altq_hfsc.o		\
184		altq_priq.o		\
185		altq_qfq.o		\
186		altq_subr.o		\
187		pktsched.o		\
188		pktsched_cbq.o		\
189		pktsched_fairq.o	\
190		pktsched_hfsc.o		\
191		pktsched_priq.o		\
192		pktsched_qfq.o		\
193		pktsched_rmclass.o	\
194		pktsched_tcq.o		\
195		classq.o		\
196		classq_blue.o		\
197		classq_red.o		\
198		classq_rio.o		\
199		classq_sfb.o		\
200		classq_subr.o		\
201		classq_util.o		\
202		igmp.o			\
203		in.o			\
204		in_arp.o		\
205		in_cksum.o		\
206		in_dhcp.o		\
207		in_gif.o		\
208		in_mcast.o		\
209		in_pcb.o		\
210		in_pcblist.o		\
211		in_proto.o		\
212		in_rmx.o		\
213		in_tclass.o		\
214		ip_divert.o		\
215		ip_ecn.o		\
216		ip_encap.o		\
217		ip_icmp.o		\
218		ip_id.o			\
219		ip_input.o		\
220		ip_mroute.o		\
221		ip_output.o		\
222		kpi_ipfilter.o		\
223		raw_ip.o		\
224		tcp_debug.o		\
225		tcp_input.o		\
226		tcp_ledbat.o		\
227		tcp_newreno.o		\
228		tcp_output.o		\
229		tcp_sack.o		\
230		tcp_subr.o		\
231		tcp_timer.o		\
232		tcp_usrreq.o		\
233		udp_usrreq.o		\
234		ah_core.o		\
235		ah_input.o		\
236		ah_output.o		\
237		dest6.o			\
238		esp_core.o		\
239		esp_input.o		\
240		esp_output.o		\
241		esp_rijndael.o		\
242		frag6.o			\
243		icmp6.o			\
244		in6.o			\
245		in6_cksum.o		\
246		in6_gif.o		\
247		in6_ifattach.o		\
248		in6_mcast.o		\
249		in6_pcb.o		\
250		in6_prefix.o		\
251		in6_proto.o		\
252		in6_rmx.o		\
253		in6_src.o		\
254		ip6_forward.o		\
255		ip6_id.o		\
256		ip6_input.o		\
257		ip6_mroute.o		\
258		ip6_output.o		\
259		ipcomp_core.o		\
260		ipcomp_input.o		\
261		ipcomp_output.o		\
262		ipsec.o			\
263		mld6.o			\
264		nd6.o			\
265		nd6_nbr.o		\
266		nd6_rtr.o		\
267		raw_ip6.o		\
268		route6.o		\
269		scope6.o		\
270		udp6_output.o		\
271		udp6_usrreq.o		\
272		key.o			\
273		key_debug.o		\
274		keydb.o			\
275		keysock.o
276
277$(foreach file,$(OBJS_ERROR_CAST_ALIGN),$(eval $(call add_perfile_cflags,$(file),-Werror=cast-align)))
278
279#
280# Directories for mig generated files
281#
282COMP_SUBDIRS = 
283
284#
285#  Make sure we don't remove this by accident if interrupted at the wrong
286#  time.
287#
288.PRECIOUS: Makefile
289
290#
291#  Theses macros are filled in by the config program depending on the
292#  current configuration.  The MACHDEP macro is replaced by the
293#  contents of the machine dependent makefile template and the others
294#  are replaced by the corresponding symbol definitions for the
295#  configuration.
296#
297
298%OBJS
299
300%CFILES
301
302%MFILES
303
304%SFILES
305
306%BFILES
307
308%ORDERED
309%MACHDEP
310
311#
312# This rule insures that the subr_prof.c does NOT get compiled with
313# profiling. It implements mcount() and profiling it leads to recursion.
314#
315
316subr_prof.o_CFLAGS_RM = -pg
317
318#
319#  OBJSDEPS is the set of files (defined in the machine dependent
320#  template if necessary) which all objects depend on (such as an
321#  in-line assembler expansion filter)
322#
323${OBJS}: ${OBJSDEPS}
324
325
326%LOAD
327
328LDOBJS = $(OBJS)
329
330$(COMPONENT).filelist: $(LDOBJS)
331	@echo LDFILELIST $(COMPONENT)
332	$(_v)( for obj in ${LDOBJS}; do	\
333		 echo $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$${obj}; \
334	done; ) > $(COMPONENT).filelist
335
336MAKESYSCALLS = $(SRCROOT)/bsd/kern/makesyscalls.sh
337
338init_sysent.c: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
339	@echo "Generating $@ from $<";
340	$(_v)$(MAKESYSCALLS) $< table > /dev/null
341
342syscalls.c: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
343	@echo "Generating $@ from $<";
344	$(_v)$(MAKESYSCALLS) $< names > /dev/null
345
346audit_kevents.c: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
347	@echo "Generating $@ from $<";
348	$(_v)$(MAKESYSCALLS) $< audit > /dev/null
349
350do_depend: do_all
351	$(_v)${MD} -u Makedep -f -d `ls *.d`;
352
353do_all: $(COMPONENT).filelist
354
355do_build_all: do_depend
356
357%RULES
358
359include $(MakeInc_rule)
360include $(MakeInc_dir)
361