From fe2c4f1cf7ba1154f06af7e99f902dddcfbe99c8 Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Sun, 25 May 2025 22:48:37 +0200 Subject: [PATCH] Auto generate compile_flags.txt for clang tools --- gebs.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 // ----------------------------------------------------------------------------