#!/usr/bin/make
DSTROOT?=$(shell /bin/pwd)
-CC:=clang
-CFLAGS:=-I.
+CC:=$(shell xcrun -sdk "$(SDKROOT)" -find clang)
+CFLAGS:=-I. -g
ifdef RC_ARCHS
ARCH:=$(RC_ARCHS)
else
ifeq "$(Embedded)" "YES"
- ARCH:=armv7 armv7s
+ ARCH:=armv7 armv7s arm64
else
ARCH:=x86_64 i386
endif
MY_ARCH := $(patsubst %, -arch %, $(ARCH)) # allows building multiple archs.
-all: $(DSTROOT)/memorystatus
+all: $(DSTROOT)/memorystatus \
+ $(DSTROOT)/memorystatus_groups
+
+$(DSTROOT)/memorystatus_groups: memorystatus_groups.c
+ $(CC) $(MY_ARCH) -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders -o $(SYMROOT)/$(notdir $@) memorystatus_groups.c $(CFLAGS)
+ ditto $(SYMROOT)/$(notdir $@) $@
+ codesign -f -s - $@
+
$(DSTROOT)/memorystatus: memorystatus.c
- xcrun -sdk $(SDKROOT) $(CC) $(MY_ARCH) -framework CoreFoundation -framework ServiceManagement -F $(SDKROOT)/System/Library/PrivateFrameworks/ -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders -o $@ memorystatus.c $(CFLAGS)
+ $(CC) $(MY_ARCH) -framework CoreFoundation -framework ServiceManagement -F $(SDKROOT)/System/Library/PrivateFrameworks/ -isystem $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders -o $(SYMROOT)/$(notdir $@) memorystatus.c $(CFLAGS)
+ ditto $(SYMROOT)/$(notdir $@) $@
codesign -f -s - $@
clean:
rm -f $(DSTROOT)/memorystatus
+ rm -f $(DSTROOT)/memorystatus_groups