This repository was archived by the owner on Sep 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefileJS
More file actions
48 lines (40 loc) · 3.53 KB
/
MakefileJS
File metadata and controls
48 lines (40 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
CC=emcc
CFLAGS=-c -I./include -I./src -DJS=1 -DANGLE_USE_NEW_PREPROCESSOR=1
LDFLAGS=
SOURCES=./src/compiler/BuiltInFunctionEmulator.cpp ./src/compiler/CodeGenGLSL.cpp ./src/compiler/Compiler.cpp ./src/compiler/debug.cpp \
./src/compiler/depgraph/DependencyGraph.cpp ./src/compiler/depgraph/DependencyGraphBuilder.cpp ./src/compiler/depgraph/DependencyGraphOutput.cpp \
./src/compiler/depgraph/DependencyGraphTraverse.cpp ./src/compiler/DetectDiscontinuity.cpp ./src/compiler/DetectRecursion.cpp ./src/compiler/Diagnostics.cpp \
./src/compiler/DirectiveHandler.cpp ./src/compiler/ForLoopUnroll.cpp ./src/compiler/glslang_lex.cpp ./src/compiler/glslang_tab.cpp ./src/compiler/InfoSink.cpp \
./src/compiler/Initialize.cpp ./src/compiler/Intermediate.cpp ./src/compiler/intermOut.cpp ./src/compiler/IntermTraverse.cpp ./src/compiler/MapLongVariableNames.cpp \
./src/compiler/OutputESSL.cpp ./src/compiler/OutputGLSL.cpp ./src/compiler/OutputGLSLBase.cpp ./src/compiler/parseConst.cpp \
./src/compiler/ParseHelper.cpp ./src/compiler/preprocessor/new/Diagnostics.cpp ./src/compiler/preprocessor/new/DirectiveHandler.cpp \
./src/compiler/preprocessor/new/DirectiveParser.cpp ./src/compiler/preprocessor/new/ExpressionParser.cpp ./src/compiler/preprocessor/new/Input.cpp \
./src/compiler/preprocessor/new/Lexer.cpp ./src/compiler/preprocessor/new/Macro.cpp ./src/compiler/preprocessor/new/MacroExpander.cpp \
./src/compiler/preprocessor/new/Preprocessor.cpp ./src/compiler/preprocessor/new/Token.cpp ./src/compiler/preprocessor/new/Tokenizer.cpp ./src/compiler/QualifierAlive.cpp \
./src/compiler/RemoveTree.cpp ./src/compiler/SearchSymbol.cpp ./src/compiler/ShaderLang.cpp ./src/compiler/SymbolTable.cpp ./src/compiler/timing/RestrictFragmentShaderTiming.cpp \
./src/compiler/timing/RestrictVertexShaderTiming.cpp ./src/compiler/TranslatorESSL.cpp ./src/compiler/TranslatorGLSL.cpp \
./src/compiler/UnfoldShortCircuit.cpp ./src/compiler/util.cpp ./src/compiler/ValidateLimitations.cpp ./src/compiler/VariableInfo.cpp ./src/compiler/VersionGLSL.cpp \
./src/compiler/InitializeDLL.cpp ./src/compiler/PoolAlloc.cpp ./src/compiler/InitializeParseContext.cpp \
./src/compiler/ossource_js.cpp ./src/compiler/TranslatorJS.cpp ./src/compiler/OutputJS.cpp
SOURCES_C = \
./src/compiler/preprocessor/atom.c ./src/compiler/preprocessor/cpp.c ./src/compiler/preprocessor/cppstruct.c ./src/compiler/preprocessor/memory.c \
./src/compiler/preprocessor/scanner.c ./src/compiler/preprocessor/symbols.c ./src/compiler/preprocessor/tokens.c
OUTPUT_DIR = ./js_build/
OBJECTS=$(addprefix $(OUTPUT_DIR), $(SOURCES:.cpp=.cpp.bc) $(SOURCES_C:.c=.c.bc))
EXECUTABLE=$(OUTPUT_DIR)angle.js
EXPORTED_FUNCTIONS="['_ShInitialize', '_ShInitBuiltInResources', '_ShConstructCompiler', '_ShCompile', '_ShFinalize', '_ShGetInfo', '_ShGetObjectCode', '_ShGetInfoLog']"
all: $(SOURCES) $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) -O1 --llvm-opts 3 --closure 0 --minify 0 $(LDFLAGS) $(OBJECTS) --pre-js src/js/license.js -o $@ -s EXPORTED_FUNCTIONS=$(EXPORTED_FUNCTIONS)
# The following needs closure compiler and for now just whitespace minification works.
# java -Xmx1024m -jar closure-compiler/compiler.jar --js js_build/angle.js --js_output_file js_build/angle.closure.js --compilation_level WHITESPACE_ONLY
$(OUTPUT_DIR)%.cpp.bc: %.cpp
mkdir -p `dirname "$@"`
$(CC) -MMD -MF "$@.d" -MT "$@ $<.deps" $(CFLAGS) "$<" -o "$@"
$(OUTPUT_DIR)%.c.bc: %.c
mkdir -p `dirname "$@"`
$(CC) -MMD -MF "$@.d" -MT "$@ $<.deps" $(CFLAGS) "$<" -o "$@"
clean:
find . -name "*.bc" | xargs rm
.PHONY: clean all
-include $(OBJECTS:%=%.d)