]> git.saurik.com Git - apple/xnu.git/blame - tools/tests/personas/Makefile
xnu-4903.221.2.tar.gz
[apple/xnu.git] / tools / tests / personas / Makefile
CommitLineData
490019cf
A
1include ../Makefile.common
2
3CC:=$(shell xcrun -sdk "$(SDKROOT)" -find cc)
4
5SYMROOT?=$(shell /bin/pwd)
6
7CFLAGS := -g -O2 -isysroot $(SDKROOT) -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
8
9ifdef RC_ARCHS
10 ARCHS:=$(RC_ARCHS)
11 else
12 ifeq "$(Embedded)" "YES"
13 ARCHS:=armv7 armv7s arm64
14 else
15 ARCHS:=x86_64 i386
16 endif
17endif
18
d9a64523
A
19# These are convenience functions for filtering based on substrings, as the
20# normal filter functions only accept one wildcard.
21FILTER_OUT_SUBSTRING=$(strip $(foreach string,$(2),$(if $(findstring $(1),$(string)),,$(string))))
22FILTER_SUBSTRING=$(strip $(foreach string,$(2),$(if $(findstring $(1),$(string)),$(string),)))
23
24ARCH_32:=$(call FILTER_OUT_SUBSTRING,64,$(ARCHS))
25ARCH_64:=$(call FILTER_SUBSTRING,64,$(ARCHS))
490019cf
A
26
27ARCH_32_FLAGS := $(patsubst %, -arch %, $(ARCH_32))
28ARCH_64_FLAGS := $(patsubst %, -arch %, $(ARCH_64))
29ARCH_FLAGS := $(if $(ARCH_64), $(ARCH_64_FLAGS)) $(if $(ARCH_32), $(ARCH_32_FLAGS))
30
31DSTROOT?=$(shell /bin/pwd)
32
d9a64523 33TARGETS := persona_mgr persona_spawn persona_test_run.sh
490019cf
A
34
35all: $(addprefix $(DSTROOT)/, $(TARGETS))
36
37$(DSTROOT)/persona_%: persona_%.c persona_test.h Makefile
38 ${CC} ${CFLAGS} ${ARCH_FLAGS} -o $(SYMROOT)/$(notdir $@) $<
39 if [ ! -e $@ ]; then ditto $(SYMROOT)/$(notdir $@) $@; fi
40
d9a64523
A
41$(DSTROOT)/persona_test_run.sh: persona_test_run.sh
42 cp $? $@
43 chmod +x $@
44
490019cf
A
45clean:
46 rm -rf $(addprefix $(DSTROOT)/,$(TARGETS)) $(addprefix $(SYMROOT)/,$(TARGETS)) $(SYMROOT)/*.dSYM