]>
Commit | Line | Data |
---|---|---|
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 | ||
11 | ifdef RC_ARCHS | |
12 | ARCHS:=$(RC_ARCHS) | |
13 | else | |
14 | ifeq "$(Embedded)" "YES" | |
15 | ARCHS:=armv7 armv7s arm64 | |
16 | else | |
17 | ARCHS:=x86_64 i386 | |
18 | endif | |
19 | endif | |
20 | ||
21 | # These are convenience functions for filtering based on substrings, as the | |
22 | # normal filter functions only accept one wildcard. | |
23 | FILTER_OUT_SUBSTRING=$(strip $(foreach string,$(2),$(if $(findstring $(1),$(string)),,$(string)))) | |
24 | FILTER_SUBSTRING=$(strip $(foreach string,$(2),$(if $(findstring $(1),$(string)),$(string),))) | |
25 | ||
26 | ARCH_32:=$(call FILTER_OUT_SUBSTRING,64,$(ARCHS)) | |
27 | ARCH_64:=$(call FILTER_SUBSTRING,64,$(ARCHS)) | |
28 | ||
29 | ARCH_32_FLAGS := $(patsubst %, -arch %, $(ARCH_32)) | |
30 | ARCH_64_FLAGS := $(patsubst %, -arch %, $(ARCH_64)) | |
31 | ARCH_FLAGS := $(if $(ARCH_64), $(ARCH_64_FLAGS)) $(if $(ARCH_32), $(ARCH_32_FLAGS)) | |
32 | ||
33 | DSTROOT?=$(shell /bin/pwd) | |
34 | ||
35 | TARGETS := persona_mgr persona_spawn persona_test_run.sh persona_spawn_unentitled | |
36 | ||
37 | all: $(addprefix $(DSTROOT)/, $(TARGETS)) | |
38 | ||
39 | $(DSTROOT)/persona_%: persona_%.c persona_test.h Makefile persona-entitlements.plist | |
40 | ${CC} ${CFLAGS} ${ARCH_FLAGS} -o $(SYMROOT)/$(notdir $@) $< | |
41 | env CODESIGN_ALLOCATE=$(CODESIGN_ALLOCATE) \ | |
42 | $(CODESIGN) -s - --entitlements persona-entitlements.plist $(SYMROOT)/$(notdir $@) | |
43 | if [ ! -e $@ ]; then ditto $(SYMROOT)/$(notdir $@) $@; fi | |
44 | ||
45 | $(DSTROOT)/persona_spawn_unentitled: persona_spawn.c persona_test.h Makefile | |
46 | ${CC} ${CFLAGS} ${ARCH_FLAGS} -o $(SYMROOT)/$(notdir $@) $< | |
47 | if [ ! -e $@ ]; then ditto $(SYMROOT)/$(notdir $@) $@; fi | |
48 | ||
49 | $(DSTROOT)/persona_test_run.sh: persona_test_run_src.sh | |
50 | cp $? $@ | |
51 | chmod +x $@ | |
52 | ||
53 | clean: | |
54 | rm -rf $(addprefix $(DSTROOT)/,$(TARGETS)) $(addprefix $(SYMROOT)/,$(TARGETS)) $(SYMROOT)/*.dSYM |