From dbaf581335547eb7fd7b078a536aa8e8c1675d7a Mon Sep 17 00:00:00 2001 From: ngn Date: Sat, 4 May 2024 20:29:35 +0300 Subject: [PATCH] new: add nogen key to the target --- locale/tr/LC_MESSAGES/mc.po | 22 +++++++++++----------- src/config.c | 7 +++++-- src/target.c | 7 +++++-- src/target.h | 12 ++++++------ 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/locale/tr/LC_MESSAGES/mc.po b/locale/tr/LC_MESSAGES/mc.po index f19b3da..436cf71 100644 --- a/locale/tr/LC_MESSAGES/mc.po +++ b/locale/tr/LC_MESSAGES/mc.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-02 23:20+0300\n" +"POT-Creation-Date: 2024-05-04 20:25+0300\n" "PO-Revision-Date: 2024-05-01 13:34+0300\n" "Last-Translator: \n" "Language-Team: Turkish \n" @@ -33,32 +33,32 @@ msgstr "" msgid "Configuration contains multiple targets with the same name" msgstr "" -#: src/config.c:116 +#: src/config.c:119 #, c-format msgid "Key %s is unknown" msgstr "" -#: src/config.c:146 +#: src/config.c:149 msgid "Configuration file not found" msgstr "" -#: src/config.c:161 +#: src/config.c:164 msgid "Failed to parse configuration file" msgstr "" -#: src/config.c:177 +#: src/config.c:180 msgid "Configuration details:\n" msgstr "" -#: src/config.c:178 src/target.c:119 +#: src/config.c:181 src/target.c:122 msgid "Name" msgstr "" -#: src/config.c:179 +#: src/config.c:182 msgid "Author" msgstr "" -#: src/config.c:181 +#: src/config.c:184 msgid "Keywords" msgstr "" @@ -224,16 +224,16 @@ msgstr "" msgid "Failed to open the directory: %s" msgstr "" -#: src/target.c:81 +#: src/target.c:84 #, c-format msgid "Source directory \"%s\" does not exist" msgstr "" -#: src/target.c:118 +#: src/target.c:121 msgid "Target details:\n" msgstr "" -#: src/target.c:120 +#: src/target.c:123 msgid "Description" msgstr "" diff --git a/src/config.c b/src/config.c index 1b4a23f..c0b2532 100644 --- a/src/config.c +++ b/src/config.c @@ -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; } diff --git a/src/target.c b/src/target.c index c159bf5..ba8431d 100644 --- a/src/target.c +++ b/src/target.c @@ -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) { diff --git a/src/target.h b/src/target.h index 4f89449..b7577c7 100644 --- a/src/target.h +++ b/src/target.h @@ -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 *);