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 19 matching lines...) Expand all Loading... | |
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 |
40 # The list of attributes associated with the built executable. | |
41 BUILD_ATTS = | |
42 | |
43 ifdef MINIMAL | |
44 OBJDIR := build/min | |
Jim Stichnoth
2014/10/15 03:16:36
It looks like this creates subdirs build/Release a
Karl
2014/10/15 20:12:31
Done.
| |
45 BUILD_ATTS := $(BUILD_ATTS) minimal p2i | |
Jim Stichnoth
2014/10/15 03:16:36
I think the logic of "minimal" is backwards.
None
Karl
2014/10/15 20:12:31
A better choice would be to put "minimal" when min
| |
46 else | |
47 OBJDIR = build | |
48 BUILD_ATTS := $(BUILD_ATTS) p2i l2i lc2i | |
49 endif | |
50 | |
40 ifdef DEBUG | 51 ifdef DEBUG |
41 OBJDIR = build/Debug | 52 OBJDIR := $(OBJDIR)/Debug |
42 OPTLEVEL = -O0 | 53 OPTLEVEL = -O0 |
54 BUILD_ATTS := $(BUILD_ATTS) debug | |
43 else | 55 else |
44 OBJDIR = build/Release | 56 OBJDIR := $(OBJDIR)/Release |
45 OPTLEVEL = -O2 | 57 OPTLEVEL = -O2 |
58 BUILD_ATTS := $(BUILD_ATTS) release | |
46 endif | 59 endif |
47 | 60 |
48 ifdef NOASSERT | 61 ifdef NOASSERT |
49 ASSERTIONS = -DNDEBUG | 62 ASSERTIONS = -DNDEBUG |
50 else | 63 else |
51 ASSERTIONS = | 64 ASSERTIONS = |
52 OBJDIR := $(OBJDIR)+Asserts | 65 OBJDIR := $(OBJDIR)+Asserts |
66 BUILD_ATTS := $(BUILD_ATTS) asserts | |
53 endif | 67 endif |
54 | 68 |
55 $(info -----------------------------------------------) | 69 $(info -----------------------------------------------) |
56 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) | 70 $(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH)) |
57 $(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH)) | 71 $(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH)) |
58 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) | 72 $(info Using LIBCXX_INSTALL_PATH = $(LIBCXX_INSTALL_PATH)) |
59 $(info Using CLANG_PATH = $(CLANG_PATH)) | 73 $(info Using CLANG_PATH = $(CLANG_PATH)) |
60 $(info Using HOST_ARCH = $(HOST_ARCH)) | 74 $(info Using HOST_ARCH = $(HOST_ARCH)) |
61 $(info -----------------------------------------------) | 75 $(info -----------------------------------------------) |
62 | 76 |
63 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` | 77 LLVM_CXXFLAGS := `$(LLVM_BIN_PATH)/llvm-config --cxxflags` |
64 LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --libs` \ | 78 LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --libs` \ |
65 `$(LLVM_BIN_PATH)/llvm-config --ldflags` | 79 `$(LLVM_BIN_PATH)/llvm-config --ldflags` |
66 | 80 |
67 # It's recommended that CXX matches the compiler you used to build LLVM itself. | 81 # It's recommended that CXX matches the compiler you used to build LLVM itself. |
68 CCACHE := `command -v ccache` | 82 CCACHE := `command -v ccache` |
69 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ | 83 CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++ |
70 | 84 |
71 CXXFLAGS := $(LLVM_CXXFLAGS) -std=c++11 -Wall -Wextra -Werror -fno-rtti \ | 85 CXXFLAGS := $(LLVM_CXXFLAGS) -std=c++11 -Wall -Wextra -Werror -fno-rtti \ |
72 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g $(HOST_FLAGS) \ | 86 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) -g $(HOST_FLAGS) \ |
73 -Wno-error=unused-parameter -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 | 87 -Wno-error=unused-parameter -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
74 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib | 88 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib |
75 | 89 |
90 ifdef MINIMAL | |
91 CXXFLAGS :=$(CXXFLAGS) -DSZ_MINIMAL | |
Jim Stichnoth
2014/10/15 03:16:36
I started thinking that maybe instead of a single
Karl
2014/10/15 20:12:31
Went ahead and added multiple flags for correspond
| |
92 endif | |
93 | |
76 SRCS= \ | 94 SRCS= \ |
77 assembler.cpp \ | 95 assembler.cpp \ |
78 assembler_ia32.cpp \ | 96 assembler_ia32.cpp \ |
79 IceCfg.cpp \ | 97 IceCfg.cpp \ |
80 IceCfgNode.cpp \ | 98 IceCfgNode.cpp \ |
81 IceConverter.cpp \ | 99 IceConverter.cpp \ |
82 IceGlobalContext.cpp \ | 100 IceGlobalContext.cpp \ |
83 IceGlobalInits.cpp \ | 101 IceGlobalInits.cpp \ |
84 IceInst.cpp \ | 102 IceInst.cpp \ |
85 IceInstX8632.cpp \ | 103 IceInstX8632.cpp \ |
(...skipping 11 matching lines...) Expand all Loading... | |
97 IceTypes.cpp \ | 115 IceTypes.cpp \ |
98 llvm2ice.cpp \ | 116 llvm2ice.cpp \ |
99 PNaClTranslator.cpp | 117 PNaClTranslator.cpp |
100 | 118 |
101 OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS)) | 119 OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS)) |
102 | 120 |
103 # Keep all the first target so it's the default. | 121 # Keep all the first target so it's the default. |
104 all: $(OBJDIR)/llvm2ice make_symlink | 122 all: $(OBJDIR)/llvm2ice make_symlink |
105 | 123 |
106 make_symlink: $(OBJDIR)/llvm2ice | 124 make_symlink: $(OBJDIR)/llvm2ice |
107 » rm -f llvm2ice | 125 » rm -f llvm2ice llvm2ice.build_atts |
108 ln -s $(OBJDIR)/llvm2ice | 126 ln -s $(OBJDIR)/llvm2ice |
127 ln -s $(OBJDIR)/llvm2ice.build_atts | |
109 | 128 |
110 .PHONY: all make_symlink | 129 .PHONY: all make_symlink |
111 | 130 |
112 $(OBJDIR)/llvm2ice: $(OBJS) | 131 $(OBJDIR)/llvm2ice: $(OBJS) |
113 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl \ | 132 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl \ |
114 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) | 133 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
134 echo "$(BUILD_ATTS)" > $@.build_atts | |
115 | 135 |
116 # TODO: Be more precise than "*.h" here and elsewhere. | 136 # TODO: Be more precise than "*.h" here and elsewhere. |
117 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def | 137 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def |
118 $(CXX) -c $(CXXFLAGS) $< -o $@ | 138 $(CXX) -c $(CXXFLAGS) $< -o $@ |
119 | 139 |
120 $(OBJS): | $(OBJDIR) | 140 $(OBJS): | $(OBJDIR) |
121 | 141 |
122 $(OBJDIR): | 142 $(OBJDIR): |
123 @mkdir -p $@ | 143 @mkdir -p $@ |
124 | 144 |
(...skipping 17 matching lines...) Expand all Loading... | |
142 ifeq (,$(wildcard /usr/lib/clang-format/clang-format-diff.py)) | 162 ifeq (,$(wildcard /usr/lib/clang-format/clang-format-diff.py)) |
143 CLANG_FORMAT_DIFF = clang-format-diff.py | 163 CLANG_FORMAT_DIFF = clang-format-diff.py |
144 else | 164 else |
145 CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py | 165 CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py |
146 endif | 166 endif |
147 format-diff: | 167 format-diff: |
148 git diff -U0 `git merge-base HEAD master` | \ | 168 git diff -U0 `git merge-base HEAD master` | \ |
149 $(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i | 169 $(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i |
150 | 170 |
151 clean: | 171 clean: |
152 » rm -rf llvm2ice *.o build/ | 172 » rm -rf llvm2ice llvm2ice.build_atts *.o $(OBJDIR) |
Jim Stichnoth
2014/10/15 03:16:36
Shouldn't "make clean" remove the entire build/ di
Karl
2014/10/15 20:12:31
Added "clean-all" to clean all.
| |
OLD | NEW |