| OLD | NEW |
| 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 | |
| 3 # invocation of make, like: | |
| 4 # | |
| 5 # make LLVM_SRC_PATH=<path> LLVM_BIN_PATH=<path> ... | |
| 6 # | |
| 7 | 1 |
| 8 # LLVM_SRC_PATH is the path to the root of the checked out source code. This | 2 ifndef SUBZERO_LEVEL |
| 9 # directory should contain the configure script, the include/ and lib/ | 3 # Top-level, not included from a subdir |
| 10 # directories of LLVM, Clang in tools/clang/, etc. | 4 SUBZERO_LEVEL := . |
| 11 # Alternatively, if you're building vs. a binary download of LLVM, then | 5 DIRS := src |
| 12 # LLVM_SRC_PATH can point to the main untarred directory. | 6 PARALLEL_DIRS := |
| 13 LLVM_SRC_PATH ?= ../llvm | 7 endif |
| 14 | 8 |
| 15 # LLVM_BIN_PATH is the directory where binaries are placed by the LLVM build | 9 # Set LLVM source root level. |
| 16 # process. It should contain the tools like opt, llc and clang. The default | 10 LEVEL := $(SUBZERO_LEVEL)/../.. |
| 17 # reflects a debug build with autotools (configure & make). | |
| 18 LLVM_BIN_PATH ?= $(shell readlink -e \ | |
| 19 » ../../out/llvm_i686_linux_work/Release+Asserts/bin) | |
| 20 | 11 |
| 21 $(info -----------------------------------------------) | 12 # Include LLVM common makefile. |
| 22 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) | 13 include $(LEVEL)/Makefile.common |
| 23 $(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH)) | |
| 24 $(info -----------------------------------------------) | |
| 25 | |
| 26 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` | |
| 27 LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --ldflags --libs` | |
| 28 | |
| 29 # It's recommended that CXX matches the compiler you used to build LLVM itself. | |
| 30 OPTLEVEL := -O0 | |
| 31 CXX := g++ | |
| 32 CXXFLAGS := -Wall -Wextra -Werror -fno-rtti -fno-exceptions \ | |
| 33 » $(OPTLEVEL) -g $(LLVM_CXXFLAGS) -m32 | |
| 34 LDFLAGS := -m32 | |
| 35 | |
| 36 SRCS= \ | |
| 37 » IceCfg.cpp \ | |
| 38 » IceCfgNode.cpp \ | |
| 39 » IceGlobalContext.cpp \ | |
| 40 » IceInst.cpp \ | |
| 41 » IceInstX8632.cpp \ | |
| 42 » IceOperand.cpp \ | |
| 43 » IceTargetLowering.cpp \ | |
| 44 » IceTargetLoweringX8632.cpp \ | |
| 45 » IceTypes.cpp \ | |
| 46 » llvm2ice.cpp | |
| 47 | |
| 48 OBJS=$(patsubst %.cpp, build/%.o, $(SRCS)) | |
| 49 | |
| 50 # Keep all the first target so it's the default. | |
| 51 all: llvm2ice | |
| 52 | |
| 53 .PHONY: all | |
| 54 | |
| 55 llvm2ice: $(OBJS) | |
| 56 » $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl | |
| 57 | |
| 58 # TODO: Be more precise than "*.h" here and elsewhere. | |
| 59 $(OBJS): build/%.o: src/%.cpp src/*.h src/*.def | |
| 60 » $(CXX) -c $(CXXFLAGS) $< -o $@ | |
| 61 | |
| 62 $(OBJS): | build | |
| 63 | |
| 64 build: | |
| 65 » @mkdir -p $@ | |
| 66 | |
| 67 check: llvm2ice | |
| 68 » LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ | |
| 69 » $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit | |
| 70 » (cd crosstest; LLVM_BIN_PATH=$(LLVM_BIN_PATH) ./runtests.sh) | |
| 71 | |
| 72 # TODO: Fix the use of wildcards. | |
| 73 format: | |
| 74 » $(LLVM_BIN_PATH)/clang-format -style=LLVM -i \ | |
| 75 » src/Ice*.h src/Ice*.cpp src/llvm2ice.cpp | |
| 76 | |
| 77 clean: | |
| 78 » rm -rf llvm2ice *.o build/ | |
| OLD | NEW |