]> git.saurik.com Git - apple/xnu.git/blame - Makefile
xnu-2422.90.20.tar.gz
[apple/xnu.git] / Makefile
CommitLineData
39236c6e
A
1#
2# Copyright (C) 1999-2010 Apple Inc. All rights reserved.
3#
4
1c79356b 5ifndef VERSDIR
39236c6e 6export VERSDIR := $(shell /bin/pwd)
1c79356b 7endif
39236c6e 8
9bccf70c 9ifndef SRCROOT
39236c6e 10export SRCROOT := $(shell /bin/pwd)
9bccf70c
A
11endif
12ifndef OBJROOT
39236c6e 13export OBJROOT = $(SRCROOT)/BUILD/obj
9bccf70c
A
14endif
15ifndef DSTROOT
39236c6e 16export DSTROOT = $(SRCROOT)/BUILD/dst
9bccf70c
A
17endif
18ifndef SYMROOT
39236c6e 19export SYMROOT = $(SRCROOT)/BUILD/sym
9bccf70c 20endif
1c79356b 21
39236c6e
A
22export MakeInc_top=${VERSDIR}/makedefs/MakeInc.top
23export MakeInc_kernel=${VERSDIR}/makedefs/MakeInc.kernel
1c79356b
A
24export MakeInc_cmd=${VERSDIR}/makedefs/MakeInc.cmd
25export MakeInc_def=${VERSDIR}/makedefs/MakeInc.def
26export MakeInc_rule=${VERSDIR}/makedefs/MakeInc.rule
27export MakeInc_dir=${VERSDIR}/makedefs/MakeInc.dir
28
39236c6e
A
29#
30# Dispatch non-xnu build aliases to their own build
31# systems. All xnu variants start with MakeInc_top.
32#
33
34ifeq ($(findstring Libsyscall,$(RC_ProjectName)),Libsyscall)
35
36ifeq ($(RC_ProjectName),Libsyscall_headers_Sim)
37TARGET=-target Libsyscall_headers_Sim
38endif
39
40default: install
41
42installhdrs install:
43 cd libsyscall ; \
44 xcodebuild $@ $(TARGET) \
45 "SRCROOT=$(SRCROOT)/libsyscall" \
46 "OBJROOT=$(OBJROOT)" \
47 "SYMROOT=$(SYMROOT)" \
48 "DSTROOT=$(DSTROOT)" \
49 "SDKROOT=$(SDKROOT)"
50
51clean:
52
53installsrc:
54 pax -rw . $(SRCROOT)
55
56else ifeq ($(RC_ProjectName),libkxld)
57
58default: install
59
60installhdrs install clean:
61 $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all
62
63installsrc:
64 pax -rw . $(SRCROOT)
65
66else ifeq ($(RC_ProjectName),libkxld_host)
67
68default: install
69
70installhdrs install clean:
71 $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all PRODUCT_TYPE=ARCHIVE
72
73installsrc:
74 pax -rw . $(SRCROOT)
75
76else ifeq ($(RC_ProjectName),libkmod)
77
78default: install
79
80installhdrs install:
81 cd libkern/kmod ; \
82 xcodebuild $@ \
83 "SRCROOT=$(SRCROOT)/libkern/kmod" \
84 "OBJROOT=$(OBJROOT)" \
85 "SYMROOT=$(SYMROOT)" \
86 "DSTROOT=$(DSTROOT)" \
87 "SDKROOT=$(SDKROOT)"
88
89clean:
90
91installsrc:
92 pax -rw . $(SRCROOT)
93
94else ifeq ($(RC_ProjectName),xnu_quick_test)
95
96default: install
97
98installhdrs:
99
100install: xnu_quick_test
101
102clean:
103
104installsrc:
105 pax -rw . $(SRCROOT)
106
107else # all other RC_ProjectName
108
109ifndef CURRENT_BUILD_CONFIG
110
111# avoid having to include MakeInc.cmd
112ifeq ($(RC_XBS),YES)
113_v =
114else ifeq ($(VERBOSE),YES)
115_v =
116else
117_v = @
118endif
119
120#
121# Setup for parallel sub-makes based on 2 times number of logical CPUs.
122# If MAKEJOBS or -jN is passed on the make line, that takes precedence.
123#
124MAKEJOBS := --jobs=$(shell expr `/usr/sbin/sysctl -n hw.physicalcpu` \* 2)
125
126TOP_TARGETS = clean installsrc installhdrs installhdrs_embedded installman exporthdrs setup build all all_embedded install install_embedded installopensource cscope tags help print_exports print_exports_first_build_config
127
128.PHONY: $(TOP_TARGETS)
129
130default: all
131
132ifneq ($(REMOTEBUILD),)
133$(TOP_TARGETS):
134 $(_v)$(VERSDIR)/tools/remote_build.sh _REMOTEBUILD_TARGET=$@ _REMOTEBUILD_MAKE=$(MAKE) $(MAKEFLAGS)
135else
136$(TOP_TARGETS):
137 $(_v)$(MAKE) -r $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) -f $(MakeInc_top) $@
138endif
139
140else # CURRENT_BUILD_CONFIG
1c79356b
A
141
142include $(MakeInc_cmd)
143include $(MakeInc_def)
144
145ALL_SUBDIRS = \
39236c6e 146 bsd \
1c79356b
A
147 iokit \
148 osfmk \
1c79356b
A
149 pexpert \
150 libkern \
2d21ac55 151 libsa \
39236c6e
A
152 security \
153 config
1c79356b 154
39236c6e 155CONFIG_SUBDIRS = config tools
55e303ae 156
91447636 157INSTINC_SUBDIRS = $(ALL_SUBDIRS) EXTERNAL_HEADERS
6d2010ae
A
158INSTINC_SUBDIRS_X86_64 = $(INSTINC_SUBDIRS)
159INSTINC_SUBDIRS_ARM = $(INSTINC_SUBDIRS)
2d21ac55 160
1c79356b 161EXPINC_SUBDIRS = $(ALL_SUBDIRS)
b0d623f7 162EXPINC_SUBDIRS_X86_64 = $(EXPINC_SUBDIRS)
2d21ac55
A
163EXPINC_SUBDIRS_ARM = $(EXPINC_SUBDIRS)
164
6d2010ae 165SETUP_SUBDIRS = SETUP
b0d623f7 166
b0d623f7 167COMP_SUBDIRS_X86_64 = $(ALL_SUBDIRS)
b0d623f7 168COMP_SUBDIRS_ARM = $(ALL_SUBDIRS)
55e303ae 169
1c79356b 170INST_SUBDIRS = \
d7e50217 171 bsd \
39236c6e 172 config
1c79356b 173
9bccf70c
A
174INSTMAN_SUBDIRS = \
175 bsd
176
39236c6e 177include $(MakeInc_kernel)
1c79356b
A
178include $(MakeInc_rule)
179include $(MakeInc_dir)
6d2010ae 180
39236c6e
A
181endif # CURRENT_BUILD_CONFIG
182
183endif # all other RC_ProjectName
184
185# "xnu_quick_test" and "testbots" are targets that can be invoked via a standalone
186# "make xnu_quick_test" or via buildit/XBS with the RC_ProjectName=xnu_quick_test.
187# Define the target here in the outermost scope of the initial Makefile
188
189xnu_quick_test:
190 $(MAKE) -C $(SRCROOT)/tools/tests \
191 SRCROOT=$(SRCROOT)/tools/tests
192
6d2010ae
A
193# This target is defined to compile and run xnu_quick_test under testbots
194testbots:
39236c6e
A
195 $(MAKE) -C $(SRCROOT)/tools/tests/xnu_quick_test \
196 SRCROOT=$(SRCROOT)/tools/tests/xnu_quick_test \
197 MORECFLAGS="-DRUN_UNDER_TESTBOTS=1" \
198 MAKE=$(MAKE) \
199 testbots