tools.h 1.8 KB

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