]>
Commit | Line | Data |
---|---|---|
39236c6e | 1 | # |
fe8ab488 | 2 | # Copyright (C) 1999-2013 Apple Inc. All rights reserved. |
39236c6e A |
3 | # |
4 | ||
1c79356b | 5 | ifndef VERSDIR |
39236c6e | 6 | export VERSDIR := $(shell /bin/pwd) |
1c79356b | 7 | endif |
39236c6e | 8 | |
9bccf70c | 9 | ifndef SRCROOT |
39236c6e | 10 | export SRCROOT := $(shell /bin/pwd) |
9bccf70c A |
11 | endif |
12 | ifndef OBJROOT | |
39236c6e | 13 | export OBJROOT = $(SRCROOT)/BUILD/obj |
9bccf70c A |
14 | endif |
15 | ifndef DSTROOT | |
39236c6e | 16 | export DSTROOT = $(SRCROOT)/BUILD/dst |
9bccf70c A |
17 | endif |
18 | ifndef SYMROOT | |
39236c6e | 19 | export SYMROOT = $(SRCROOT)/BUILD/sym |
9bccf70c | 20 | endif |
1c79356b | 21 | |
39236c6e A |
22 | export MakeInc_top=${VERSDIR}/makedefs/MakeInc.top |
23 | export MakeInc_kernel=${VERSDIR}/makedefs/MakeInc.kernel | |
1c79356b A |
24 | export MakeInc_cmd=${VERSDIR}/makedefs/MakeInc.cmd |
25 | export MakeInc_def=${VERSDIR}/makedefs/MakeInc.def | |
26 | export MakeInc_rule=${VERSDIR}/makedefs/MakeInc.rule | |
27 | export 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 | ||
34 | ifeq ($(findstring Libsyscall,$(RC_ProjectName)),Libsyscall) | |
35 | ||
36 | ifeq ($(RC_ProjectName),Libsyscall_headers_Sim) | |
37 | TARGET=-target Libsyscall_headers_Sim | |
38 | endif | |
39 | ||
40 | default: install | |
41 | ||
42 | installhdrs install: | |
43 | cd libsyscall ; \ | |
44 | xcodebuild $@ $(TARGET) \ | |
45 | "SRCROOT=$(SRCROOT)/libsyscall" \ | |
46 | "OBJROOT=$(OBJROOT)" \ | |
47 | "SYMROOT=$(SYMROOT)" \ | |
48 | "DSTROOT=$(DSTROOT)" \ | |
49 | "SDKROOT=$(SDKROOT)" | |
50 | ||
51 | clean: | |
52 | ||
53 | installsrc: | |
54 | pax -rw . $(SRCROOT) | |
55 | ||
56 | else ifeq ($(RC_ProjectName),libkxld) | |
57 | ||
fe8ab488 A |
58 | include $(MakeInc_cmd) |
59 | ||
39236c6e A |
60 | default: install |
61 | ||
62 | installhdrs install clean: | |
63 | $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all | |
64 | ||
65 | installsrc: | |
fe8ab488 A |
66 | $(_v)$(MKDIR) $(SRCROOT) |
67 | $(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT) | |
68 | $(_v)$(CHMOD) -R go+rX $(SRCROOT) | |
39236c6e A |
69 | |
70 | else ifeq ($(RC_ProjectName),libkxld_host) | |
71 | ||
fe8ab488 A |
72 | include $(MakeInc_cmd) |
73 | ||
39236c6e A |
74 | default: install |
75 | ||
76 | installhdrs install clean: | |
77 | $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all PRODUCT_TYPE=ARCHIVE | |
78 | ||
79 | installsrc: | |
fe8ab488 A |
80 | $(_v)$(MKDIR) $(SRCROOT) |
81 | $(_v)$(FIND) -x . \! \( \( -name BUILD -o -name .svn -o -name .git -o -name cscope.\* -o -name \*~ \) -prune \) -print0 | $(PAX) -rw -p a -d0 $(SRCROOT) | |
82 | $(_v)$(CHMOD) -R go+rX $(SRCROOT) | |
39236c6e A |
83 | |
84 | else ifeq ($(RC_ProjectName),libkmod) | |
85 | ||
86 | default: install | |
87 | ||
88 | installhdrs install: | |
89 | cd libkern/kmod ; \ | |
90 | xcodebuild $@ \ | |
91 | "SRCROOT=$(SRCROOT)/libkern/kmod" \ | |
92 | "OBJROOT=$(OBJROOT)" \ | |
93 | "SYMROOT=$(SYMROOT)" \ | |
94 | "DSTROOT=$(DSTROOT)" \ | |
95 | "SDKROOT=$(SDKROOT)" | |
96 | ||
97 | clean: | |
98 | ||
99 | installsrc: | |
100 | pax -rw . $(SRCROOT) | |
101 | ||
102 | else ifeq ($(RC_ProjectName),xnu_quick_test) | |
103 | ||
104 | default: install | |
105 | ||
106 | installhdrs: | |
107 | ||
108 | install: xnu_quick_test | |
109 | ||
110 | clean: | |
111 | ||
112 | installsrc: | |
113 | pax -rw . $(SRCROOT) | |
114 | ||
115 | else # all other RC_ProjectName | |
116 | ||
117 | ifndef CURRENT_BUILD_CONFIG | |
118 | ||
119 | # avoid having to include MakeInc.cmd | |
120 | ifeq ($(RC_XBS),YES) | |
121 | _v = | |
122 | else ifeq ($(VERBOSE),YES) | |
123 | _v = | |
124 | else | |
125 | _v = @ | |
126 | endif | |
127 | ||
128 | # | |
fe8ab488 A |
129 | # Setup for parallel sub-makes, taking into account physical and logical |
130 | # CPUs. If the system does not support SMT, use N+1. | |
39236c6e A |
131 | # If MAKEJOBS or -jN is passed on the make line, that takes precedence. |
132 | # | |
fe8ab488 A |
133 | export SYSCTL_HW_PHYSICALCPU := $(shell /usr/sbin/sysctl -n hw.physicalcpu) |
134 | export SYSCTL_HW_LOGICALCPU := $(shell /usr/sbin/sysctl -n hw.logicalcpu) | |
135 | ifeq ($(SYSCTL_HW_PHYSICALCPU),$(SYSCTL_HW_LOGICALCPU)) | |
136 | MAKEJOBS := --jobs=$(shell expr $(SYSCTL_HW_PHYSICALCPU) + 1) | |
137 | else | |
138 | MAKEJOBS := --jobs=$(SYSCTL_HW_LOGICALCPU) | |
139 | endif | |
39236c6e | 140 | |
fe8ab488 A |
141 | TOP_TARGETS = \ |
142 | clean \ | |
143 | installsrc \ | |
144 | exporthdrs \ | |
145 | all all_desktop all_embedded \ | |
146 | all_release_embedded all_development_embedded \ | |
147 | installhdrs installhdrs_desktop installhdrs_embedded \ | |
148 | installhdrs_release_embedded installhdrs_development_embedded \ | |
149 | install install_desktop install_embedded \ | |
150 | install_release_embedded install_development_embedded \ | |
151 | installopensource \ | |
152 | cscope tags \ | |
153 | help | |
154 | ||
155 | # Targets for internal build system debugging | |
156 | TOP_TARGETS += \ | |
157 | print_exports print_exports_first_build_config \ | |
158 | setup \ | |
159 | build \ | |
160 | config \ | |
161 | install_textfiles \ | |
162 | install_config | |
39236c6e A |
163 | |
164 | .PHONY: $(TOP_TARGETS) | |
165 | ||
166 | default: all | |
167 | ||
168 | ifneq ($(REMOTEBUILD),) | |
169 | $(TOP_TARGETS): | |
fe8ab488 | 170 | $(_v)$(VERSDIR)/tools/remote_build.sh _REMOTEBUILD_TARGET=$@ _REMOTEBUILD_MAKE=$(MAKE) $(if $(filter --,$(MAKEFLAGS)),-,)$(MAKEFLAGS) |
39236c6e A |
171 | else |
172 | $(TOP_TARGETS): | |
173 | $(_v)$(MAKE) -r $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) -f $(MakeInc_top) $@ | |
174 | endif | |
175 | ||
176 | else # CURRENT_BUILD_CONFIG | |
1c79356b A |
177 | |
178 | include $(MakeInc_cmd) | |
179 | include $(MakeInc_def) | |
180 | ||
181 | ALL_SUBDIRS = \ | |
39236c6e | 182 | bsd \ |
1c79356b A |
183 | iokit \ |
184 | osfmk \ | |
1c79356b A |
185 | pexpert \ |
186 | libkern \ | |
2d21ac55 | 187 | libsa \ |
39236c6e A |
188 | security \ |
189 | config | |
1c79356b | 190 | |
39236c6e | 191 | CONFIG_SUBDIRS = config tools |
55e303ae | 192 | |
91447636 | 193 | INSTINC_SUBDIRS = $(ALL_SUBDIRS) EXTERNAL_HEADERS |
6d2010ae | 194 | INSTINC_SUBDIRS_X86_64 = $(INSTINC_SUBDIRS) |
fe8ab488 | 195 | INSTINC_SUBDIRS_X86_64H = $(INSTINC_SUBDIRS) |
6d2010ae | 196 | INSTINC_SUBDIRS_ARM = $(INSTINC_SUBDIRS) |
2d21ac55 | 197 | |
1c79356b | 198 | EXPINC_SUBDIRS = $(ALL_SUBDIRS) |
b0d623f7 | 199 | EXPINC_SUBDIRS_X86_64 = $(EXPINC_SUBDIRS) |
fe8ab488 | 200 | EXPINC_SUBDIRS_X86_64H = $(EXPINC_SUBDIRS) |
2d21ac55 A |
201 | EXPINC_SUBDIRS_ARM = $(EXPINC_SUBDIRS) |
202 | ||
6d2010ae | 203 | SETUP_SUBDIRS = SETUP |
b0d623f7 | 204 | |
b0d623f7 | 205 | COMP_SUBDIRS_X86_64 = $(ALL_SUBDIRS) |
fe8ab488 | 206 | COMP_SUBDIRS_X86_64H = $(ALL_SUBDIRS) |
b0d623f7 | 207 | COMP_SUBDIRS_ARM = $(ALL_SUBDIRS) |
55e303ae | 208 | |
fe8ab488 | 209 | INSTTEXTFILES_SUBDIRS = \ |
9bccf70c A |
210 | bsd |
211 | ||
39236c6e | 212 | include $(MakeInc_kernel) |
1c79356b A |
213 | include $(MakeInc_rule) |
214 | include $(MakeInc_dir) | |
6d2010ae | 215 | |
39236c6e A |
216 | endif # CURRENT_BUILD_CONFIG |
217 | ||
218 | endif # all other RC_ProjectName | |
219 | ||
220 | # "xnu_quick_test" and "testbots" are targets that can be invoked via a standalone | |
221 | # "make xnu_quick_test" or via buildit/XBS with the RC_ProjectName=xnu_quick_test. | |
222 | # Define the target here in the outermost scope of the initial Makefile | |
223 | ||
224 | xnu_quick_test: | |
225 | $(MAKE) -C $(SRCROOT)/tools/tests \ | |
226 | SRCROOT=$(SRCROOT)/tools/tests | |
227 | ||
6d2010ae A |
228 | # This target is defined to compile and run xnu_quick_test under testbots |
229 | testbots: | |
39236c6e A |
230 | $(MAKE) -C $(SRCROOT)/tools/tests/xnu_quick_test \ |
231 | SRCROOT=$(SRCROOT)/tools/tests/xnu_quick_test \ | |
232 | MORECFLAGS="-DRUN_UNDER_TESTBOTS=1" \ | |
233 | MAKE=$(MAKE) \ | |
234 | testbots |