]> git.ozlabs.org Git - ccan/blob - tools/tools.h
ed2f6bfb6e77442e9682f450d34db6b2cce6e93e
[ccan] / tools / tools.h
1 #ifndef CCAN_TOOLS_H
2 #define CCAN_TOOLS_H
3 #include <stdbool.h>
4
5 #define IDENT_CHARS     "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
6                         "abcdefghijklmnopqrstuvwxyz" \
7                         "01234567889_"
8
9 #define SPACE_CHARS     " \f\n\r\t\v"
10
11 /* FIXME: Remove some -I */
12 /* FIXME: Nested functions break with -Wmissing-prototypes -Wmissing-declarations */
13 #define CFLAGS "-g -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Werror -Iccan/ -I. -I.. -I../.."
14
15 /* This actually compiles and runs the info file to get dependencies. */
16 char **get_deps(const void *ctx, const char *dir, const char *name,
17                 bool recurse, char **infofile);
18
19 /* This is safer: just looks for ccan/ strings in info */
20 char **get_safe_ccan_deps(const void *ctx, const char *dir, const char *name,
21                           bool recurse, char **infofile);
22
23 /* This also needs to compile the info file. */
24 char **get_libs(const void *ctx, const char *dir,
25                 const char *name, unsigned int *num, char **infofile);
26
27 /* From tools.c */
28 char *talloc_basename(const void *ctx, const char *dir);
29 char *talloc_dirname(const void *ctx, const char *dir);
30 char *talloc_getcwd(const void *ctx);
31 char *run_command(const void *ctx, const char *fmt, ...);
32 char *temp_file(const void *ctx, const char *extension);
33
34 /* From compile.c.
35  *
36  * These all compile into a temporary dir, and return the filename.
37  * On failure they return NULL, and errmsg is set to compiler output.
38  */
39 /* Compile multiple object files into a single. */
40 char *link_objects(const void *ctx, const char *objs, char **errmsg);
41 /* Compile a single C file to an object file.  Returns errmsg if fails. */
42 char *compile_object(const void *ctx, const char *cfile, char **errmsg);
43 /* Compile and link single C file, with object files, libs, etc. */
44 char *compile_and_link(const void *ctx, const char *cfile, const char *objs,
45                        const char *extra_cflags, const char *libs,
46                        char **errmsg);
47 #endif /* CCAN_TOOLS_H */