diff mbox series

[XEN,v2,16/29] libs,tools/include: Clean "clean" targets

Message ID 20220225151321.44126-17-anthony.perard@citrix.com (mailing list archive)
State New, archived
Headers show
Series Toolstack build system improvement, toward non-recursive makefiles | expand

Commit Message

Anthony PERARD Feb. 25, 2022, 3:13 p.m. UTC
There is no need for an extra "cleanlocal" target, we can use
double-colon rules instead.

Generated headers are now in tools/include/, so remove those file
there.

Remove -f flag as it's already in $(RM).

libs.mk:
  - don't try to remove "*.rpm" anymore.

libs/light:
  - "_paths.*.tmp" isn't created anymore.
  - clean "libxenlight_test.so" and "libxl_test_*.opic".

libs/stat:
  - don't remove $(DEPS_RM) from here as it is already done in
    "libs.mk".

libs/util:
  - fix clean of version-script file.

include/xen-foreign:
  - remove __pycache__

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---

Notes:
    v2:
    - stop removing $(DEPS_RM) from libs/stat/Makefile.

 tools/include/Makefile             |  1 +
 tools/include/xen-foreign/Makefile |  1 +
 tools/libs/ctrl/Makefile           |  5 +----
 tools/libs/guest/Makefile          |  3 +--
 tools/libs/light/Makefile          | 19 ++++++++-----------
 tools/libs/stat/Makefile           |  8 ++------
 tools/libs/util/Makefile           |  7 ++-----
 tools/libs/vchan/Makefile          |  5 +----
 tools/libs/libs.mk                 |  4 ++--
 9 files changed, 19 insertions(+), 34 deletions(-)

Comments

Jürgen Groß March 3, 2022, 8:21 a.m. UTC | #1
On 25.02.22 16:13, Anthony PERARD wrote:
> There is no need for an extra "cleanlocal" target, we can use
> double-colon rules instead.
> 
> Generated headers are now in tools/include/, so remove those file
> there.
> 
> Remove -f flag as it's already in $(RM).
> 
> libs.mk:
>    - don't try to remove "*.rpm" anymore.
> 
> libs/light:
>    - "_paths.*.tmp" isn't created anymore.
>    - clean "libxenlight_test.so" and "libxl_test_*.opic".
> 
> libs/stat:
>    - don't remove $(DEPS_RM) from here as it is already done in
>      "libs.mk".
> 
> libs/util:
>    - fix clean of version-script file.
> 
> include/xen-foreign:
>    - remove __pycache__
> 
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> 
> Notes:
>      v2:
>      - stop removing $(DEPS_RM) from libs/stat/Makefile.
> 
>   tools/include/Makefile             |  1 +
>   tools/include/xen-foreign/Makefile |  1 +
>   tools/libs/ctrl/Makefile           |  5 +----
>   tools/libs/guest/Makefile          |  3 +--
>   tools/libs/light/Makefile          | 19 ++++++++-----------
>   tools/libs/stat/Makefile           |  8 ++------
>   tools/libs/util/Makefile           |  7 ++-----
>   tools/libs/vchan/Makefile          |  5 +----
>   tools/libs/libs.mk                 |  4 ++--
>   9 files changed, 19 insertions(+), 34 deletions(-)
> 
> diff --git a/tools/include/Makefile b/tools/include/Makefile
> index d965987f55..3a03a0b0fa 100644
> --- a/tools/include/Makefile
> +++ b/tools/include/Makefile
> @@ -82,6 +82,7 @@ uninstall:
>   clean:
>   	rm -rf xen xen-xsm acpi
>   	$(MAKE) -C xen-foreign clean
> +	rm -f _*.h

Use $(RM) instead? OTOH this could be done in a patch of its own
switching all rm -f instances to $(RM). Either way is fine with me, so:

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
Anthony PERARD March 3, 2022, 4 p.m. UTC | #2
On Thu, Mar 03, 2022 at 09:21:48AM +0100, Juergen Gross wrote:
> On 25.02.22 16:13, Anthony PERARD wrote:
> > diff --git a/tools/include/Makefile b/tools/include/Makefile
> > index d965987f55..3a03a0b0fa 100644
> > --- a/tools/include/Makefile
> > +++ b/tools/include/Makefile
> > @@ -82,6 +82,7 @@ uninstall:
> >   clean:
> >   	rm -rf xen xen-xsm acpi
> >   	$(MAKE) -C xen-foreign clean
> > +	rm -f _*.h
> 
> Use $(RM) instead? OTOH this could be done in a patch of its own
> switching all rm -f instances to $(RM).

This isn't really something that I think matter. Per GNU make's manual,
"rm" need to exist. Without it part of the build system could be broken.
Also setting $(RM) to something other than "rm -f" isn't going to work
well either. So whether we use $(RM) or `rm -f` shouldn't matter.

All of that to say that I'm not necessarily change one for the other. It
mostly depends on context.

Also, I might change those "clean:" rules later to collect files to
clean in a variable $(&CLEAN_FILES), when that will be possible.

> Reviewed-by: Juergen Gross <jgross@suse.com>

Thanks,
diff mbox series

Patch

