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
30export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
31export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
32export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
33export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
34
35include $(MakeInc_cmd)
36include $(MakeInc_def)
37
38#
39# XXX: CFLAGS
40#
41CFLAGS+= -include meta_features.h -DDRIVER_PRIVATE \
42	-D_KERNEL_BUILD -DKERNEL_BUILD -DMACH_KERNEL -DBSD_BUILD \
43	-DBSD_KERNEL_PRIVATE -DLP64_DEBUG=0
44
45#
46# Directories for mig generated files
47#
48COMP_SUBDIRS = 
49
50#
51#  Make sure we don't remove this by accident if interrupted at the wrong
52#  time.
53#
54.PRECIOUS: Makefile
55
56#
57#  Theses macros are filled in by the config program depending on the
58#  current configuration.  The MACHDEP macro is replaced by the
59#  contents of the machine dependent makefile template and the others
60#  are replaced by the corresponding symbol definitions for the
61#  configuration.
62#
63
64%OBJS
65
66%CFILES
67
68%CXXFILES
69
70%SFILES
71
72%MACHDEP
73
74#
75# Machine-independent per-file flags
76#
77
78dp_backing_file.o_CFLAGS_ADD	+= -Wshorten-64-to-32
79ubc_subr.o_CFLAGS_ADD			+= -Wshorten-64-to-32
80vnode_pager.o_CFLAGS_ADD		+= -Wshorten-64-to-32
81vm_unix.o_CFLAGS_ADD			+= -Wshorten-64-to-32
82pthread_synch.o_CFLAGS_ADD		+= -Wno-unused-parameter -Wno-missing-prototypes
83pthread_support.o_CFLAGS_ADD		+= -Wno-unused-parameter -Wno-missing-prototypes
84
85# Objects that don't want -Wsign-compare
86OBJS_NO_SIGN_COMPARE =		\
87		radix.o	\
88		route.o	\
89		rtsock.o	\
90		dhcp_options.o	\
91		igmp.o	\
92		in_cksum.o	\
93		ip_divert.o	\
94		ip_dummynet.o	\
95		ip_flow.o	\
96		ip_fw2.o	\
97		ip_fw2_compat.o	\
98		ip_icmp.o	\
99		ip_input.o	\
100		ip_output.o	\
101		raw_ip.o	\
102		tcp_input.o	\
103		tcp_output.o	\
104		tcp_subr.o	\
105		tcp_usrreq.o	\
106		tcp_timer.o	\
107		udp_usrreq.o	\
108		ah_input.o	\
109		ah_core.o	\
110		ah_output.o	\
111		esp_core.o	\
112		esp_input.o	\
113		esp_output.o	\
114		esp_rijndael.o	\
115		ipsec.o	\
116		dest6.o	\
117		frag6.o	\
118		icmp6.o	\
119		in6.o	\
120		in6_src.o	\
121		in6_cksum.o	\
122		ip6_fw.o	\
123		ip6_forward.o	\
124		in6_ifattach.o	\
125		ip6_input.o	\
126		ip6_output.o	\
127		ipcomp_input.o	\
128		ipcomp_output.o	\
129		in6_proto.o	\
130		mld6.o	\
131		nd6.o	\
132		nd6_nbr.o	\
133		nd6_prproxy.o	\
134		nd6_rtr.o	\
135		raw_ip6.o	\
136		route6.o	\
137		scope6.o	\
138		udp6_usrreq.o	\
139		key.o	\
140		keysock.o	\
141		keydb.o	\
142		des_setkey.o	\
143		uipc_mbuf.o	\
144		uipc_mbuf2.o	\
145		uipc_socket.o	\
146		uipc_socket2.o
147
148$(foreach file,$(OBJS_NO_SIGN_COMPARE),$(eval $(call add_perfile_cflags,$(file),-Wno-sign-compare)))
149
150# Objects that don't want -Wcast-align warning (8474835)
151OBJS_NO_CAST_ALIGN =			\
152		BTree.o			\
153		BTreeAllocate.o		\
154		BTreeMiscOps.o		\
155		BTreeNodeOps.o		\
156		BTreeScanner.o		\
157		BTreeTreeOps.o		\
158		CatalogUtilities.o	\
159		audit_bsm_token.o	\
160		audit_pipe.o		\
161		audit_session.o		\
162		bsd_i386.o		\
163		decmpfs.o		\
164		dtrace.o		\
165		fasttrap.o		\
166		fasttrap_isa.o		\
167		fbt_arm.o		\
168		fbt_x86.o		\
169		hfs_attrlist.o		\
170		hfs_btreeio.o		\
171		hfs_catalog.o		\
172		hfs_cnode.o		\
173		hfs_endian.o		\
174		hfs_hotfiles.o		\
175		hfs_link.o		\
176		hfs_quota.o		\
177		hfs_readwrite.o		\
178		hfs_search.o		\
179		hfs_vfsops.o		\
180		hfs_vnops.o		\
181		hfs_xattr.o		\
182		if_bond.o		\
183		ip6_fw.o		\
184		ip_dummynet.o		\
185		ip_fw2.o		\
186		kern_credential.o	\
187		kern_descrip.o		\
188		kern_event.o		\
189		kern_exec.o		\
190		kern_lockf.o		\
191		kern_subr.o		\
192		km.o			\
193		lockstat.o		\
194		mach_loader.o		\
195		memdev.o		\
196		nfs4_subs.o		\
197		nfs4_vnops.o		\
198		nfs_boot.o		\
199		nfs_gss.o		\
200		nfs_serv.o		\
201		nfs_socket.o		\
202		nfs_srvcache.o		\
203		nfs_subs.o		\
204		nfs_syscalls.o		\
205		nfs_vfsops.o		\
206		nfs_vnops.o		\
207		proc_info.o		\
208		pthread_synch.o		\
209		qsort.o			\
210		sdt.o			\
211		shadow.o		\
212		spec_vnops.o		\
213		subr_log.o		\
214		subr_prof.o		\
215		sys_generic.o		\
216		sys_pipe.o		\
217		systemcalls.o		\
218		systrace.o		\
219		tcp_lro.o		\
220		tty.o			\
221		tty_compat.o		\
222		tty_dev.o		\
223		tty_ptmx.o		\
224		tty_pty.o		\
225		ubc_subr.o		\
226		uipc_usrreq.o		\
227		vfs_attrlist.o		\
228		vfs_fsevents.o		\
229		vfs_journal.o		\
230		vfs_lookup.o		\
231		vfs_syscalls.o		\
232		vfs_utfconv.o		\
233		vfs_vnops.o		\
234		vfs_xattr.o		\
235		vn.o			\
236		munge.o			\
237		aes.o			\
238		aeskey.o		\
239		sdt_arm.o
240
241$(foreach file,$(OBJS_NO_CAST_ALIGN),$(eval $(call add_perfile_cflags,$(file),-Wno-cast-align)))
242
243#
244# This rule insures that the subr_prof.c does NOT get compiled with
245# profiling. It implements mcount() and profiling it leads to recursion.
246#
247
248subr_prof.o_CFLAGS_RM = -pg
249
250# Rebuild if per-file overrides change
251${OBJS}: $(firstword $(MAKEFILE_LIST))
252
253# Rebuild if global compile flags change
254$(COBJS): .CFLAGS
255.CFLAGS: ALWAYS
256	$(_v)$(REPLACECONTENTS) $@ $(KCC) $(CFLAGS) $(INCFLAGS)
257$(CXXOBJS): .CXXFLAGS
258.CXXFLAGS: ALWAYS
259	$(_v)$(REPLACECONTENTS) $@ $(KC++) $(CXXFLAGS) $(INCFLAGS)
260$(SOBJS): .SFLAGS
261.SFLAGS: ALWAYS
262	$(_v)$(REPLACECONTENTS) $@ $(S_KCC) $(SFLAGS) $(INCFLAGS)
263
264$(COMPONENT).filelist: $(OBJS) 
265	@echo LDFILELIST $(COMPONENT)
266	$(_v)( for obj in ${OBJS}; do	\
267		 echo $(TARGET)/$(CURRENT_KERNEL_CONFIG)/$${obj}; \
268	done; ) > $(COMPONENT).filelist
269
270MAKESYSCALLS = $(SRCROOT)/bsd/kern/makesyscalls.sh
271
272init_sysent.c: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
273	@echo "Generating $@ from $<";
274	$(_v)$(MAKESYSCALLS) $< table > /dev/null
275
276syscalls.c: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
277	@echo "Generating $@ from $<";
278	$(_v)$(MAKESYSCALLS) $< names > /dev/null
279
280audit_kevents.c: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
281	@echo "Generating $@ from $<";
282	$(_v)$(MAKESYSCALLS) $< audit > /dev/null
283
284do_all: $(COMPONENT).filelist
285
286do_build_all:: do_all
287
288%RULES
289
290include $(MakeInc_rule)
291include $(MakeInc_dir)
292