new: add nogen key to the target

This commit is contained in:
ngn
2024-05-04 20:29:35 +03:00
parent 9e8f57c175
commit dbaf581335
4 changed files with 27 additions and 21 deletions

View File

@ -107,8 +107,11 @@ int config_handler(void *data, const char *section, const char *key, const char
} else if (MATCHKEY("src")) {
config->t_last->src = strdup(value);
return 1;
} else if (MATCHKEY("requires")) {
clist_from_str(&config->t_last->requires, strdup(value));
} else if (MATCHKEY("require")) {
clist_from_str(&config->t_last->require, strdup(value));
return 1;
} else if (MATCHKEY("nogen")) {
config->t_last->nogen = eq((char *)value, "true");
return 1;
}

View File

@ -72,6 +72,9 @@ bool target_copy(target_t *t, bool fromdst) {
char *src = t->src, *dst = t->dst;
bool ret = false;
if (fromdst && t->nogen)
return true;
if (fromdst) {
src = t->dst;
dst = t->src;
@ -98,7 +101,7 @@ bool target_copy(target_t *t, bool fromdst) {
}
void target_init(target_t *t) {
clist_init(&t->requires);
clist_init(&t->require);
t->next = NULL;
t->name = NULL;
t->desc = NULL;
@ -111,7 +114,7 @@ void target_free(target_t *t) {
free(t->desc);
free(t->dst);
free(t->src);
clist_free(&t->requires);
clist_free(&t->require);
}
void target_print(target_t *t) {

View File

@ -3,12 +3,12 @@
typedef struct target {
struct target *next;
clist_t
requires;
char *name;
char *desc;
char *src;
char *dst;
clist_t require;
bool nogen;
char *name;
char *desc;
char *src;
char *dst;
} target_t;
bool target_is_valid(target_t *);