OLD | NEW |
1 # The following variables will likely need to be modified, depending on where | 1 # The following variables will likely need to be modified, depending on where |
2 # and how you built LLVM & Clang. They can be overridden in a command-line | 2 # and how you built LLVM & Clang. They can be overridden in a command-line |
3 # invocation of make, like: | 3 # invocation of make, like: |
4 # | 4 # |
5 # make LLVM_SRC_PATH=<path> LLVM_BIN_PATH=<path> ... | 5 # make LLVM_SRC_PATH=<path> LLVM_BIN_PATH=<path> \ |
| 6 # LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> ... |
6 # | 7 # |
7 | 8 |
8 # LLVM_SRC_PATH is the path to the root of the checked out source code. This | 9 # LLVM_SRC_PATH is the path to the root of the checked out source code. This |
9 # directory should contain the configure script, the include/ and lib/ | 10 # directory should contain the configure script, the include/ and lib/ |
10 # directories of LLVM, Clang in tools/clang/, etc. | 11 # directories of LLVM, Clang in tools/clang/, etc. |
11 # Alternatively, if you're building vs. a binary download of LLVM, then | 12 # Alternatively, if you're building vs. a binary download of LLVM, then |
12 # LLVM_SRC_PATH can point to the main untarred directory. | 13 # LLVM_SRC_PATH can point to the main untarred directory. |
13 LLVM_SRC_PATH ?= ../llvm | 14 LLVM_SRC_PATH ?= ../llvm |
14 | 15 |
15 # LLVM_BIN_PATH is the directory where binaries are placed by the LLVM build | 16 # LLVM_BIN_PATH is the directory where binaries are placed by the LLVM build |
16 # process. It should contain the tools like opt, llc and clang. The default | 17 # process. It should contain the tools like opt, llc and clang. The default |
17 # reflects a debug build with autotools (configure & make). | 18 # reflects a debug build with autotools (configure & make). |
18 LLVM_BIN_PATH ?= $(shell readlink -e \ | 19 LLVM_BIN_PATH ?= $(shell readlink -e \ |
19 ../../out/llvm_i686_linux_work/Release+Asserts/bin) | 20 ../../out/llvm_i686_linux_work/Release+Asserts/bin) |
20 | 21 |
| 22 # LIBCXX_INSTALL_PATH is the directory where libc++ is located. It should |
| 23 # contain header files and corresponding libraries |
| 24 LIBCXX_INSTALL_PATH ?= $(shell readlink -e \ |
| 25 ../../../toolchain/linux_x86/pnacl_newlib/host_x86_32) |
| 26 |
| 27 # CLANG_PATH is the location of the clang compiler to use. |
| 28 CLANG_PATH ?= $(shell readlink -e \ |
| 29 ../../../../third_party/llvm-build/Release+Asserts/bin) |
| 30 |
21 HOST_ARCH ?= x86 | 31 HOST_ARCH ?= x86 |
22 ifeq ($(HOST_ARCH),x86_64) | 32 ifeq ($(HOST_ARCH),x86_64) |
23 HOST_FLAGS = -m64 | 33 HOST_FLAGS = -m64 -stdlib=libc++ |
24 else | 34 else |
25 ifeq ($(HOST_ARCH),x86) | 35 ifeq ($(HOST_ARCH),x86) |
26 HOST_FLAGS = -m32 | 36 HOST_FLAGS = -m32 -stdlib=libc++ |
27 endif | 37 endif |
28 endif | 38 endif |
29 | 39 |
30 $(info -----------------------------------------------) | 40 $(info -----------------------------------------------) |
31 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) | 41 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) |
32 $(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH)) | 42 $(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH)) |
| 43 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) |
| 44 $(info Using CLANG_PATH = $(CLANG_PATH)) |
33 $(info Using HOST_ARCH = $(HOST_ARCH)) | 45 $(info Using HOST_ARCH = $(HOST_ARCH)) |
34 $(info -----------------------------------------------) | 46 $(info -----------------------------------------------) |
35 | 47 |
36 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` | 48 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` |
37 LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --libs` \ | 49 LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --libs` \ |
38 `$(LLVM_BIN_PATH)/llvm-config --ldflags` | 50 `$(LLVM_BIN_PATH)/llvm-config --ldflags` |
39 | 51 |
40 # It's recommended that CXX matches the compiler you used to build LLVM itself. | 52 # It's recommended that CXX matches the compiler you used to build LLVM itself. |
41 OPTLEVEL := -O0 | 53 OPTLEVEL := -O0 |
42 CXX := g++ | 54 CXX := $(CLANG_PATH)/clang++ |
43 | 55 |
44 CXXFLAGS := $(LLVM_CXXFLAGS) -Wall -Wextra -Werror -fno-rtti \ | 56 CXXFLAGS := $(LLVM_CXXFLAGS) -Wall -Wextra -Werror -fno-rtti \ |
45 -fno-exceptions $(OPTLEVEL) -g $(HOST_FLAGS) \ | 57 -fno-exceptions $(OPTLEVEL) -g $(HOST_FLAGS) \ |
46 » -Wno-error=unused-parameter | 58 » -Wno-error=unused-parameter -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
47 LDFLAGS := $(HOST_FLAGS) | 59 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib |
48 | 60 |
49 SRCS= \ | 61 SRCS= \ |
50 IceCfg.cpp \ | 62 IceCfg.cpp \ |
51 IceCfgNode.cpp \ | 63 IceCfgNode.cpp \ |
52 IceConverter.cpp \ | 64 IceConverter.cpp \ |
53 IceGlobalContext.cpp \ | 65 IceGlobalContext.cpp \ |
54 IceInst.cpp \ | 66 IceInst.cpp \ |
55 IceInstX8632.cpp \ | 67 IceInstX8632.cpp \ |
56 IceIntrinsics.cpp \ | 68 IceIntrinsics.cpp \ |
57 IceLiveness.cpp \ | 69 IceLiveness.cpp \ |
58 IceOperand.cpp \ | 70 IceOperand.cpp \ |
59 IceRegAlloc.cpp \ | 71 IceRegAlloc.cpp \ |
60 IceRNG.cpp \ | 72 IceRNG.cpp \ |
61 IceTargetLowering.cpp \ | 73 IceTargetLowering.cpp \ |
62 IceTargetLoweringX8632.cpp \ | 74 IceTargetLoweringX8632.cpp \ |
63 IceTranslator.cpp \ | 75 IceTranslator.cpp \ |
64 IceTypeConverter.cpp \ | 76 IceTypeConverter.cpp \ |
65 IceTypes.cpp \ | 77 IceTypes.cpp \ |
66 llvm2ice.cpp \ | 78 llvm2ice.cpp \ |
67 PNaClTranslator.cpp | 79 PNaClTranslator.cpp |
68 | 80 |
69 OBJS=$(patsubst %.cpp, build/%.o, $(SRCS)) | 81 OBJS=$(patsubst %.cpp, build/%.o, $(SRCS)) |
70 | 82 |
71 # Keep all the first target so it's the default. | 83 # Keep all the first target so it's the default. |
72 all: llvm2ice | 84 all: llvm2ice |
73 | 85 |
74 .PHONY: all | 86 .PHONY: all |
75 | 87 |
76 llvm2ice: $(OBJS) | 88 llvm2ice: $(OBJS) |
77 » $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl | 89 » $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl \ |
| 90 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
78 | 91 |
79 # TODO: Be more precise than "*.h" here and elsewhere. | 92 # TODO: Be more precise than "*.h" here and elsewhere. |
80 $(OBJS): build/%.o: src/%.cpp src/*.h src/*.def | 93 $(OBJS): build/%.o: src/%.cpp src/*.h src/*.def |
81 $(CXX) -c $(CXXFLAGS) $< -o $@ | 94 $(CXX) -c $(CXXFLAGS) $< -o $@ |
82 | 95 |
83 $(OBJS): | build | 96 $(OBJS): | build |
84 | 97 |
85 build: | 98 build: |
86 @mkdir -p $@ | 99 @mkdir -p $@ |
87 | 100 |
(...skipping 18 matching lines...) Expand all Loading... |
106 CLANG_FORMAT_DIFF = clang-format-diff.py | 119 CLANG_FORMAT_DIFF = clang-format-diff.py |
107 else | 120 else |
108 CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py | 121 CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py |
109 endif | 122 endif |
110 format-diff: | 123 format-diff: |
111 git diff -U0 `git merge-base HEAD master` | \ | 124 git diff -U0 `git merge-base HEAD master` | \ |
112 $(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i | 125 $(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i |
113 | 126 |
114 clean: | 127 clean: |
115 rm -rf llvm2ice *.o build/ | 128 rm -rf llvm2ice *.o build/ |
OLD | NEW |