[Makefile]: Updated so that it works on OSX & Windows - for Windows it requires GCC, make 3.82 & wget to be on PATH ;
This commit is contained in:
42
Makefile
42
Makefile
@@ -6,23 +6,45 @@
|
||||
# of patent rights can be found in the PATENTS file in the same directory.
|
||||
|
||||
FILES=src/__tests__/Layout-test.c src/Layout.c src/Layout-test-utils.c
|
||||
JAVA_LIB_DIR=lib
|
||||
|
||||
ifeq ($(OS),Windows_NT)
|
||||
C_TEST_EXE=./c_test.exe
|
||||
ENVSEP=";"
|
||||
WGET=wget --no-check-certificate
|
||||
LLDB=gdb
|
||||
else
|
||||
C_TEST_EXE=./c_test
|
||||
ENVSEP=":"
|
||||
WGET=wget
|
||||
LLDB=lldb
|
||||
endif
|
||||
|
||||
all: c c_test java java_test
|
||||
|
||||
c: transpile_all
|
||||
|
||||
c_test: c
|
||||
@gcc -std=c99 -Werror -Wno-padded $(FILES) -lm && ./a.out
|
||||
@rm a.out
|
||||
@gcc -std=c99 -Werror -Wno-padded $(FILES) -lm -o "$(C_TEST_EXE)" && "$(C_TEST_EXE)"
|
||||
@rm "$(C_TEST_EXE)"
|
||||
|
||||
java: transpile_all src/java
|
||||
@if [ ! -f lib/junit4.jar ]; then mkdir lib/; wget -O lib/junit4.jar http://search.maven.org/remotecontent?filepath=junit/junit/4.10/junit-4.10.jar; fi
|
||||
@if [ ! -f lib/jsr305.jar ]; then mkdir lib/; wget -O lib/jsr305.jar http://search.maven.org/remotecontent?filepath=net/sourceforge/findbugs/jsr305/1.3.7/jsr305-1.3.7.jar; fi
|
||||
@if [ ! -f lib/infer-annotations-1.4.jar ]; then mkdir lib/; wget -O lib/infer-annotations-1.4.jar https://github.com/facebook/buck/raw/027ffe2b230c08cad7b340646c6f801bd6dabc78/third-party/java/infer-annotations/infer-annotations-1.4.jar; fi
|
||||
@javac -cp ./lib/junit4.jar:./lib/jsr305.jar:./lib/infer-annotations-1.4.jar -sourcepath ./src/java/src:./src/java/tests src/java/tests/com/facebook/csslayout/*.java
|
||||
$(JAVA_LIB_DIR):
|
||||
mkdir $(JAVA_LIB_DIR)
|
||||
|
||||
$(JAVA_LIB_DIR)/junit4.jar: | $(JAVA_LIB_DIR)
|
||||
$(WGET) -O $(JAVA_LIB_DIR)/junit4.jar http://search.maven.org/remotecontent?filepath=junit/junit/4.10/junit-4.10.jar
|
||||
|
||||
$(JAVA_LIB_DIR)/jsr305.jar: | $(JAVA_LIB_DIR)
|
||||
$(WGET) -O $(JAVA_LIB_DIR)/jsr305.jar http://search.maven.org/remotecontent?filepath=net/sourceforge/findbugs/jsr305/1.3.7/jsr305-1.3.7.jar
|
||||
|
||||
$(JAVA_LIB_DIR)/infer-annotations-1.4.jar: | $(JAVA_LIB_DIR)
|
||||
$(WGET) -O $(JAVA_LIB_DIR)/infer-annotations-1.4.jar https://github.com/facebook/buck/raw/027ffe2b230c08cad7b340646c6f801bd6dabc78/third-party/java/infer-annotations/infer-annotations-1.4.jar
|
||||
|
||||
java: transpile_all src/java | $(JAVA_LIB_DIR)/junit4.jar $(JAVA_LIB_DIR)/jsr305.jar $(JAVA_LIB_DIR)/infer-annotations-1.4.jar
|
||||
@javac -cp ./$(JAVA_LIB_DIR)/junit4.jar$(ENVSEP)./$(JAVA_LIB_DIR)/jsr305.jar$(ENVSEP)./$(JAVA_LIB_DIR)/infer-annotations-1.4.jar -sourcepath ./src/java/src$(ENVSEP)./src/java/tests src/java/tests/com/facebook/csslayout/*.java
|
||||
|
||||
java_test: java
|
||||
@java -cp ./src/java/src:./src/java/tests:./lib/junit4.jar:./lib/infer-annotations-1.4.jar org.junit.runner.JUnitCore \
|
||||
@java -cp ./src/java/src$(ENVSEP)./src/java/tests$(ENVSEP)./$(JAVA_LIB_DIR)/junit4.jar$(ENVSEP)./$(JAVA_LIB_DIR)/infer-annotations-1.4.jar org.junit.runner.JUnitCore \
|
||||
com.facebook.csslayout.LayoutEngineTest \
|
||||
com.facebook.csslayout.LayoutCachingTest \
|
||||
com.facebook.csslayout.CSSNodeTest
|
||||
@@ -31,5 +53,5 @@ transpile_all: ./src/transpile.js
|
||||
@node ./src/transpile.js
|
||||
|
||||
debug:
|
||||
@gcc -ggdb $(FILES) -lm && lldb ./a.out
|
||||
@rm a.out
|
||||
@gcc -std=c99 -ggdb $(FILES) -lm -o $(C_TEST_EXE) && $(LLDB) $(C_TEST_EXE)
|
||||
@rm $(C_TEST_EXE)
|
||||
|
Reference in New Issue
Block a user