Debian Codegraph @

clang_delta/Makefile.am

raw ◀ ▶
1 Debian patch touch this file
1 ## -*- mode: Makefile-Automake -*-
2 ##
3 ## Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 The University of Utah
4 ## All rights reserved.
5 ##
6 ## This file is distributed under the University of Illinois Open Source
7 ## License. See the file COPYING for details.
8
9 ###############################################################################
10
11 libexec_PROGRAMS = clang_delta
12
13 GIT_HASH := $(shell "$(top_srcdir)/git-hash.sh" "$(top_srcdir)" || echo error)
14
15 DUMMY1 := $(shell echo "$(GIT_HASH)" > git_version.txt.tmp)
16 DUMMY2 := $(shell cmp -s git_version.txt.tmp git_version.txt || \
17 cp git_version.txt.tmp git_version.txt)
18 DUMMY3 := $(shell rm -f git_version.txt.tmp)
19
20 git_version_edit = sed \
21 -e 's|@GIT_HASH[@]|$(GIT_HASH)|g'
22
23 git_version.cpp: git_version.cpp.in git_version.txt
24 rm -f $@ [email protected]
25 srcdir=''; \
26 test -f ./[email protected] || srcdir=$(srcdir)/; \
27 $(git_version_edit) $${srcdir}[email protected] > [email protected]
28 mv [email protected] $@
29
30 # llvm-lit is not installed into LLVM_BINDIR. To run `make check-clang-delta',
31 # we have to manually copy llvm-lit from LLVM's build dir. This is also the
32 # reason that I didn't create a check-local rule for running clang_delta tests.
33 # It would fail everywhere else llvm-lit does exist, e.g. travis?
34 check-clang-delta: tests/lit.site.cfg tests/remove_lit_checks clang_delta
35 @ echo "--- Running tests for clang_delta ---"
36 @ $(LLVM_BINDIR)/llvm-lit -sv tests
37
38 tests/lit.site.cfg: tests/lit.site.cfg.in
39 @ echo s=@abs_builddir[@]=$(abs_builddir)=g > lit.site.cfg.tmp
40 @ echo s=@LLVM_BINDIR[@]=$(LLVM_BINDIR)=g >> lit.site.cfg.tmp
41 @ echo s=@clang_delta_srcdir@=$(abs_srcdir)=g >> lit.site.cfg.tmp
42 @ sed -f lit.site.cfg.tmp $< > $@
43 @ rm -f lit.site.cfg.tmp
44
45 tests/remove_lit_checks: tests/remove_lit_checks.in
46 @ echo s=@PERL_EXECUTABLE[@]=$(PERL)=g > remove_lit_checks.tmp
47 @ sed -f remove_lit_checks.tmp $< > $@
48 @ chmod +x $@
49 @ rm -f remove_lit_checks.tmp
50
51 # When setting `LLVMCXXFLAGS', we weed out command-line options that might be
52 # troublesome (e.g., -W/-f options that are not supported by `CXX', or -W
53 # options that turn warnings into errors). We also weed out options that might
54 # override choices that *we* want to control (e.g., debug and optimization
55 # options).
56 #
57 # The subparts of the `grep' invocation below remove compiler command-line
58 # options of the following forms:
59 # -W... --- warning options
60 # -w --- inhibits all warnings
61 # -pedantic... --- pedantic warning options
62 # -f...diagnostics... --- diagnostics reporting options (GCC, Clang)
63 # -f...show... --- diagnostics reporting options (Clang)
64 # -g... --- debugging options
65 # -O... --- optimization options
66 # [And for the llvm.org-provided binary of Clang 3.8.0 for OS X, weed out:]
67 # -isysroot
68 # /Applications/Xcode.app/...
69 #
70 # The `tr/sed | grep | xargs' pipeline is intended to be portable. We use
71 # `grep' for matching because writing fancy, portable `sed' expressions is
72 # difficult. For example, some implementations use "\b" to match word
73 # boundaries while others use "[[:<:]]" and "[[:>:]]". The Autoconf
74 # documentation says that anchored matches in `sed' are not portable. Give up;
75 # use `grep' instead. Bonus: better readability!
76 #
77 # The funny quoting in `LLVMLIBS' avoids a warning from Automake:
78 # ...: linker flags such as `--libs' belong in `clang_delta_LDFLAGS'
79 # The warning comes about because Automake doesn't understand $(shell).
80 # Avoid the warning by making `--ldflags' and `--libs' not look like
81 # linker options.
82 #
83 LLVMCXXFLAGS := $(shell \
84 "$(LLVM_CONFIG)" --cxxflags | \
85 tr '\t' ' ' | sed -e 's/ */ /g' | tr ' ' '\n' | \
86 grep -v -e '^-W' \
87 -e '^-w$$' \
88 -e '^-pedantic' \
89 -e '^-f[a-z-]*diagnostics' \
90 -e '^-f[a-z-]*show' \
91 -e '^-g' \
92 -e '^-O$$' \
93 -e '^-O[0-9s]' \
94 -e '^-isysroot$$' \
95 -e '^/Applications/Xcode\.app/.*\.sdk$$' | \
96 xargs) \
97 -fno-rtti -fno-exceptions
98 LLVMLDFLAGS := $(shell "$(LLVM_CONFIG)" \--ldflags)
99 LLVMINCLUDEDIR := $(shell "$(LLVM_CONFIG)" --includedir)
100 LLVMLIBS := $(shell "$(LLVM_CONFIG)" \--libs) \
101 $(shell "$(LLVM_CONFIG)" \--system-libs)
102
103 clang_delta_CPPFLAGS = \
104 $(CLANG_CPPFLAGS) \
105 -I"$(LLVMINCLUDEDIR)/clang"
106
107 clang_delta_CXXFLAGS = \
108 $(LLVMCXXFLAGS)
109
110 # See comment below about `clang_delta_LDADD' and `LLVMLDFLAGS'.
111 # clang_delta_LDFLAGS = \
112 # $(LLVMLDFLAGS)
113
114 # Try to do the "right thing" by putting these in `clang_delta_LDADD' instead
115 # of `clang_delta_LDFLAGS'. This leads to the funny escape in `LLVMLIBS',
116 # above, and the need to define `clang_delta_DEPENDENCIES', below.
117 #
118 # Pre LLVM-3.5, the output of `llvm-config --ldflags' would often contain
119 # library directives that must come *after* all the LLVM/Clang libraries on the
120 # link line: e.g., "-lpthread -lffi -ldl -lm". The easiest way to get these
121 # into the right place is to add `LLVMLDFLAGS' to `clang_delta_LDADD' --- *not*
122 # to `clang_delta_LDFLAGS'. Automake puts LDFLAGS early in the link line.
123 #
124 # Newer LLVM's (post-3.4) support `llvm-config --system-libs', which will
125 # possibly help us to straighten this out in the future.
126 #
127 # In LLVM 3.5, `llvm-config --ldflags' does not contain the list of system
128 # libraries. So probably, we could move `LLVMLDFLAGS' back to the definition
129 # of `clang_delta_LDFLAGS'. I'll do that later.
130 clang_delta_LDADD = \
131 -lclang-cpp \
132 $(LLVMLIBS) \
133 $(CLANG_LDFLAGS) \
•134 $(LLVMLDFLAGS) $(LIBATOMIC)
135
136 # Automake doesn't grok our use of $(shell) in `clang_delta_LDADD', so it puts
137 # $(LLVMLIBS) in the dependencies by default. To avoid this problem, we must
138 # define `clang_delta_DEPENDENCIES' explicitly.
139 #
140 clang_delta_DEPENDENCIES =
141
142 clang_delta_SOURCES = \
143 AggregateToScalar.cpp \
144 AggregateToScalar.h \
145 BinOpSimplification.cpp \
146 BinOpSimplification.h \
147 CallExprToValue.cpp \
148 CallExprToValue.h \
149 ClangDelta.cpp \
150 ClassTemplateToClass.cpp \
151 ClassTemplateToClass.h \
152 CombineGlobalVarDecl.cpp \
153 CombineGlobalVarDecl.h \
154 CombineLocalVarDecl.cpp \
155 CombineLocalVarDecl.h \
156 CommonParameterRewriteVisitor.h \
157 CommonRenameClassRewriteVisitor.h \
158 CommonStatementVisitor.h \
159 CommonTemplateArgumentVisitor.h \
160 CopyPropagation.cpp \
161 CopyPropagation.h \
162 EmptyStructToInt.cpp \
163 EmptyStructToInt.h \
164 ExpressionDetector.cpp \
165 ExpressionDetector.h \
166 InstantiateTemplateParam.cpp \
167 InstantiateTemplateParam.h \
168 InstantiateTemplateTypeParamToInt.cpp \
169 InstantiateTemplateTypeParamToInt.h \
170 LiftAssignmentExpr.cpp \
171 LiftAssignmentExpr.h \
172 LocalToGlobal.cpp \
173 LocalToGlobal.h \
174 MoveFunctionBody.cpp \
175 MoveFunctionBody.h \
176 MoveGlobalVar.cpp \
177 MoveGlobalVar.h \
178 ParamToGlobal.cpp \
179 ParamToGlobal.h \
180 ParamToLocal.cpp \
181 ParamToLocal.h \
182 ReduceArrayDim.cpp \
183 ReduceArrayDim.h \
184 ReduceArraySize.cpp \
185 ReduceArraySize.h \
186 ReduceClassTemplateParameter.cpp \
187 ReduceClassTemplateParameter.h \
188 ReducePointerLevel.cpp \
189 ReducePointerLevel.h \
190 ReducePointerPairs.cpp \
191 ReducePointerPairs.h \
192 RemoveAddrTaken.cpp \
193 RemoveAddrTaken.h \
194 RemoveArray.cpp \
195 RemoveArray.h \
196 RemoveBaseClass.cpp \
197 RemoveBaseClass.h \
198 RemoveCtorInitializer.cpp \
199 RemoveCtorInitializer.h \
200 RemoveEnumMemberValue.cpp \
201 RemoveEnumMemberValue.h \
202 RemoveNamespace.cpp \
203 RemoveNamespace.h \
204 RemoveNestedFunction.cpp \
205 RemoveNestedFunction.h \
206 RemovePointer.cpp \
207 RemovePointer.h \
208 RemoveTrivialBaseTemplate.cpp \
209 RemoveTrivialBaseTemplate.h \
210 RemoveUnresolvedBase.cpp \
211 RemoveUnresolvedBase.h \
212 RemoveUnusedEnumMember.cpp \
213 RemoveUnusedEnumMember.h \
214 RemoveUnusedFunction.cpp \
215 RemoveUnusedFunction.h \
216 RemoveUnusedOuterClass.cpp \
217 RemoveUnusedOuterClass.h \
218 RemoveUnusedStructField.cpp \
219 RemoveUnusedStructField.h \
220 RemoveUnusedVar.cpp \
221 RemoveUnusedVar.h \
222 RenameCXXMethod.cpp \
223 RenameCXXMethod.h \
224 RenameClass.cpp \
225 RenameClass.h \
226 RenameFun.cpp \
227 RenameFun.h \
228 RenameParam.cpp \
229 RenameParam.h \
230 RenameVar.cpp \
231 RenameVar.h \
232 ReplaceArrayAccessWithIndex.cpp \
233 ReplaceArrayAccessWithIndex.h \
234 ReplaceArrayIndexVar.cpp \
235 ReplaceArrayIndexVar.h \
236 ReplaceCallExpr.cpp \
237 ReplaceCallExpr.h \
238 ReplaceClassWithBaseTemplateSpec.cpp \
239 ReplaceClassWithBaseTemplateSpec.h \
240 ReplaceDependentName.cpp \
241 ReplaceDependentName.h \
242 ReplaceDependentTypedef.cpp \
243 ReplaceDependentTypedef.h \
244 ReplaceDerivedClass.cpp \
245 ReplaceDerivedClass.h \
246 ReplaceFunctionDefWithDecl.cpp \
247 ReplaceFunctionDefWithDecl.h \
248 ReplaceOneLevelTypedefType.cpp \
249 ReplaceOneLevelTypedefType.h \
250 ReplaceSimpleTypedef.cpp \
251 ReplaceSimpleTypedef.h \
252 ReplaceUndefinedFunction.cpp \
253 ReplaceUndefinedFunction.h \
254 ReturnVoid.cpp \
255 ReturnVoid.h \
256 RewriteUtils.cpp \
257 RewriteUtils.h \
258 SimpleInliner.cpp \
259 SimpleInliner.h \
260 SimplifyCallExpr.cpp \
261 SimplifyCallExpr.h \
262 SimplifyCommaExpr.cpp \
263 SimplifyCommaExpr.h \
264 SimplifyDependentTypedef.cpp \
265 SimplifyDependentTypedef.h \
266 SimplifyIf.cpp \
267 SimplifyIf.h \
268 SimplifyNestedClass.cpp \
269 SimplifyNestedClass.h \
270 SimplifyRecursiveTemplateInstantiation.cpp \
271 SimplifyRecursiveTemplateInstantiation.h \
272 SimplifyStruct.cpp \
273 SimplifyStruct.h \
274 SimplifyStructUnionDecl.cpp \
275 SimplifyStructUnionDecl.h \
276 TemplateArgToInt.cpp \
277 TemplateArgToInt.h \
278 TemplateNonTypeArgToInt.cpp \
279 TemplateNonTypeArgToInt.h \
280 Transformation.cpp \
281 Transformation.h \
282 TransformationManager.cpp \
283 TransformationManager.h \
284 UnifyFunctionDecl.cpp \
285 UnifyFunctionDecl.h \
286 UnionToStruct.cpp \
287 UnionToStruct.h \
288 VectorToArray.cpp \
289 VectorToArray.h \
290 git_version.h
291
292 nodist_clang_delta_SOURCES = \
293 git_version.cpp
294
295 CLEANFILES = \
296 git_version.txt \
297 git_version.txt.tmp \
298 git_version.cpp \
299 git_version.cpp.tmp \
300 tests/lit.site.cfg \
301 tests/remove_lit_checks
302
303 EXTRA_DIST = \
304 CMakeLists.txt \
305 README.txt \
306 git_version.cpp.in \
307 test_transformation \
308 tests/aggregate-to-scalar/cast.c \
309 tests/aggregate-to-scalar/test1.c \
310 tests/aggregate-to-scalar/test1.cc \
311 tests/aggregate-to-scalar/test2.c \
312 tests/aggregate-to-scalar/test2.cc \
313 tests/aggregate-to-scalar/test3.c \
314 tests/aggregate-to-scalar/test4.c \
315 tests/callexpr-to-value/macro1.c \
316 tests/callexpr-to-value/macro2.c \
317 tests/callexpr-to-value/test1.c \
318 tests/callexpr-to-value/test2.c \
319 tests/copy-propagation/copy1.cpp \
320 tests/copy-propagation/copy2.cpp \
321 tests/empty-struct-to-int/empty-struct.cpp \
322 tests/empty-struct-to-int/empty-struct2.cpp \
323 tests/empty-struct-to-int/empty-struct3.cpp \
324 tests/empty-struct-to-int/empty-struct4.cpp \
325 tests/empty-struct-to-int/empty-struct5.cpp \
326 tests/empty-struct-to-int/empty-struct6.c \
327 tests/empty-struct-to-int/empty-struct7.c \
328 tests/empty-struct-to-int/struct_int.c \
329 tests/empty-struct-to-int/test1.cc \
330 tests/empty-struct-to-int/test2.cc \
331 tests/empty-struct-to-int/test3.c \
332 tests/lit.cfg \
333 tests/lit.site.cfg.in \
334 tests/local-to-global/macro.c \
335 tests/local-to-global/unnamed_1.c \
336 tests/local-to-global/unnamed_2.c \
337 tests/local-to-global/unnamed_3.c \
338 tests/param-to-global/macro.c \
339 tests/reduce-array-dim/non-type-temp-arg.cpp \
340 tests/reduce-pointer-level/scalar-init-expr.cpp \
341 tests/remove-enum-member-value/builtin_macro.c \
342 tests/remove-namespace/macro.cpp \
343 tests/remove-namespace/namespace.cpp \
344 tests/remove-namespace/namespace10.cpp \
345 tests/remove-namespace/namespace11.cpp \
346 tests/remove-namespace/namespace12.cpp \
347 tests/remove-namespace/namespace13.cpp \
348 tests/remove-namespace/namespace14.cpp \
349 tests/remove-namespace/namespace15.cpp \
350 tests/remove-namespace/namespace2.cpp \
351 tests/remove-namespace/namespace3.cpp \
352 tests/remove-namespace/namespace4.cpp \
353 tests/remove-namespace/namespace5.cpp \
354 tests/remove-namespace/namespace6.cpp \
355 tests/remove-namespace/namespace7.cpp \
356 tests/remove-namespace/namespace8.cpp \
357 tests/remove-namespace/namespace9.cpp \
358 tests/remove-nested-function/remove_nested_func1.cc \
359 tests/remove-unused-field/designated1.c \
360 tests/remove-unused-field/designated2.c \
361 tests/remove-unused-field/designated3.c \
362 tests/remove-unused-field/designated4.c \
363 tests/remove-unused-field/designated5.c \
364 tests/remove-unused-field/unused_field1.c \
365 tests/remove-unused-field/unused_field2.c \
366 tests/remove-unused-field/unused_field3.cpp \
367 tests/remove-unused-function/class.cc \
368 tests/remove-unused-function/const.cc \
369 tests/remove-unused-function/default.cc \
370 tests/remove-unused-function/delete.cc \
371 tests/remove-unused-function/delete2.cc \
372 tests/remove-unused-function/inline_ns.cc \
373 tests/remove-unused-function/macro1.cc \
374 tests/remove-unused-function/macro2.cc \
375 tests/remove-unused-function/macro3.cc \
376 tests/remove-unused-function/template1.cc \
377 tests/remove-unused-function/template2.cc \
378 tests/remove-unused-function/unused-funcs.cc \
379 tests/remove-unused-var/struct1.c \
380 tests/remove-unused-var/struct2.c \
381 tests/remove-unused-var/unused_var.cpp \
382 tests/remove_lit_checks.in \
383 tests/rename-class/base_specifier.cpp \
384 tests/rename-class/bool.cc \
385 tests/rename-class/class_template.cc \
386 tests/rename-class/class_template2.cc \
387 tests/rename-class/dependent.cpp \
388 tests/rename-class/dependent_name.cpp \
389 tests/rename-class/derive.cc \
390 tests/rename-class/dtor.cc \
391 tests/rename-class/dtor1.cc \
392 tests/rename-class/elaborated_type1.cpp \
393 tests/rename-class/elaborated_type2.cpp \
394 tests/rename-class/explicit_specialization.cpp \
395 tests/rename-class/forward_decl.cc \
396 tests/rename-class/injected_name.cpp \
397 tests/rename-class/instantiation.cpp \
398 tests/rename-class/parm.cpp \
399 tests/rename-class/partial_specialization.cpp \
400 tests/rename-class/rename-class1.cpp \
401 tests/rename-class/rename-class2.cpp \
402 tests/rename-class/specialization.cpp \
403 tests/rename-class/static_member.cc \
404 tests/rename-class/template_class_1.cpp \
405 tests/rename-class/template_parm.cpp \
406 tests/rename-class/template_template.cpp \
407 tests/rename-class/template_template_parm.cpp \
408 tests/rename-class/typedef.cpp \
409 tests/rename-class/typedef2.cc \
410 tests/rename-class/using.cpp \
411 tests/rename-class/using1.cc \
412 tests/rename-cxx-method/overloaded.cc \
413 tests/rename-cxx-method/test1.cc \
414 tests/rename-cxx-method/test2.cc \
415 tests/rename-cxx-method/test3.cc \
416 tests/rename-fun/func_templ.cc \
417 tests/rename-fun/overloaded.cc \
418 tests/rename-fun/test1.c \
419 tests/rename-fun/test1.h \
420 tests/rename-param/invalid.c \
421 tests/rename-var/rename-var.c \
422 tests/replace-derived-class/replace-derived1.cpp \
423 tests/replace-derived-class/replace-derived2.cpp \
424 tests/replace-derived-class/replace-derived3.cpp \
425 tests/replace-derived-class/replace-derived4.cpp \
426 tests/replace-function-def-with-decl/macro1.c \
427 tests/replace-function-def-with-decl/macro2.c \
428 tests/return-void/test1.c \
429 tests/return-void/test1.cc \
430 tests/return-void/test2.c \
431 tests/return-void/test3.c \
432 tests/return-void/test4.c \
433 tests/return-void/test5.c \
434 tests/return-void/test6.c \
435 tests/simplify-callexpr/macro.c \
436 tests/simplify-callexpr/test.c \
437 tests/simplify-callexpr/test2.c \
438 tests/simplify-if/macro.c \
439 tests/union-to-struct/union1.c \
440 tests/union-to-struct/union2.c \
441 tests/union-to-struct/union3.c
442
443 CLEAN_TESTDIRS = $(sort $(dir $(wildcard tests/*/Output/.)))
444
445 clean-local:
446 list='$(CLEAN_TESTDIRS)'; \
447 for dir in $$list; do \
448 if test -d "$$dir"; then \
449 rm -rf $$dir; \
450 fi; \
451 done
452
453 ###############################################################################
454
455 ## End of file.