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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) $(CXX_DEFINES) -g \ | 85 -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) $(CXX_DEFINES) -g \ |
86 $(HOST_FLAGS) -Wno-error=unused-parameter \ | 86 $(HOST_FLAGS) -Wno-error=unused-parameter \ |
87 -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 | 87 -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
88 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib | 88 LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib |
89 | 89 |
90 SRCS = \ | 90 SRCS = \ |
91 assembler.cpp \ | 91 assembler.cpp \ |
92 assembler_ia32.cpp \ | 92 assembler_ia32.cpp \ |
93 IceCfg.cpp \ | 93 IceCfg.cpp \ |
94 IceCfgNode.cpp \ | 94 IceCfgNode.cpp \ |
| 95 IceELFObjectWriter.cpp \ |
| 96 IceELFSection.cpp \ |
95 IceGlobalContext.cpp \ | 97 IceGlobalContext.cpp \ |
96 IceGlobalInits.cpp \ | 98 IceGlobalInits.cpp \ |
97 IceInst.cpp \ | 99 IceInst.cpp \ |
98 IceInstX8632.cpp \ | 100 IceInstX8632.cpp \ |
99 IceIntrinsics.cpp \ | 101 IceIntrinsics.cpp \ |
100 IceLiveness.cpp \ | 102 IceLiveness.cpp \ |
101 IceMemoryRegion.cpp \ | |
102 IceOperand.cpp \ | 103 IceOperand.cpp \ |
103 IceRegAlloc.cpp \ | 104 IceRegAlloc.cpp \ |
104 IceRNG.cpp \ | 105 IceRNG.cpp \ |
105 IceTargetLowering.cpp \ | 106 IceTargetLowering.cpp \ |
106 IceTargetLoweringX8632.cpp \ | 107 IceTargetLoweringX8632.cpp \ |
107 IceTimerTree.cpp \ | 108 IceTimerTree.cpp \ |
108 IceTranslator.cpp \ | 109 IceTranslator.cpp \ |
109 IceTypeConverter.cpp \ | 110 IceTypeConverter.cpp \ |
110 IceTypes.cpp \ | 111 IceTypes.cpp \ |
111 llvm2ice.cpp \ | 112 llvm2ice.cpp \ |
112 PNaClTranslator.cpp | 113 PNaClTranslator.cpp |
113 | 114 |
114 ifndef MINIMAL | 115 ifndef MINIMAL |
115 SRCS += IceConverter.cpp | 116 SRCS += IceConverter.cpp |
116 endif | 117 endif |
117 | 118 |
118 OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS)) | 119 OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS)) |
119 | 120 |
| 121 UNITTEST_SRCS = \ |
| 122 IceELFSectionTest.cpp |
| 123 |
| 124 UNITTEST_OBJS = $(patsubst %.cpp, $(OBJDIR)/unittest/%.o, $(UNITTEST_SRCS)) |
| 125 UNITTEST_LIB_OBJS = $(filter-out $(OBJDIR)/llvm2ice.o,$(OBJS)) |
| 126 |
120 # Keep all the first target so it's the default. | 127 # Keep all the first target so it's the default. |
121 all: $(OBJDIR)/llvm2ice make_symlink | 128 all: $(OBJDIR)/llvm2ice make_symlink |
122 | 129 |
123 # Creates symbolic link so that testing is easier. Also runs | 130 # Creates symbolic link so that testing is easier. Also runs |
124 # llvm2ice to verify that the defines flags have valid values, | 131 # llvm2ice to verify that the defines flags have valid values, |
125 # as well as describe the corresponding build attributes. | 132 # as well as describe the corresponding build attributes. |
126 make_symlink: $(OBJDIR)/llvm2ice | 133 make_symlink: $(OBJDIR)/llvm2ice |
127 rm -rf llvm2ice | 134 rm -rf llvm2ice |
128 ln -s $(OBJDIR)/llvm2ice | 135 ln -s $(OBJDIR)/llvm2ice |
129 @echo "Build Attributes:" | 136 @echo "Build Attributes:" |
130 @$(OBJDIR)/llvm2ice --build-atts | 137 @$(OBJDIR)/llvm2ice --build-atts |
131 | 138 |
132 .PHONY: all make_symlink | 139 .PHONY: all make_symlink |
133 | 140 |
134 # TODO(kschimpf): Fix python scripts to directly get build attributes | 141 # TODO(kschimpf): Fix python scripts to directly get build attributes |
135 # rather than generating $(OBJDIR)/llvm2ice.build_atts. | 142 # rather than generating $(OBJDIR)/llvm2ice.build_atts. |
136 $(OBJDIR)/llvm2ice: $(OBJS) | 143 $(OBJDIR)/llvm2ice: $(OBJS) |
137 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ | 144 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) \ |
138 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) | 145 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
139 | 146 |
140 # TODO: Be more precise than "*.h" here and elsewhere. | 147 # TODO: Be more precise than "*.h" here and elsewhere. |
141 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def | 148 $(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def |
142 $(CXX) -c $(CXXFLAGS) $< -o $@ | 149 $(CXX) -c $(CXXFLAGS) $< -o $@ |
143 | 150 |
| 151 $(OBJDIR)/run_unittests: $(UNITTEST_OBJS) $(UNITTEST_LIB_OBJS) |
| 152 $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -lgtest -lgtest_main -ldl \ |
| 153 -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
| 154 |
| 155 $(UNITTEST_OBJS): $(OBJDIR)/unittest/%.o: unittest/%.cpp |
| 156 $(CXX) -c $(CXXFLAGS) \ |
| 157 -Isrc/ \ |
| 158 -I$(LLVM_SRC_PATH)/utils/unittest/googletest/include \ |
| 159 -DGTEST_HAS_RTTI=0 -DGTEST_USE_OWN_TR1_TUPLE \ |
| 160 $< -o $@ |
| 161 |
144 $(OBJS): | $(OBJDIR) | 162 $(OBJS): | $(OBJDIR) |
145 | 163 |
| 164 $(UNITTEST_OBJS): | $(OBJDIR)/unittest |
| 165 |
146 $(OBJDIR): | 166 $(OBJDIR): |
147 @mkdir -p $@ | 167 @mkdir -p $@ |
148 | 168 |
| 169 $(OBJDIR)/unittest: $(OBJDIR) |
| 170 @mkdir -p $@ |
| 171 |
149 check-lit: llvm2ice make_symlink | 172 check-lit: llvm2ice make_symlink |
150 LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ | 173 LLVM_BIN_PATH=$(LLVM_BIN_PATH) \ |
151 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit | 174 $(LLVM_SRC_PATH)/utils/lit/lit.py -sv tests_lit |
152 | 175 |
| 176 check-unit: $(OBJDIR)/run_unittests |
| 177 $(OBJDIR)/run_unittests |
| 178 |
153 ifdef MINIMAL | 179 ifdef MINIMAL |
154 check: check-lit | 180 check: check-lit check-unit |
155 @echo "Crosstests ignored, minimal build" | 181 @echo "Crosstests ignored, minimal build" |
156 else | 182 else |
157 check: check-lit | 183 check: check-lit check-unit |
158 (cd crosstest; ./runtests.sh) | 184 (cd crosstest; ./runtests.sh) |
159 endif | 185 endif |
160 | 186 |
161 # TODO: Fix the use of wildcards. | 187 # TODO: Fix the use of wildcards. |
162 # Assumes clang-format is within $PATH. | 188 # Assumes clang-format is within $PATH. |
163 format: | 189 format: |
164 clang-format -style=LLVM -i src/*.h src/*.cpp | 190 clang-format -style=LLVM -i src/*.h src/*.cpp |
165 | 191 |
166 # Assumes clang-format-diff.py is within $PATH, and that the | 192 # Assumes clang-format-diff.py is within $PATH, and that the |
167 # clang-format it calls is also within $PATH. This may require adding | 193 # clang-format it calls is also within $PATH. This may require adding |
168 # a component to $PATH, or creating symlinks within some existing | 194 # a component to $PATH, or creating symlinks within some existing |
169 # $PATH component. Uses the one in /usr/lib/clang-format/ if it | 195 # $PATH component. Uses the one in /usr/lib/clang-format/ if it |
170 # exists. | 196 # exists. |
171 ifeq (,$(wildcard /usr/lib/clang-format/clang-format-diff.py)) | 197 ifeq (,$(wildcard /usr/lib/clang-format/clang-format-diff.py)) |
172 CLANG_FORMAT_DIFF = clang-format-diff.py | 198 CLANG_FORMAT_DIFF = clang-format-diff.py |
173 else | 199 else |
174 CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py | 200 CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py |
175 endif | 201 endif |
176 format-diff: | 202 format-diff: |
177 git diff -U0 `git merge-base HEAD master` | \ | 203 git diff -U0 `git merge-base HEAD master` | \ |
178 $(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i | 204 $(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i |
179 | 205 |
180 clean: | 206 clean: |
181 rm -rf llvm2ice *.o $(OBJDIR) | 207 rm -rf llvm2ice *.o $(OBJDIR) |
182 | 208 |
183 clean-all: clean | 209 clean-all: clean |
184 rm -rf build/ | 210 rm -rf build/ |
OLD | NEW |