[ReactNative][JSCProfiler] Cleanup make file and make targets cacheable
Summary: The makefile for the JSCLegacyProfiler was really messy, clean it up a bit, remove duplicate code, and make targets be actual files rather than dummy targets so it can actually cache things instead of re-downloading everything every time.
This commit is contained in:
parent
848839858b
commit
eb9a9395ac
|
@ -1,5 +1,3 @@
|
||||||
//#include "config.h"
|
|
||||||
|
|
||||||
#include "JSCLegacyProfiler.h"
|
#include "JSCLegacyProfiler.h"
|
||||||
|
|
||||||
#include "APICast.h"
|
#include "APICast.h"
|
||||||
|
|
|
@ -1,112 +1,101 @@
|
||||||
HEADER_PATHS := `find ./tmp/JavaScriptCore -name '*.h' | xargs -I{} dirname {} | uniq | xargs -I{} echo "-I {}"`
|
HEADER_PATHS := `find download/JavaScriptCore -name '*.h' | xargs -I{} dirname {} | uniq | xargs -I{} echo "-I {}"`
|
||||||
SDK_VERSION=$(shell plutil -convert json -o - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist | awk -f parseSDKVersion.awk)
|
|
||||||
|
SDK_PATH = /Applications/Xcode.app/Contents/Developer/Platforms/$1.platform/Developer/SDKs/$1.sdk
|
||||||
|
|
||||||
|
SDK_VERSION = $(shell plutil -convert json -o - $(call SDK_PATH,iPhoneOS)/SDKSettings.plist | awk -f parseSDKVersion.awk)
|
||||||
|
|
||||||
CERT ?= "iPhone Developer"
|
CERT ?= "iPhone Developer"
|
||||||
|
|
||||||
|
ARCHS = x86_64 arm64 armv7 i386
|
||||||
|
|
||||||
|
PLATFORM = \
|
||||||
|
if [[ "$*" = "x86_64" || "$*" = "i386" ]]; then \
|
||||||
|
PLATFORM=iPhoneSimulator; \
|
||||||
|
else \
|
||||||
|
PLATFORM=iPhoneOS; \
|
||||||
|
fi;
|
||||||
|
|
||||||
|
SYSROOT = -isysroot $(call SDK_PATH,$${PLATFORM})
|
||||||
|
|
||||||
|
IOS8_LIBS = download/WebCore/WebCore-7600.1.25 download/WTF/WTF-7600.1.24 download/JavaScriptCore/JavaScriptCore-7600.1.17 download/JavaScriptCore/JavaScriptCore-7600.1.17/Bytecodes.h libyajl.a
|
||||||
|
|
||||||
|
ios8: RCTJSCProfiler.ios8.dylib /tmp/RCTJSCProfiler
|
||||||
ifneq ($(SDK_VERSION), 8)
|
ifneq ($(SDK_VERSION), 8)
|
||||||
all:
|
|
||||||
$(error "Expected to be compiled with iOS SDK version 8, found $(SDK_VERSION)")
|
$(error "Expected to be compiled with iOS SDK version 8, found $(SDK_VERSION)")
|
||||||
|
else
|
||||||
|
cp $^
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ios8: prepare build generate
|
/tmp/JSCProfiler:
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
prepare: clean create download
|
.PRECIOUS: RCTJSCProfiler.ios8.dylib
|
||||||
|
RCTJSCProfiler.ios8.dylib: RCTJSCProfiler_unsigned.ios8.dylib
|
||||||
|
cp $< $@
|
||||||
|
codesign -f -s ${CERT} $@ || rm $@
|
||||||
|
|
||||||
build: x86_64 arm64 armv7
|
.PRECIOUS: RCTJSCProfiler_unsigned.ios8.dylib
|
||||||
|
RCTJSCProfiler_unsigned.ios8.dylib: $(patsubst %,RCTJSCProfiler_%.ios8.dylib,$(ARCHS))
|
||||||
|
lipo -create -output $@ $^
|
||||||
|
|
||||||
generate: lipo codesign
|
.PRECIOUS: RCTJSCProfiler_%.ios8.dylib
|
||||||
|
RCTJSCProfiler_%.ios8.dylib: $(IOS8_LIBS)
|
||||||
|
$(PLATFORM) \
|
||||||
|
clang -w -dynamiclib -o RCTJSCProfiler_$*.ios8.dylib -std=c++11 \
|
||||||
|
-arch $* \
|
||||||
|
-install_name RCTJSCProfiler.ios8.dylib \
|
||||||
|
-include ./download/JavaScriptCore/JavaScriptCore-7600.1.17/config.h \
|
||||||
|
-I download \
|
||||||
|
-I download/WebCore/WebCore-7600.1.25/icu \
|
||||||
|
-I download/WTF/WTF-7600.1.24 \
|
||||||
|
-I download/yajl-2.1.0/build/yajl-2.1.0/include \
|
||||||
|
-DNDEBUG=1\
|
||||||
|
-miphoneos-version-min=8.0 \
|
||||||
|
$(SYSROOT) \
|
||||||
|
$(HEADER_PATHS) \
|
||||||
|
-undefined dynamic_lookup \
|
||||||
|
JSCLegacyProfiler.mm libyajl.a
|
||||||
|
|
||||||
clean:
|
.PRECIOUS: %/Bytecodes.h
|
||||||
@rm -rf tmp/ /tmp/RCTJSCProfiler
|
%/Bytecodes.h:
|
||||||
|
python $*/generate-bytecode-files --bytecodes_h $@ $*/bytecode/BytecodeList.json
|
||||||
|
|
||||||
lipo:
|
.PRECIOUS: libyajl.a
|
||||||
lipo -create -output /tmp/RCTJSCProfiler/RCTJSCProfiler.ios8.dylib ./tmp/RCTJSCProfiler_x86_64 ./tmp/RCTJSCProfiler_arm64 ./tmp/RCTJSCProfiler_armv7
|
libyajl.a: $(patsubst %,libyajl_%.a,$(ARCHS))
|
||||||
|
lipo -create $^ -output $@
|
||||||
|
|
||||||
codesign:
|
.PRECIOUS: libyajl_%.a
|
||||||
codesign -f -s ${CERT} /tmp/RCTJSCProfiler/RCTJSCProfiler.ios8.dylib
|
libyajl_%.a: download/yajl-2.1.0
|
||||||
|
$(PLATFORM) \
|
||||||
create:
|
cd download/yajl-2.1.0/src; \
|
||||||
mkdir -p ./tmp /tmp/RCTJSCProfiler/ ./tmp/CoreFoundation ./tmp/Foundation
|
clang -arch $(*F) -std=c99 \
|
||||||
for file in ./tmp/CoreFoundation/CFUserNotification.h ./tmp/CoreFoundation/CFXMLNode.h ./tmp/CoreFoundation/CFXMLParser.h ./tmp/Foundation/Foundation.h; do echo '' > "$$file"; done
|
-miphoneos-version-min=8.0 \
|
||||||
|
$(SYSROOT) \
|
||||||
download: wtf jsc webcore yajl
|
|
||||||
|
|
||||||
wtf:
|
|
||||||
curl -o tmp/WTF.tar.gz http://www.opensource.apple.com/tarballs/WTF/WTF-7600.1.24.tar.gz
|
|
||||||
tar -zxvf tmp/WTF.tar.gz -C tmp
|
|
||||||
|
|
||||||
jsc:
|
|
||||||
curl -o tmp/JSC.tar.gz http://www.opensource.apple.com/tarballs/JavaScriptCore/JavaScriptCore-7600.1.17.tar.gz
|
|
||||||
tar -zxvf tmp/JSC.tar.gz -C tmp
|
|
||||||
mv ./tmp/JavaScriptCore-7600.1.17 ./tmp/JavaScriptCore
|
|
||||||
python ./tmp/JavaScriptCore/generate-bytecode-files --bytecodes_h ./tmp/JavaScriptCore/Bytecodes.h ./tmp/JavaScriptCore/bytecode/BytecodeList.json
|
|
||||||
|
|
||||||
webcore:
|
|
||||||
curl -o tmp/WebCore.tar.gz http://www.opensource.apple.com/tarballs/WebCore/WebCore-7600.1.25.tar.gz
|
|
||||||
tar -zxvf tmp/WebCore.tar.gz -C tmp
|
|
||||||
|
|
||||||
yajl:
|
|
||||||
curl -o tmp/yajl.tar.gz https://codeload.github.com/lloyd/yajl/tar.gz/2.1.0
|
|
||||||
tar -zxvf tmp/yajl.tar.gz -C tmp
|
|
||||||
mkdir -p ./tmp/yajl-2.1.0/build && cd ./tmp/yajl-2.1.0/build && cmake .. && make
|
|
||||||
echo `find . -name '*.c'`
|
|
||||||
cd ./tmp/yajl-2.1.0/src && \
|
|
||||||
clang -arch arm64 -arch armv7 -std=c99 \
|
|
||||||
-I /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/ \
|
|
||||||
-I /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/machine \
|
|
||||||
-I ../build/yajl-2.1.0/include \
|
-I ../build/yajl-2.1.0/include \
|
||||||
-c `find . -name '*.c'`
|
-c `find . -name '*.c'`
|
||||||
libtool -static -o ./tmp/yajl.a `find ./tmp/yajl-2.1.0/src/ -name '*.o'`
|
find download/yajl-2.1.0/src/ -name '*.o' -exec libtool -static -o $@ {} +
|
||||||
|
|
||||||
x86_64:
|
.PRECIOUS: download/yajl-2.1.0
|
||||||
clang -w -dynamiclib -o ./tmp/RCTJSCProfiler_x86_64 -std=c++11 \
|
download/yajl-2.1.0: download/yajl-2.1.0.tar.gz
|
||||||
-install_name RCTJSCProfiler.ios8.dylib \
|
tar -zxvf $< -C download
|
||||||
-include ./tmp/JavaScriptCore/config.h \
|
mkdir -p download/yajl-2.1.0/build && cd download/yajl-2.1.0/build && cmake ..
|
||||||
-I ./tmp \
|
|
||||||
-I ./tmp/WebCore-7600.1.25/icu \
|
|
||||||
-I ./tmp/WTF-7600.1.24 \
|
|
||||||
-I ./tmp/yajl-2.1.0/build/yajl-2.1.0/include \
|
|
||||||
-DNDEBUG=1\
|
|
||||||
-miphoneos-version-min=8.0 \
|
|
||||||
-L /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib \
|
|
||||||
-L /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/system \
|
|
||||||
${HEADER_PATHS} \
|
|
||||||
-undefined dynamic_lookup \
|
|
||||||
./JSCLegacyProfiler.mm ./tmp/yajl-2.1.0/build/yajl-2.1.0/lib/libyajl_s.a
|
|
||||||
|
|
||||||
arm64:
|
.PRECIOUS: download/yajl-2.1.0.tar.gz
|
||||||
echo $(HEADER_PATHS)
|
download/yajl-2.1.0.tar.gz:
|
||||||
clang -w -dynamiclib -o ./tmp/RCTJSCProfiler_arm64 -std=c++11 \
|
mkdir -p `dirname $@`
|
||||||
-install_name RCTJSCProfiler.ios8.dylib \
|
curl -o $@ https://codeload.github.com/lloyd/yajl/tar.gz/2.1.0
|
||||||
-arch arm64 \
|
|
||||||
-include ./tmp/JavaScriptCore/config.h \
|
|
||||||
-I ./tmp \
|
|
||||||
-I ./tmp/WebCore-7600.1.25/icu \
|
|
||||||
-I ./tmp/WTF-7600.1.24 \
|
|
||||||
-I ./tmp/yajl-2.1.0/build/yajl-2.1.0/include \
|
|
||||||
-I /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include \
|
|
||||||
-I /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/machine \
|
|
||||||
-DNDEBUG=1\
|
|
||||||
-miphoneos-version-min=8.0 \
|
|
||||||
-L /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib \
|
|
||||||
-L /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system \
|
|
||||||
${HEADER_PATHS} \
|
|
||||||
-undefined dynamic_lookup \
|
|
||||||
./JSCLegacyProfiler.mm ./tmp/yajl.a
|
|
||||||
|
|
||||||
armv7:
|
.PRECIOUS: download/%
|
||||||
clang -w -dynamiclib -o ./tmp/RCTJSCProfiler_armv7 -std=c++11 \
|
download/%: download/%.tar.gz
|
||||||
-install_name RCTJSCProfiler.ios8.dylib \
|
tar -zxvf $< -C `dirname $@`
|
||||||
-arch armv7 \
|
|
||||||
-include ./tmp/JavaScriptCore/config.h \
|
.PRECIOUS: %.tar.gz
|
||||||
-I ./tmp \
|
%.tar.gz:
|
||||||
-I ./tmp/WebCore-7600.1.25/icu \
|
mkdir -p `dirname $@`
|
||||||
-I ./tmp/WTF-7600.1.24 \
|
curl -o $@ http://www.opensource.apple.com/tarballs/$(patsubst download/%,%,$@)
|
||||||
-I ./tmp/yajl-2.1.0/build/yajl-2.1.0/include \
|
|
||||||
-I /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include \
|
.PHONY: clean
|
||||||
-DNDEBUG=1\
|
clean:
|
||||||
-miphoneos-version-min=8.0 \
|
@rm -rf $(wildcard *.dylib)
|
||||||
-L /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib \
|
@rm -rf $(wildcard *.a)
|
||||||
-L /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/system \
|
@rm -rf download
|
||||||
${HEADER_PATHS} \
|
|
||||||
-undefined dynamic_lookup \
|
|
||||||
./JSCLegacyProfiler.mm ./tmp/yajl.a
|
|
||||||
|
|
Loading…
Reference in New Issue