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 # LIBCXX_INSTALL_PATH=<path> CLANG_PATH=<path> ... |
| 7 # | 7 # |
| 8 | 8 |
| 9 # 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 |
| 10 # directory should contain the configure script, the include/ and lib/ | 10 # directory should contain the configure script, the include/ and lib/ |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 ../../../../third_party/llvm-build/Release+Asserts/bin) | 29 ../../../../third_party/llvm-build/Release+Asserts/bin) |
| 30 | 30 |
| 31 HOST_ARCH ?= x86_64 | 31 HOST_ARCH ?= x86_64 |
| 32 ifeq ($(HOST_ARCH),x86_64) | 32 ifeq ($(HOST_ARCH),x86_64) |
| 33 HOST_FLAGS = -m64 -stdlib=libc++ | 33 HOST_FLAGS = -m64 -stdlib=libc++ |
| 34 else | 34 else |
| 35 ifeq ($(HOST_ARCH),x86) | 35 ifeq ($(HOST_ARCH),x86) |
| 36 HOST_FLAGS = -m32 -stdlib=libc++ | 36 HOST_FLAGS = -m32 -stdlib=libc++ |
| 37 endif | 37 endif |
| 38 endif | 38 endif |
| 39 | 39 |
|
jvoung (off chromium)
2014/09/26 19:15:25
Yeah, not sure the best way to dedupe some of this
Jim Stichnoth
2014/09/27 00:23:16
OK, I took the suggestion of linking llvm2ice in b
| |
| 40 $(info -----------------------------------------------) | 40 $(info -----------------------------------------------) |
| 41 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) | 41 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) |
| 42 $(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)) | 43 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) |
| 44 $(info Using CLANG_PATH = $(CLANG_PATH)) | 44 $(info Using CLANG_PATH = $(CLANG_PATH)) |
| 45 $(info Using HOST_ARCH = $(HOST_ARCH)) | 45 $(info Using HOST_ARCH = $(HOST_ARCH)) |
| 46 $(info -----------------------------------------------) | 46 $(info -----------------------------------------------) |
| 47 | 47 |
| 48 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` | 48 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` |
| 49 LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --libs` \ | 49 LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --libs` \ |
| 50 `$(LLVM_BIN_PATH)/llvm-config --ldflags` | 50 `$(LLVM_BIN_PATH)/llvm-config --ldflags` |
| 51 | 51 |
| 52 # 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. |
| 53 OPTLEVEL := -O0 | |
| 54 CCACHE := `command -v ccache` | 53 CCACHE := `command -v ccache` |
| 55 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ | 54 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ |
| 56 | 55 |
| 57 CXXFLAGS := $(LLVM_CXXFLAGS) -std=c++11 -Wall -Wextra -Werror -fno-rtti \ | 56 CXXFLAGS := $(LLVM_CXXFLAGS) -std=c++11 -Wall -Wextra -Werror -fno-rtti \ |
| 58 » -fno-exceptions $(OPTLEVEL) -g $(HOST_FLAGS) \ | 57 » -fno-exceptions -g $(HOST_FLAGS) \ |
| 59 -Wno-error=unused-parameter -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 | 58 -Wno-error=unused-parameter -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
| 60 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib | 59 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib |
| 61 | 60 |
| 62 SRCS= \ | 61 SRCS= \ |
| 63 assembler.cpp \ | 62 assembler.cpp \ |
| 64 assembler_ia32.cpp \ | 63 assembler_ia32.cpp \ |
| 65 IceCfg.cpp \ | 64 IceCfg.cpp \ |
| 66 IceCfgNode.cpp \ | 65 IceCfgNode.cpp \ |
| 67 IceConverter.cpp \ | 66 IceConverter.cpp \ |
| 68 IceGlobalContext.cpp \ | 67 IceGlobalContext.cpp \ |
| 69 IceInst.cpp \ | 68 IceInst.cpp \ |
| 70 IceInstX8632.cpp \ | 69 IceInstX8632.cpp \ |
| 71 IceIntrinsics.cpp \ | 70 IceIntrinsics.cpp \ |
| 72 IceLiveness.cpp \ | 71 IceLiveness.cpp \ |
| 73 IceMemoryRegion.cpp \ | 72 IceMemoryRegion.cpp \ |
| 74 IceOperand.cpp \ | 73 IceOperand.cpp \ |
| 75 IceRegAlloc.cpp \ | 74 IceRegAlloc.cpp \ |
| 76 IceRNG.cpp \ | 75 IceRNG.cpp \ |
| 77 IceTargetLowering.cpp \ | 76 IceTargetLowering.cpp \ |
| 78 IceTargetLoweringX8632.cpp \ | 77 IceTargetLoweringX8632.cpp \ |
| 79 IceTranslator.cpp \ | 78 IceTranslator.cpp \ |
| 80 IceTypeConverter.cpp \ | 79 IceTypeConverter.cpp \ |
| 81 IceTypes.cpp \ | 80 IceTypes.cpp \ |
| 82 llvm2ice.cpp \ | 81 llvm2ice.cpp \ |
| 83 PNaClTranslator.cpp | 82 PNaClTranslator.cpp |
| 84 | 83 |
| 85 OBJS=$(patsubst %.cpp, build/%.o, $(SRCS)) | 84 OBJS_DBG=$(patsubst %.cpp, build/Debug/%.o, $(SRCS)) |
| 85 OBJS_REL=$(patsubst %.cpp, build/Release/%.o, $(SRCS)) | |
| 86 | 86 |
| 87 # Keep all the first target so it's the default. | 87 # Keep all the first target so it's the default. |
| 88 # Note: llvm2ice_dbg is not built by default; "make llvm2ice_dbg" if needed. | |
| 88 all: llvm2ice | 89 all: llvm2ice |
| 89 | 90 |
| 90 .PHONY: all | 91 .PHONY: all |
| 91 | 92 |
| 92 llvm2ice: $(OBJS) | 93 llvm2ice: $(OBJS_REL) |
| 94 » $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl \ | |
| 95 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) | |
| 96 llvm2ice_dbg: $(OBJS_DBG) | |
| 93 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl \ | 97 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl \ |
| 94 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) | 98 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
| 95 | 99 |
| 96 # TODO: Be more precise than "*.h" here and elsewhere. | 100 # TODO: Be more precise than "*.h" here and elsewhere. |
| 97 $(OBJS): build/%.o: src/%.cpp src/*.h src/*.def | 101 $(OBJS_DBG): build/Debug/%.o: src/%.cpp src/*.h src/*.def |
| 98 » $(CXX) -c $(CXXFLAGS) $< -o $@ | 102 » $(CXX) -c -O0 $(CXXFLAGS) $< -o $@ |
| 103 $(OBJS_REL): build/Release/%.o: src/%.cpp src/*.h src/*.def | |
| 104 » $(CXX) -c -O2 $(CXXFLAGS) $< -o $@ | |
| 99 | 105 |
| 100 $(OBJS): | build | 106 $(OBJS_DBG): | build/Debug |
| 107 $(OBJS_REL): | build/Release | |
| 101 | 108 |
| 102 build: | 109 build/Debug build/Release: |
| 103 @mkdir -p $@ | 110 @mkdir -p $@ |
| 104 | 111 |
| 105 check-lit: llvm2ice | 112 check-lit: llvm2ice |
| 106 LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ | 113 LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ |
| 107 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit | 114 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit |
| 108 | 115 |
| 109 check: check-lit | 116 check: check-lit |
| 110 (cd crosstest; ./runtests.sh) | 117 (cd crosstest; ./runtests.sh) |
| 111 | 118 |
| 112 # TODO: Fix the use of wildcards. | 119 # TODO: Fix the use of wildcards. |
| 113 # Assumes clang-format is within $PATH. | 120 # Assumes clang-format is within $PATH. |
| 114 format: | 121 format: |
| 115 clang-format -style=LLVM -i src/*.h src/*.cpp | 122 clang-format -style=LLVM -i src/*.h src/*.cpp |
| 116 | 123 |
| 117 # Assumes clang-format-diff.py is within $PATH, and that the | 124 # Assumes clang-format-diff.py is within $PATH, and that the |
| 118 # clang-format it calls is also within $PATH. This may require adding | 125 # clang-format it calls is also within $PATH. This may require adding |
| 119 # a component to $PATH, or creating symlinks within some existing | 126 # a component to $PATH, or creating symlinks within some existing |
| 120 # $PATH component. Uses the one in /usr/lib/clang-format/ if it | 127 # $PATH component. Uses the one in /usr/lib/clang-format/ if it |
| 121 # exists. | 128 # exists. |
| 122 ifeq (,$(wildcard /usr/lib/clang-format/clang-format-diff.py)) | 129 ifeq (,$(wildcard /usr/lib/clang-format/clang-format-diff.py)) |
| 123 CLANG_FORMAT_DIFF = clang-format-diff.py | 130 CLANG_FORMAT_DIFF = clang-format-diff.py |
| 124 else | 131 else |
| 125 CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py | 132 CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py |
| 126 endif | 133 endif |
| 127 format-diff: | 134 format-diff: |
| 128 git diff -U0 `git merge-base HEAD master` | \ | 135 git diff -U0 `git merge-base HEAD master` | \ |
| 129 $(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i | 136 $(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i |
| 130 | 137 |
| 131 clean: | 138 clean: |
| 132 » rm -rf llvm2ice *.o build/ | 139 » rm -rf llvm2ice llvm2ice_dbg *.o build/ |
| OLD | NEW |