diff --git a/tools/include/Makefile b/tools/include/Makefile
index d965987f55..3a03a0b0fa 100644
--- a/tools/include/Makefile
+++ b/tools/include/Makefile
@@ -82,6 +82,7 @@  uninstall:
 clean:
 	rm -rf xen xen-xsm acpi
 	$(MAKE) -C xen-foreign clean
+	rm -f _*.h
 
 .PHONY: dist
 dist: install
diff --git a/tools/include/xen-foreign/Makefile b/tools/include/xen-foreign/Makefile
index 6ce51daf5e..b538d0ea94 100644
--- a/tools/include/xen-foreign/Makefile
+++ b/tools/include/xen-foreign/Makefile
@@ -13,6 +13,7 @@  clean:
 	rm -f $(headers)
 	rm -f checker checker.c
 	rm -f *.pyc *.o *~
+	rm -rf __pycache__
 
 distclean: clean
 
diff --git a/tools/libs/ctrl/Makefile b/tools/libs/ctrl/Makefile
index ef7362327f..f58c4ef1aa 100644
--- a/tools/libs/ctrl/Makefile
+++ b/tools/libs/ctrl/Makefile
@@ -54,8 +54,5 @@  NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
+clean::
 	rm -f libxenctrl.map
diff --git a/tools/libs/guest/Makefile b/tools/libs/guest/Makefile
index 2005d8a67d..56483c545f 100644
--- a/tools/libs/guest/Makefile
+++ b/tools/libs/guest/Makefile
@@ -104,6 +104,5 @@  include $(XEN_ROOT)/tools/libs/libs.mk
 
 libxenguest.so.$(MAJOR).$(MINOR): LDLIBS += $(ZLIB_LIBS) -lz
 
-.PHONY: cleanlocal
-cleanlocal:
+clean::
 	rm -f libxenguest.map
diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index 769e2a83e2..0c04a5b5cb 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -246,15 +246,12 @@  install:: $(LIBHEADERS) libxl-save-helper
 uninstall::
 	rm -f $(DESTDIR)$(LIBEXEC_BIN)/libxl-save-helper
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
-	$(RM) -f _*.h *.o $(CLIENTS)
-	$(RM) -f _*.c *.pyc _paths.*.tmp _*.api-for-check
-	$(RM) -f testidl.c.new testidl.c *.api-ok
-	$(RM) -f $(TEST_PROGS)
-	$(RM) -rf __pycache__
-	$(RM) -f libxenlight.map
-	$(RM) -f $(AUTOSRCS) $(AUTOINCS)
+clean::
+	$(RM) _*.h *.o $(CLIENTS)
+	$(RM) _*.c *.pyc _*.api-for-check
+	$(RM) testidl.c.new testidl.c *.api-ok
+	$(RM) $(TEST_PROGS) libxenlight_test.so libxl_test_*.opic
+	$(RM) -r __pycache__
+	$(RM) libxenlight.map
+	$(RM) $(AUTOSRCS) $(AUTOINCS)
 	$(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean
diff --git a/tools/libs/stat/Makefile b/tools/libs/stat/Makefile
index 1aef25a9bb..39a671d7ed 100644
--- a/tools/libs/stat/Makefile
+++ b/tools/libs/stat/Makefile
@@ -115,9 +115,5 @@  install:: install-perl-bindings
 uninstall:: uninstall-perl-bindings
 endif
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
-	rm -f $(BINDINGS) $(BINDINGSRC) $(DEPS_RM)
-	rm -f libxenstat.map
+clean::
+	$(RM) libxenstat.map $(BINDINGS) $(BINDINGSRC)
diff --git a/tools/libs/util/Makefile b/tools/libs/util/Makefile
index 72fecb4c49..7a658e9446 100644
--- a/tools/libs/util/Makefile
+++ b/tools/libs/util/Makefile
@@ -49,8 +49,5 @@  $(LIB_OBJS) $(PIC_OBJS): $(AUTOINCS)
 	@rm -f $*.[ch]
 	$(FLEX) --header-file=$*.h --outfile=$*.c $<
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
-	$(RM) -f libxlutil.map
+clean::
+	$(RM) libxenutil.map
diff --git a/tools/libs/vchan/Makefile b/tools/libs/vchan/Makefile
index 83a45d2817..4ccb4dd1f6 100644
--- a/tools/libs/vchan/Makefile
+++ b/tools/libs/vchan/Makefile
@@ -12,8 +12,5 @@  NO_HEADERS_CHK := y
 
 include $(XEN_ROOT)/tools/libs/libs.mk
 
-clean: cleanlocal
-
-.PHONY: cleanlocal
-cleanlocal:
+clean::
 	rm -f libxenvchan.map
diff --git a/tools/libs/libs.mk b/tools/libs/libs.mk
index a173f59a8b..c2eaefc928 100644
--- a/tools/libs/libs.mk
+++ b/tools/libs/libs.mk
@@ -124,8 +124,8 @@  TAGS:
 	etags -t *.c *.h
 
 .PHONY: clean
-clean:
-	rm -rf *.rpm $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
+clean::
+	rm -rf $(LIB) *~ $(DEPS_RM) $(LIB_OBJS) $(PIC_OBJS)
 	rm -f lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR) lib$(LIB_FILE_NAME).so.$(MAJOR)
 	rm -f headers.chk headers.lst
 	rm -f $(PKG_CONFIG)