diff --git a/gebs.h b/gebs.h index 59099ef..2e566fe 100644 --- a/gebs.h +++ b/gebs.h @@ -272,6 +272,24 @@ void gebs_rebuild_self1_alloc(Gebs_Allocator *alloc, int argc, char ** argv, __ok; \ }) +#define gebs_make_compile_flags(...) \ + do { \ + if (!gebs_exists("compile_flags.txt")) { \ + GEBS_LOGI("Creating compile_flags.txt\n"); \ + const char *__flags[] = { __VA_ARGS__ }; \ + FILE *__out = fopen("compile_flags.txt", "w"); \ + char __nl = '\n'; \ + if (__out != NULL) { \ + for (size_t __i = 0; __i < sizeof(__flags)/sizeof(__flags[0]); __i++) { \ + const char *__flag = __flags[__i]; \ + fwrite(__flag, strlen(__flag), 1, __out); \ + fwrite(&__nl, 1, 1, __out); \ + } \ + fclose(__out); \ + } \ + } \ + } while(0) + // ---------------------------------------------------------------------------- // Scratch arena // ----------------------------------------------------------------------------