From b9224daa41f24cf3d19d15dfd17b0c8cef774429 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 22 Apr 2013 13:46:13 +0200 Subject: [PATCH] backports: support make clean/mrproper The kernel's "make clean" will recurse into subdirectories, even into those that aren't enabled in Kconfig. Thus, the previous trick of changing symbols from CONFIG_* to IMPOSSIBLE_* doesn't work any more. Change this to comment out the lines instead and then support "make clean" and "make mrproper". Signed-off-by: Johannes Berg --- backport/Makefile | 7 +++++++ backport/Makefile.build | 6 +++++- backport/Makefile.real | 4 ++++ gentree.py | 4 ++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/backport/Makefile b/backport/Makefile index 5cb701691979..287b27de2848 100644 --- a/backport/Makefile +++ b/backport/Makefile @@ -29,6 +29,13 @@ export KLIB KLIB_BUILD BACKPORT_PWD KMODDIR KMODPATH_ARG default: @$(MAKE) modules +.PHONY: mrproper +mrproper: + @test -f .config && $(MAKE) clean || true + @rm -f .config + @rm -f .kernel_config_md5 Kconfig.versions Kconfig.kernel + @rm -f backport-include/backport/autoconf.h + .DEFAULT: @set -e ; test -f $(KERNEL_CONFIG) || ( \ echo "/--------------" ;\ diff --git a/backport/Makefile.build b/backport/Makefile.build index 3ac4350e0b63..d2090415cd52 100644 --- a/backport/Makefile.build +++ b/backport/Makefile.build @@ -1,6 +1,10 @@ -include .config +-include .config export .PHONY: modules modules: @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD) modules + +.PHONY: clean +clean: + @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD) clean diff --git a/backport/Makefile.real b/backport/Makefile.real index 243f904fbed1..e033d73b88ea 100644 --- a/backport/Makefile.real +++ b/backport/Makefile.real @@ -97,3 +97,7 @@ install: modules @echo Your backported driver modules should be installed now. @echo Reboot. @echo + +.PHONY: clean +clean: + @$(MAKE) -f Makefile.build clean diff --git a/gentree.py b/gentree.py index 5ae88706eaef..afe3645f59f9 100755 --- a/gentree.py +++ b/gentree.py @@ -520,12 +520,12 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, # groups -- 50 seemed safer and is still fast) regexes = [] for some_symbols in [disable_makefile[i:i + 50] for i in range(0, len(disable_makefile), 50)]: - r = '((CPTCFG|CONFIG)_(' + '|'.join([s for s in some_symbols]) + '))' + r = '^([^#].*((CPTCFG|CONFIG)_(' + '|'.join([s for s in some_symbols]) + ')))' regexes.append(re.compile(r, re.MULTILINE)) for f in maketree.get_makefiles(): data = open(f, 'r').read() for r in regexes: - data = r.sub(r'IMPOSSIBLE_\3', data) + data = r.sub(r'#\1', data) fo = open(f, 'w') fo.write(data) fo.close() -- 2.30.2