diff options
Diffstat (limited to 'build_tools/menuselect.c')
-rw-r--r-- | build_tools/menuselect.c | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/build_tools/menuselect.c b/build_tools/menuselect.c index 68afeed44..62be208f7 100644 --- a/build_tools/menuselect.c +++ b/build_tools/menuselect.c @@ -70,9 +70,6 @@ static int existing_config = 0; /*! This is set when the --check-deps argument is provided. */ static int check_deps = 0; -/*! Force a clean of the source tree */ -static int force_clean = 0; - /*! \brief return a pointer to the first non-whitespace character */ static inline char *skip_blanks(char *str) { @@ -175,8 +172,7 @@ static int parse_makeopts_xml(const char *makeopts_xml) cat->displayname = mxmlElementGetAttr(cur, "displayname"); if ((tmp = mxmlElementGetAttr(cur, "positive_output"))) cat->positive_output = !strcasecmp(tmp, "yes"); - if ((tmp = mxmlElementGetAttr(cur, "force_clean_on_change"))) - cat->force_clean_on_change = !strcasecmp(tmp, "yes"); + cat->remove_on_change = mxmlElementGetAttr(cur, "remove_on_change"); if (add_category(cat)) { free(cat); @@ -193,8 +189,10 @@ static int parse_makeopts_xml(const char *makeopts_xml) mem->name = mxmlElementGetAttr(cur2, "name"); mem->displayname = mxmlElementGetAttr(cur2, "displayname"); + mem->remove_on_change = mxmlElementGetAttr(cur2, "remove_on_change"); + if (!cat->positive_output) - mem->enabled = 1; + mem->was_enabled = mem->enabled = 1; cur3 = mxmlFindElement(cur2, cur2, "defaultenabled", NULL, NULL, MXML_DESCEND); if (cur3 && cur3->child) @@ -348,7 +346,7 @@ static void mark_as_present(const char *member, const char *category) continue; AST_LIST_TRAVERSE(&cat->members, mem, list) { if (!strcmp(member, mem->name)) { - mem->enabled = cat->positive_output; + mem->was_enabled = mem->enabled = cat->positive_output; break; } } @@ -374,8 +372,6 @@ void toggle_enabled(struct category *cat, int index) if (mem && !(mem->depsfailed || mem->conflictsfailed)) { mem->enabled = !mem->enabled; - if (cat->force_clean_on_change) - force_clean = 1; } } @@ -507,6 +503,34 @@ static int generate_makeopts_file(void) fclose(f); + /* Traverse all categories and members and remove any files that are supposed + to be removed when an item has been changed */ + AST_LIST_TRAVERSE(&categories, cat, list) { + unsigned int had_changes = 0; + char *file, *buf; + + AST_LIST_TRAVERSE(&cat->members, mem, list) { + if (mem->enabled == mem->was_enabled) + continue; + + had_changes = 1; + + if (mem->remove_on_change) { + for (buf = strdupa(mem->remove_on_change), file = strsep(&buf, " "); + file; + file = strsep(&buf, " ")) + unlink(file); + } + } + + if (cat->remove_on_change && had_changes) { + for (buf = strdupa(cat->remove_on_change), file = strsep(&buf, " "); + file; + file = strsep(&buf, " ")) + unlink(file); + } + } + return 0; } @@ -522,7 +546,8 @@ static void dump_member_list(void) AST_LIST_TRAVERSE(&categories, cat, list) { fprintf(stderr, "Category: '%s'\n", cat->name); AST_LIST_TRAVERSE(&cat->members, mem, list) { - fprintf(stderr, " ==>> Member: '%s' (%s)\n", mem->name, mem->enabled ? "Enabled" : "Disabled"); + fprintf(stderr, " ==>> Member: '%s' (%s)", mem->name, mem->enabled ? "Enabled" : "Disabled"); + fprintf(stderr, " Was %s\n", mem->was_enabled ? "Enabled" : "Disabled"); AST_LIST_TRAVERSE(&mem->deps, dep, list) fprintf(stderr, " --> Depends on: '%s'\n", dep->name); if (!AST_LIST_EMPTY(&mem->deps)) @@ -701,11 +726,5 @@ int main(int argc, char *argv[]) free_trees(); free_member_list(); - /* In some cases, such as modifying the CFLAGS for the build, - * a "make clean" needs to be forced. Removing the .lastclean - * file does this. */ - if (force_clean) - unlink(".lastclean"); - exit(res); } |