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