header.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* ----- header.c ----- */
  2. //#include <stdlib.h>
  3. #include <stdio.h>
  4. //#include <string.h>
  5. #include <ctype.h>
  6. #include <errno.h>
  7. #include <stdarg.h>
  8. #include <signal.h>
  9. #include <unistd.h>
  10. #include <sys/prctl.h>
  11. #include <pty.h>
  12. #include <fcntl.h>
  13. #include <fnmatch.h>
  14. #include <dirent.h>
  15. #include <libgen.h>
  16. #include <sys/stat.h>
  17. #include <sys/types.h>
  18. #include <sys/wait.h>
  19. #include <sys/sysinfo.h>
  20. // link with -lutil
  21. // list all <header> files in use
  22. //egrep -ro '^\s*#\s*include\s+<(.*)>' src/ | sed -e 's/^.*<\(.*\)>.*$/\1/'
  23. #define PP_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, N, ...) N
  24. #define PP_RSEQ_N() 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
  25. #define PP_NARG_(...) PP_ARG_N(__VA_ARGS__)
  26. #define PP_NARG(...) PP_NARG_(__VA_ARGS__, PP_RSEQ_N())
  27. char** g_gcc_opts_list;
  28. char* g_gcc_opts_flat;
  29. char* g_gcc_include;
  30. char* g_gcc_libs;
  31. int g_nprocs;
  32. struct strlist;
  33. typedef struct objfile {
  34. // user config
  35. char** sources;
  36. char** debug_cflags;
  37. char** release_cflags;
  38. char** profiling_cflags;
  39. char** common_cflags;
  40. char** libs_needed;
  41. char** lib_headers_needed;
  42. char** ld_add;
  43. char* source_dir;// "src"
  44. char* exe_path; // the executable name
  45. char* base_build_dir; // = "build";
  46. // returns a dup'd string with the full, raw command to execute
  47. char* (*compile_source_cmd)(char* src_path, char* obj_path, struct objfile* obj);
  48. char mode_debug;
  49. char mode_profiling;
  50. char mode_release;
  51. char clean_first;
  52. char verbose;
  53. // internally calculated
  54. char** gcc_opts_list;
  55. char* gcc_opts_flat;
  56. char* gcc_include;
  57. char* gcc_libs;
  58. char* build_dir; // full build path, including debug/release options
  59. char* build_subdir;
  60. strlist objs; // .o's to be created
  61. strlist compile_cache; // list of compile commands to run
  62. char* archive_path; // temporary .a during build process
  63. } objfile;
  64. /* -END- header.c ----- */