]> git.saurik.com Git - apple/xnu.git/blob - tools/tests/personas/Makefile
14211dc70f24cd35ecf41a167f9313d5e101dbd1
[apple/xnu.git] / tools / tests / personas / Makefile
1 include ../Makefile.common
2
3 CC:=$(shell xcrun -sdk "$(SDKROOT)" -find cc)
4 CODESIGN:=$(shell xcrun -sdk "$(SDKROOT)" -find codesign)
5 CODESIGN_ALLOCATE:=$(shell xcrun -sdk "$(SDKROOT)" -find codesign_allocate)
6
7 SYMROOT?=$(shell /bin/pwd)
8
9 CFLAGS := -g -O2 -isysroot $(SDKROOT) -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
10 CFLAGS += -Wl,-sectcreate,__INFO_FILTER,__disable,/dev/null
11
12 # $(ARCH_CONFIGS) is set my Makefile.common
13 ARCH_FLAGS := $(if $(ARCH_CONFIGS_64), $(ARCH_FLAGS_64)) $(if $(ARCH_CONFIGS_32), $(ARCH_FLAGS_32))
14
15 DSTROOT?=$(shell /bin/pwd)
16
17 TARGETS := persona_mgr persona_spawn persona_test_run.sh persona_spawn_unentitled
18
19 all: $(addprefix $(DSTROOT)/, $(TARGETS))
20
21 $(DSTROOT)/persona_%: persona_%.c persona_test.h Makefile persona-entitlements.plist
22 ${CC} ${CFLAGS} ${ARCH_FLAGS} -o $(SYMROOT)/$(notdir $@) $<
23 env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) \
24 $(CODESIGN) -s - --entitlements persona-entitlements.plist $(SYMROOT)/$(notdir $@)
25 if [ ! -e $@ ]; then ditto $(SYMROOT)/$(notdir $@) $@; fi
26
27 $(DSTROOT)/persona_spawn_unentitled: persona_spawn.c persona_test.h Makefile
28 ${CC} ${CFLAGS} ${ARCH_FLAGS} -o $(SYMROOT)/$(notdir $@) $<
29 if [ ! -e $@ ]; then ditto $(SYMROOT)/$(notdir $@) $@; fi
30
31 $(DSTROOT)/persona_test_run.sh: persona_test_run_src.sh
32 cp $? $@
33 chmod +x $@
34
35 clean:
36 rm -rf $(addprefix $(DSTROOT)/,$(TARGETS)) $(addprefix $(SYMROOT)/,$(TARGETS)) $(SYMROOT)/*.dSYM