]>
Commit | Line | Data |
---|---|---|
39236c6e A |
1 | # |
2 | # Copyright (C) 1999-2010 Apple Inc. All rights reserved. | |
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 | ||
58 | default: install | |
59 | ||
60 | installhdrs install clean: | |
61 | $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all | |
62 | ||
63 | installsrc: | |
64 | pax -rw . $(SRCROOT) | |
65 | ||
66 | else ifeq ($(RC_ProjectName),libkxld_host) | |
67 | ||
68 | default: install | |
69 | ||
70 | installhdrs install clean: | |
71 | $(MAKE) -C libkern/kxld $@ USE_APPLE_PB_SUPPORT=all PRODUCT_TYPE=ARCHIVE | |
72 | ||
73 | installsrc: | |
74 | pax -rw . $(SRCROOT) | |
75 | ||
76 | else ifeq ($(RC_ProjectName),libkmod) | |
77 | ||
78 | default: install | |
79 | ||
80 | installhdrs 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 | ||
89 | clean: | |
90 | ||
91 | installsrc: | |
92 | pax -rw . $(SRCROOT) | |
93 | ||
94 | else ifeq ($(RC_ProjectName),xnu_quick_test) | |
95 | ||
96 | default: install | |
97 | ||
98 | installhdrs: | |
99 | ||
100 | install: xnu_quick_test | |
101 | ||
102 | clean: | |
103 | ||
104 | installsrc: | |
105 | pax -rw . $(SRCROOT) | |
106 | ||
107 | else # all other RC_ProjectName | |
108 | ||
109 | ifndef CURRENT_BUILD_CONFIG | |
110 | ||
111 | # avoid having to include MakeInc.cmd | |
112 | ifeq ($(RC_XBS),YES) | |
113 | _v = | |
114 | else ifeq ($(VERBOSE),YES) | |
115 | _v = | |
116 | else | |
117 | _v = @ | |
118 | endif | |
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 | # | |
124 | MAKEJOBS := --jobs=$(shell expr `/usr/sbin/sysctl -n hw.physicalcpu` \* 2) | |
125 | ||
126 | TOP_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 | ||
130 | default: all | |
131 | ||
132 | ifneq ($(REMOTEBUILD),) | |
133 | $(TOP_TARGETS): | |
134 | $(_v)$(VERSDIR)/tools/remote_build.sh _REMOTEBUILD_TARGET=$@ _REMOTEBUILD_MAKE=$(MAKE) $(MAKEFLAGS) | |
135 | else | |
136 | $(TOP_TARGETS): | |
137 | $(_v)$(MAKE) -r $(if $(filter -j,$(MAKEFLAGS)),,$(MAKEJOBS)) -f $(MakeInc_top) $@ | |
138 | endif | |
139 | ||
140 | else # CURRENT_BUILD_CONFIG | |
1c79356b A |
141 | |
142 | include $(MakeInc_cmd) | |
143 | include $(MakeInc_def) | |
144 | ||
145 | ALL_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 | 155 | CONFIG_SUBDIRS = config tools |
55e303ae | 156 | |
91447636 | 157 | INSTINC_SUBDIRS = $(ALL_SUBDIRS) EXTERNAL_HEADERS |
6d2010ae A |
158 | INSTINC_SUBDIRS_X86_64 = $(INSTINC_SUBDIRS) |
159 | INSTINC_SUBDIRS_ARM = $(INSTINC_SUBDIRS) | |
2d21ac55 | 160 | |
1c79356b | 161 | EXPINC_SUBDIRS = $(ALL_SUBDIRS) |
b0d623f7 | 162 | EXPINC_SUBDIRS_X86_64 = $(EXPINC_SUBDIRS) |
2d21ac55 A |
163 | EXPINC_SUBDIRS_ARM = $(EXPINC_SUBDIRS) |
164 | ||
6d2010ae | 165 | SETUP_SUBDIRS = SETUP |
b0d623f7 | 166 | |
b0d623f7 | 167 | COMP_SUBDIRS_X86_64 = $(ALL_SUBDIRS) |
b0d623f7 | 168 | COMP_SUBDIRS_ARM = $(ALL_SUBDIRS) |
55e303ae | 169 | |
1c79356b | 170 | INST_SUBDIRS = \ |
d7e50217 | 171 | bsd \ |
39236c6e | 172 | config |
1c79356b | 173 | |
9bccf70c A |
174 | INSTMAN_SUBDIRS = \ |
175 | bsd | |
176 | ||
39236c6e | 177 | include $(MakeInc_kernel) |
1c79356b A |
178 | include $(MakeInc_rule) |
179 | include $(MakeInc_dir) | |
6d2010ae | 180 | |
39236c6e A |
181 | endif # CURRENT_BUILD_CONFIG |
182 | ||
183 | endif # 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 | ||
189 | xnu_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 |
194 | testbots: | |
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 |