blob: 45ee63891c8a58ae3a2a677c3af26102a66e9a1f [file] [log] [blame]
Mikhail Glushenkov163dc1e2008-05-30 06:16:32 +00001// A (first stab at a) replacement for the Clang's ccc script.
2// To compile, use this command:
3// make TOOLNAME=ccc GRAPH=examples/Clang.td
4
5include "Common.td"
6
7// TOFIX: It should be possible to use a string list in the 'in_language'
8// tool property. There should be also an 'in_language' test in the
9// 'case' construct.
10
11def clang : Tool<
12[(in_language "c"),
13 (out_language "llvm-bitcode"),
14 (output_suffix "bc"),
15 (cmd_line (case (switch_on "E"), "clang -E $INFILE -o $OUTFILE",
16 (default), "clang -emit-llvm-bc $INFILE -o $OUTFILE")),
17 (switch_option "E", (stop_compilation), (output_suffix "i"),
18 (help "Stop after the preprocessing stage, do not run the compiler")),
19 (sink)
20]>;
21
22// Default linker
23def llvm_ld : Tool<
24[(in_language "llvm-bitcode"),
25 (out_language "executable"),
26 (output_suffix "out"),
27 (cmd_line "llvm-ld -native -disable-internalize $INFILE -o $OUTFILE"),
28 (prefix_list_option "L", (forward), (help "Specify a library search path")),
29 (join)
30]>;
31
32// Language map
33
34def LanguageMap : LanguageMap<
35 [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
36 LangToSuffixes<"c", ["c"]>,
37 LangToSuffixes<"objective-c", ["m"]>,
38 LangToSuffixes<"c-cpp-output", ["i"]>,
39 LangToSuffixes<"objective-c-cpp-output", ["mi"]>
40 ]>;
41
42// Compilation graph
43
44def CompilationGraph : CompilationGraph<[
45 Edge<root, clang>,
46 Edge<clang, llvm_ld>
47 ]>;
48