4 #include <ccan/compiler/compiler.h>
8 #define CCAN_COMPILER "cc"
11 #define CCAN_CFLAGS "-g -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wold-style-definition -Werror"
14 #define IDENT_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
15 "abcdefghijklmnopqrstuvwxyz" \
18 #define SPACE_CHARS " \f\n\r\t\v"
20 #define COVERAGE_CFLAGS "-fprofile-arcs -ftest-coverage"
22 /* This compiles up the _info file into a temporary. */
23 char *compile_info(const void *ctx, const char *dir);
25 /* This actually compiles and runs the info file to get dependencies. */
26 char **get_deps(const void *ctx, const char *dir, const char *style,
28 char *(*get_info)(const void *ctx, const char *dir));
30 /* This is safer: just looks for ccan/ strings in info */
31 char **get_safe_ccan_deps(const void *ctx, const char *dir, const char *style,
34 /* This also needs to compile the info file. */
35 char **get_libs(const void *ctx, const char *dir, bool recurse,
36 char *(*get_info)(const void *ctx, const char *dir));
39 /* If set, print all commands run, all output they give and exit status. */
40 extern bool tools_verbose;
41 char *talloc_basename(const void *ctx, const char *dir);
42 char *talloc_dirname(const void *ctx, const char *dir);
43 char *talloc_getcwd(const void *ctx);
44 bool PRINTF_FMT(4,5) run_command(const void *ctx,
45 unsigned int *time_ms,
47 const char *fmt, ...);
48 char *run_with_timeout(const void *ctx, const char *cmd,
49 bool *ok, unsigned *timeout_ms);
50 const char *temp_dir(const void *ctx);
51 bool move_file(const char *oldname, const char *newname);
55 * These all compile into a temporary dir, and return the filename.
56 * On failure they return NULL, and errmsg is set to compiler output.
58 /* If set, say what we're compiling to. */
59 extern bool compile_verbose;
60 /* Compile multiple object files into a single. */
61 char *link_objects(const void *ctx, const char *basename,
62 const char *objs, char **errmsg);
63 /* Compile a single C file to an object file. Returns false if fails. */
64 bool compile_object(const void *ctx, const char *cfile, const char *ccandir,
67 const char *outfile, char **output);
68 /* Compile and link single C file, with object files, libs, etc. */
69 bool compile_and_link(const void *ctx, const char *cfile, const char *ccandir,
71 const char *compiler, const char *cflags,
72 const char *libs, const char *outfile, char **output);
74 /* Returns a file in temp_dir() */
75 char *temp_file(const void *ctx, const char *extension, const char *srcname);
77 /* Default wait for run_command. Should never time out. */
78 extern const unsigned int default_timeout_ms;
80 /* Talloc destructor which unlinks file. */
81 int unlink_file_destructor(char *filename);
83 /* Get ccan/ top dir, given a directory within it. */
84 const char *find_ccan_dir(const char *base);
85 #endif /* CCAN_TOOLS_H */