tools.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. /* FIXME: Nested functions break with -Wmissing-prototypes -Wmissing-declarations */
  10. #define CFLAGS "-g -Wall -Wundef -Wstrict-prototypes -Wold-style-definition -Werror -Iccan/ -I. -I.. -I../.."
  11. /* This actually compiles and runs the info file to get dependencies. */
  12. char **get_deps(const void *ctx, const char *dir, const char *name,
  13. bool recurse, char **infofile);
  14. /* This is safer: just looks for ccan/ strings in info */
  15. char **get_safe_ccan_deps(const void *ctx, const char *dir, const char *name,
  16. bool recurse, char **infofile);
  17. /* This also needs to compile the info file. */
  18. char **get_libs(const void *ctx, const char *dir,
  19. const char *name, unsigned int *num, char **infofile);
  20. /* From tools.c */
  21. char *talloc_basename(const void *ctx, const char *dir);
  22. char *talloc_dirname(const void *ctx, const char *dir);
  23. char *talloc_getcwd(const void *ctx);
  24. char *run_command(const void *ctx, const char *fmt, ...);
  25. char *temp_file(const void *ctx, const char *extension);
  26. /* From compile.c.
  27. *
  28. * These all compile into a temporary dir, and return the filename.
  29. * On failure they return NULL, and errmsg is set to compiler output.
  30. */
  31. /* Compile multiple object files into a single. */
  32. char *link_objects(const void *ctx, const char *objs, char **errmsg);
  33. /* Compile a single C file to an object file. Returns errmsg if fails. */
  34. char *compile_object(const void *ctx, const char *cfile, char **errmsg);
  35. /* Compile and link single C file, with object files, libs, etc. */
  36. char *compile_and_link(const void *ctx, const char *cfile, const char *objs,
  37. const char *extra_cflags, const char *libs,
  38. char **errmsg);
  39. #endif /* CCAN_TOOLS_H */