Auto generate compile_flags.txt for clang tools

This commit is contained in:
kamkow1
2025-05-25 22:48:37 +02:00
parent aad54edf84
commit fe2c4f1cf7

18
gebs.h
View File

@ -272,6 +272,24 @@ void gebs_rebuild_self1_alloc(Gebs_Allocator *alloc, int argc, char ** argv,
__ok; \ __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 // Scratch arena
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------