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%SFILES
69
70%MACHDEP
71
72#
73# Machine-independent per-file flags
74#
75
76dp_backing_file.o_CFLAGS_ADD	+= -Wshorten-64-to-32
77ubc_subr.o_CFLAGS_ADD			+= -Wshorten-64-to-32
78vnode_pager.o_CFLAGS_ADD		+= -Wshorten-64-to-32
79vm_unix.o_CFLAGS_ADD			+= -Wshorten-64-to-32
80pthread_synch.o_CFLAGS_ADD		+= -Wno-unused-parameter -Wno-missing-prototypes
81pthread_support.o_CFLAGS_ADD		+= -Wno-unused-parameter -Wno-missing-prototypes
82
83# Objects that don't want -Wsign-compare
84OBJS_NO_SIGN_COMPARE =		\
85		radix.o	\
86		route.o	\
87		rtsock.o	\
88		dhcp_options.o	\
89		igmp.o	\
90		in_cksum.o	\
91		ip_divert.o	\
92		ip_dummynet.o	\
93		ip_flow.o	\
94		ip_fw2.o	\
95		ip_fw2_compat.o	\
96		ip_icmp.o	\
97		ip_input.o	\
98		ip_mroute.o	\
99		ip_output.o	\
100		raw_ip.o	\
101		tcp_input.o	\
102		tcp_output.o	\
103		tcp_subr.o	\
104		tcp_usrreq.o	\
105		tcp_timer.o	\
106		udp_usrreq.o	\
107		ah_input.o	\
108		ah_core.o	\
109		ah_output.o	\
110		esp_core.o	\
111		esp_input.o	\
112		esp_output.o	\
113		esp_rijndael.o	\
114		ipsec.o	\
115		dest6.o	\
116		frag6.o	\
117		icmp6.o	\
118		in6.o	\
119		in6_src.o	\
120		in6_cksum.o	\
121		ip6_fw.o	\
122		ip6_forward.o	\
123		in6_ifattach.o	\
124		ip6_input.o	\
125		ip6_mroute.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		fips_sha1.o		\
170		hfs_attrlist.o		\
171		hfs_btreeio.o		\
172		hfs_catalog.o		\
173		hfs_cnode.o		\
174		hfs_endian.o		\
175		hfs_hotfiles.o		\
176		hfs_link.o		\
177		hfs_quota.o		\
178		hfs_readwrite.o		\
179		hfs_search.o		\
180		hfs_vfsops.o		\
181		hfs_vnops.o		\
182		hfs_xattr.o		\
183		if_bond.o		\
184		ip6_fw.o		\
185		ip_dummynet.o		\
186		ip_fw2.o		\
187		kern_credential.o	\
188		kern_descrip.o		\
189		kern_event.o		\
190		kern_exec.o		\
191		kern_lockf.o		\
192		kern_subr.o		\
193		km.o			\
194		lockstat.o		\
195		mach_loader.o		\
196		memdev.o		\
197		nfs4_subs.o		\
198		nfs4_vnops.o		\
199		nfs_boot.o		\
200		nfs_gss.o		\
201		nfs_serv.o		\
202		nfs_socket.o		\
203		nfs_srvcache.o		\
204		nfs_subs.o		\
205		nfs_syscalls.o		\
206		nfs_vfsops.o		\
207		nfs_vnops.o		\
208		proc_info.o		\
209		pthread_synch.o		\
210		qsort.o			\
211		randomdev.o		\
212		sdt.o			\
213                sha1mod.o               \
214		shadow.o		\
215		spec_vnops.o		\
216		subr_log.o		\
217		subr_prof.o		\
218		sys_generic.o		\
219		sys_pipe.o		\
220		systemcalls.o		\
221		systrace.o		\
222		tcp_lro.o		\
223		tty.o			\
224		tty_compat.o		\
225		tty_ptmx.o		\
226		tty_pty.o		\
227		ubc_subr.o		\
228		uipc_usrreq.o		\
229		vfs_attrlist.o		\
230		vfs_fsevents.o		\
231		vfs_journal.o		\
232		vfs_lookup.o		\
233		vfs_subr.o		\
234		vfs_syscalls.o		\
235		vfs_utfconv.o		\
236		vfs_vnops.o		\
237		vfs_xattr.o		\
238		vn.o			\
239		munge.o			\
240		aes.o			\
241		aeskey.o		\
242		sdt_arm.o
243
244$(foreach file,$(OBJS_NO_CAST_ALIGN),$(eval $(call add_perfile_cflags,$(file),-Wno-cast-align)))
245
246#
247# This rule insures that the subr_prof.c does NOT get compiled with
248# profiling. It implements mcount() and profiling it leads to recursion.
249#
250
251subr_prof.o_CFLAGS_RM = -pg
252
253#
254#  OBJSDEPS is the set of files (defined in the machine dependent
255#  template if necessary) which all objects depend on (such as an
256#  in-line assembler expansion filter)
257#
258${OBJS}: ${OBJSDEPS}
259
260LDOBJS = $(OBJS)
261
262$(COMPONENT).filelist: $(LDOBJS) 
263	@echo LDFILELIST $(COMPONENT)
264	$(_v)( for obj in ${LDOBJS}; do	\
265		 echo $(TARGET)/$(CURRENT_KERNEL_CONFIG)/$${obj}; \
266	done; ) > $(COMPONENT).filelist
267
268MAKESYSCALLS = $(SRCROOT)/bsd/kern/makesyscalls.sh
269
270init_sysent.c: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
271	@echo "Generating $@ from $<";
272	$(_v)$(MAKESYSCALLS) $< table > /dev/null
273
274syscalls.c: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
275	@echo "Generating $@ from $<";
276	$(_v)$(MAKESYSCALLS) $< names > /dev/null
277
278audit_kevents.c: $(SRCROOT)/bsd/kern/syscalls.master $(MAKESYSCALLS)
279	@echo "Generating $@ from $<";
280	$(_v)$(MAKESYSCALLS) $< audit > /dev/null
281
282do_all: $(COMPONENT).filelist
283
284do_build_all:: do_all
285
286%RULES
287
288include $(MakeInc_rule)
289include $(MakeInc_dir)
290