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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 UNITTEST_SRCS = \ | 140 UNITTEST_SRCS = \ |
141 BitcodeMunge.cpp \ | 141 BitcodeMunge.cpp \ |
142 IceELFSectionTest.cpp \ | 142 IceELFSectionTest.cpp \ |
143 IceParseInstsTest.cpp | 143 IceParseInstsTest.cpp |
144 | 144 |
145 UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS)) | 145 UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS)) |
146 UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/llvm2ice.o,$(OBJS)) | 146 UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/llvm2ice.o,$(OBJS)) |
147 | 147 |
148 # Keep all the first target so it's the default. | 148 # Keep all the first target so it's the default. |
149 all: $(OBJDIR)/llvm2ice make_symlink | 149 all: $(OBJDIR)/llvm2ice make_symlink runtime |
150 | 150 |
151 # Creates symbolic link so that testing is easier. Also runs | 151 # Creates symbolic link so that testing is easier. Also runs |
152 # llvm2ice to verify that the defines flags have valid values, | 152 # llvm2ice to verify that the defines flags have valid values, |
153 # as well as describe the corresponding build attributes. | 153 # as well as describe the corresponding build attributes. |
154 make_symlink: $(OBJDIR)/llvm2ice | 154 make_symlink: $(OBJDIR)/llvm2ice |
155 rm -rf llvm2ice | 155 rm -rf llvm2ice |
156 ln -s $(OBJDIR)/llvm2ice | 156 ln -s $(OBJDIR)/llvm2ice |
157 @echo "Build Attributes:" | 157 @echo "Build Attributes:" |
158 @$(OBJDIR)/llvm2ice --build-atts | 158 @$(OBJDIR)/llvm2ice --build-atts |
159 | 159 |
160 .PHONY: all make_symlink bloat | 160 .PHONY: all make_symlink runtime bloat |
161 | 161 |
162 # TODO(kschimpf): Fix python scripts to directly get build attributes | |
163 # rather than generating $(OBJDIR)/llvm2ice.build_atts. | |
164 $(OBJDIR)/llvm2ice: $(OBJS) | 162 $(OBJDIR)/llvm2ice: $(OBJS) |
165 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ | 163 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ |
166 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) | 164 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
167 | 165 |
168 # TODO(stichnot): Be more precise than "*.h" here and elsewhere. | 166 # TODO(stichnot): Be more precise than "*.h" here and elsewhere. |
169 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def | 167 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def |
170 $(CXX) -c $(CXXFLAGS) $< -o $@ | 168 $(CXX) -c $(CXXFLAGS) $< -o $@ |
171 | 169 |
172 $(OBJDIR)/run_unittests: $(UNITTEST_OBJS) $(UNITTEST_LIB_OBJS) | 170 $(OBJDIR)/run_unittests: $(UNITTEST_OBJS) $(UNITTEST_LIB_OBJS) |
173 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -lgtest -lgtest_main -ldl \ | 171 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -lgtest -lgtest_main -ldl \ |
(...skipping 10 matching lines...) Expand all Loading... |
184 $(OBJS): | $(OBJDIR) | 182 $(OBJS): | $(OBJDIR) |
185 | 183 |
186 $(UNITTEST_OBJS): | $(OBJDIR)/unittest | 184 $(UNITTEST_OBJS): | $(OBJDIR)/unittest |
187 | 185 |
188 $(OBJDIR): | 186 $(OBJDIR): |
189 @mkdir -p $@ | 187 @mkdir -p $@ |
190 | 188 |
191 $(OBJDIR)/unittest: $(OBJDIR) | 189 $(OBJDIR)/unittest: $(OBJDIR) |
192 @mkdir -p $@ | 190 @mkdir -p $@ |
193 | 191 |
| 192 RT_SRC := runtime/szrt.c runtime/szrt_ll.ll |
| 193 RT_OBJ := build/runtime/szrt_native_x8632.o build/runtime/szrt_sb_x8632.o |
| 194 |
| 195 runtime: $(RT_OBJ) |
| 196 |
| 197 # Use runtime.is.built so that build-runtime.py is invoked only once |
| 198 # even in a parallel build. |
| 199 .INTERMEDIATE: runtime.is.built |
| 200 $(RT_OBJ): runtime.is.built |
| 201 runtime.is.built: $(RT_SRC) |
| 202 @echo ================ Building Subzero runtime ================ |
| 203 ./pydir/build-runtime.py -v |
| 204 |
194 check-lit: $(OBJDIR)/llvm2ice make_symlink | 205 check-lit: $(OBJDIR)/llvm2ice make_symlink |
195 LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ | 206 LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ |
196 BINUTILS_BIN_PATH=$(BINUTILS_BIN_PATH) \ | 207 BINUTILS_BIN_PATH=$(BINUTILS_BIN_PATH) \ |
197 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit | 208 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit |
198 | 209 |
199 check-unit: $(OBJDIR)/run_unittests | 210 check-unit: $(OBJDIR)/run_unittests |
200 $(OBJDIR)/run_unittests | 211 $(OBJDIR)/run_unittests |
201 | 212 |
202 ifdef MINIMAL | 213 ifdef MINIMAL |
203 check: check-lit check-unit | 214 check: check-lit check-unit runtime |
204 @echo "Crosstests ignored, minimal build" | 215 @echo "Crosstests ignored, minimal build" |
205 else | 216 else |
206 check: check-lit check-unit | 217 check: check-lit check-unit runtime |
207 (cd crosstest; ./runtests.sh) | 218 (cd crosstest; ./runtests.sh) |
208 endif | 219 endif |
209 | 220 |
210 FORMAT_BLACKLIST = | 221 FORMAT_BLACKLIST = |
211 # Add one of the following lines for each source file to ignore. | 222 # Add one of the following lines for each source file to ignore. |
212 FORMAT_BLACKLIST += ! -name IceParseInstsTest.cpp | 223 FORMAT_BLACKLIST += ! -name IceParseInstsTest.cpp |
213 format: | 224 format: |
214 $(LLVM_BIN_PATH)/clang-format -style=LLVM -i \ | 225 $(LLVM_BIN_PATH)/clang-format -style=LLVM -i \ |
215 `find . -regex '.*\.\(c\|h\|cpp\)' $(FORMAT_BLACKLIST)` | 226 `find . -regex '.*\.\(c\|h\|cpp\)' $(FORMAT_BLACKLIST)` |
216 | 227 |
217 format-diff: | 228 format-diff: |
218 git diff -U0 `git merge-base HEAD master` | \ | 229 git diff -U0 `git merge-base HEAD master` | \ |
219 PATH=$(LLVM_BIN_PATH):$(PATH) \ | 230 PATH=$(LLVM_BIN_PATH):$(PATH) \ |
220 $(LLVM_SRC_PATH)/../clang/tools/clang-format/clang-format-diff.py \ | 231 $(LLVM_SRC_PATH)/../clang/tools/clang-format/clang-format-diff.py \ |
221 -p1 -style=LLVM -i | 232 -p1 -style=LLVM -i |
222 | 233 |
223 bloat: make_symlink | 234 bloat: make_symlink |
224 nm -C -S -l llvm2ice | \ | 235 nm -C -S -l llvm2ice | \ |
225 bloat/bloat.py --nm-output=/dev/stdin syms > build/llvm2ice.bloat.json | 236 bloat/bloat.py --nm-output=/dev/stdin syms > build/llvm2ice.bloat.json |
226 @echo See Subzero size breakdown in bloat/llvm2ice.bloat.html | 237 @echo See Subzero size breakdown in bloat/llvm2ice.bloat.html |
227 | 238 |
228 clean: | 239 clean: |
229 rm -rf llvm2ice *.o $(OBJDIR) build/llvm2ice.bloat.json | 240 rm -rf llvm2ice *.o $(OBJDIR) build/llvm2ice.bloat.json |
230 | 241 |
231 clean-all: clean | 242 clean-all: clean |
232 rm -rf build/ | 243 rm -rf build/ |
OLD | NEW |