RULE_ARRAY() to define deps with a static array
This commit is contained in:
17
gebs.h
17
gebs.h
@ -400,6 +400,21 @@ void gebs_rebuild_self1_alloc(Gebs_Allocator *alloc, int argc, char ** argv,
|
|||||||
__ok; \
|
__ok; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#define gebs_needs_rebuild_many_array(out, array) \
|
||||||
|
({ \
|
||||||
|
bool __ok = false; \
|
||||||
|
if (sizeof((array))/sizeof((array)[0]) == 0) { \
|
||||||
|
__ok = true; \
|
||||||
|
} \
|
||||||
|
for (size_t __i = 0; __i < sizeof((array))/sizeof((array)[0]); __i++) { \
|
||||||
|
if (gebs_needs_rebuild((out), (array)[__i])) { \
|
||||||
|
__ok = true; \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
__ok; \
|
||||||
|
})
|
||||||
|
|
||||||
#define gebs_make_compile_flags(...) \
|
#define gebs_make_compile_flags(...) \
|
||||||
do { \
|
do { \
|
||||||
if (gebs_needs_rebuild("compile_flags.txt", __FILE__)) { \
|
if (gebs_needs_rebuild("compile_flags.txt", __FILE__)) { \
|
||||||
@ -419,6 +434,7 @@ void gebs_rebuild_self1_alloc(Gebs_Allocator *alloc, int argc, char ** argv,
|
|||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define GEBS_RULE(target, ...) if (needs_rebuild_many(target, __VA_ARGS__))
|
#define GEBS_RULE(target, ...) if (needs_rebuild_many(target, __VA_ARGS__))
|
||||||
|
#define GEBS_RULE_ARRAY(target, array) if (gebs_needs_rebuild_many_array(target, (array)))
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Scratch arena
|
// Scratch arena
|
||||||
@ -1004,6 +1020,7 @@ void gebs_rebuild_self1_alloc(Gebs_Allocator *alloc, int argc, char ** argv,
|
|||||||
#define rebuild_self gebs_rebuild_self
|
#define rebuild_self gebs_rebuild_self
|
||||||
#define make_compile_flags gebs_make_compile_flags
|
#define make_compile_flags gebs_make_compile_flags
|
||||||
#define RULE GEBS_RULE
|
#define RULE GEBS_RULE
|
||||||
|
#define RULE_ARRAY GEBS_RULE_ARRAY
|
||||||
|
|
||||||
#define scratch_arena gebs_scratch_arena
|
#define scratch_arena gebs_scratch_arena
|
||||||
#define fmt gebs_fmt
|
#define fmt gebs_fmt
|
||||||
|
Reference in New Issue
Block a user