]>
Commit | Line | Data |
---|---|---|
1 | include ../Makefile.common | |
2 | ||
3 | CC:=$(shell xcrun -sdk "$(SDKROOT)" -find cc) | |
4 | ||
5 | SYMROOT?=$(shell /bin/pwd) | |
6 | ||
7 | ifdef RC_ARCHS | |
8 | ARCHS:=$(RC_ARCHS) | |
9 | else | |
10 | ifeq "$(Embedded)" "YES" | |
11 | ARCHS:=armv7 armv7s arm64 | |
12 | else | |
13 | ARCHS:=x86_64 i386 | |
14 | endif | |
15 | endif | |
16 | ||
17 | # These are convenience functions for filtering based on substrings, as the | |
18 | # normal filter functions only accept one wildcard. | |
19 | FILTER_OUT_SUBSTRING=$(strip $(foreach string,$(2),$(if $(findstring $(1),$(string)),,$(string)))) | |
20 | FILTER_SUBSTRING=$(strip $(foreach string,$(2),$(if $(findstring $(1),$(string)),$(string),))) | |
21 | ||
22 | ARCH_32:=$(call FILTER_OUT_SUBSTRING,64,$(ARCHS)) | |
23 | ARCH_64:=$(call FILTER_SUBSTRING,64,$(ARCHS)) | |
24 | ||
25 | ARCH_32_FLAGS := $(patsubst %, -arch %, $(ARCH_32)) | |
26 | ARCH_64_FLAGS := $(patsubst %, -arch %, $(ARCH_64)) | |
27 | ||
28 | CFLAGS :=-g -isysroot $(SDKROOT) -I$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders | |
29 | ||
30 | DSTROOT?=$(shell /bin/pwd) | |
31 | SRCROOT?=$(shell /bin/pwd) | |
32 | ||
33 | SOURCES := sets.c pool.c tags.c | |
34 | ARCH_32_TARGETS := $(addprefix $(DSTROOT)/, sets pool tags) | |
35 | ARCH_64_TARGETS := $(addprefix $(DSTROOT)/, sets64 pool64 tags64) | |
36 | ||
37 | TARGETS := $(if $(ARCH_64), $(ARCH_64_TARGETS)) $(if $(ARCH_32), $(ARCH_32_TARGETS)) | |
38 | ||
39 | ||
40 | all: $(TARGETS) | |
41 | ||
42 | $(ARCH_32_TARGETS): $(DSTROOT)/%: $(SRCROOT)/%.c | |
43 | $(CC) $(CFLAGS) $(ARCH_32_FLAGS) $< -o $(SYMROOT)/$(notdir $@) # 32-bit fat | |
44 | if [ ! -e $@ ]; then ditto $(SYMROOT)/$(notdir $@) $@; fi | |
45 | ||
46 | .SECONDEXPANSION: | |
47 | $(ARCH_64_TARGETS): $(DSTROOT)/%: $(SRCROOT)/$$(subst 64,,%).c | |
48 | $(CC) $(CFLAGS) $(ARCH_64_FLAGS) $< -o $(SYMROOT)/$(notdir $@) # 64-bit fat | |
49 | if [ ! -e $@ ]; then ditto $(SYMROOT)/$(notdir $@) $@; fi | |
50 | ||
51 | clean: | |
52 | rm -f $(TARGETS) | |
53 | rm -rf $(SYMROOT)/*.dSYM |