From 99284c4db9cbb5a8d2f0c8d16fd8490b1ea19bea Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 23 Nov 2018 21:24:44 +1100 Subject: [PATCH] Refine pylibfdt_clean target Move it to the subdir Makefile, generalize some of the patterns, remove the 'build' directory made by setup.py and __pycache__ directory made by Python3. Signed-off-by: David Gibson --- Makefile | 4 ---- pylibfdt/Makefile.pylibfdt | 9 ++++++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0edd9e4..4de1d81 100644 --- a/Makefile +++ b/Makefile @@ -271,10 +271,6 @@ include $(PYLIBFDT_srcdir)/Makefile.pylibfdt .PHONY: pylibfdt pylibfdt: $(PYLIBFDT_objdir)/_libfdt.so -pylibfdt_clean: - @$(VECHO) CLEAN "(pylibfdt)" - rm -f $(addprefix $(PYLIBFDT_objdir)/,$(PYLIBFDT_cleanfiles)) - # # Release signing and uploading # This is for maintainer convenience, don't try this at home. diff --git a/pylibfdt/Makefile.pylibfdt b/pylibfdt/Makefile.pylibfdt index f6abe02..ae8d0c8 100644 --- a/pylibfdt/Makefile.pylibfdt +++ b/pylibfdt/Makefile.pylibfdt @@ -3,6 +3,10 @@ PYLIBFDT_srcs = $(PYLIBFDT_srcdir)/libfdt.i PYMODULE = $(PYLIBFDT_objdir)/_libfdt.so +PYLIBFDT_CLEANFILES_L = libfdt_wrap.c libfdt.py *.pyc *.so +PYLIBFDT_CLEANFILES = $(PYLIBFDT_CLEANFILES_L:%=$(PYLIBFDT_objdir)/%) +PYLIBFDT_CLEANDIRS_L = build __pycache__ +PYLIBFDT_CLEANDIRS = $(PYLIBFDT_CLEANDIRS_L:%=$(PYLIBFDT_objdir)/%) SETUP = $(PYLIBFDT_srcdir)/setup.py SETUPFLAGS = @@ -19,4 +23,7 @@ install_pylibfdt: $(PYMODULE) @$(VECHO) INSTALL-PYLIB $(PYTHON) $(SETUP) $(SETUPFLAGS) install $(if $(SETUP_PREFIX),--prefix=$(SETUP_PREFIX)) -PYLIBFDT_cleanfiles = libfdt_wrap.c libfdt.py libfdt.pyc _libfdt.so +pylibfdt_clean: + @$(VECHO) CLEAN "(pylibfdt)" + rm -f $(PYLIBFDT_CLEANFILES) + rm -rf $(PYLIBFDT_CLEANDIRS)