Consolidate and add files to clean target variables
Commit Message
To increase the consistency of how automatic clean targets run,
define the variables together without +=, default to MOSTLYCLEANFILES
when there is no need for different levels or
add more clean levels to match other subdirectories,
add more files that are built, remove duplication, and cleanup.
Do the same for EXTRA_DIST where it is equally messy.
* backends/Makefile.am: add more objects to clean, improve spacing.
* debuginfod/Makefile.am: Likewise, and remove duplicates.
* lib/Makefile.am: improve spacing.
* libasm/Makefile.am: add more objects to clean, split similar to debuginfod.
* libcpu/Makefile.am: use normal =, add more objects to clean.
* libdw/Makefile.am: add more objects to clean, split similar to debuginfod.
* libdwelf/Makefile.am: add more objects to clean, use lowest clean level.
* libdwfl/Makefile.am: Likewise.
* libebl/Makefile.am: add more objects to clean.
* libelf/Makefile.am: add more objects to clean, split similar to debuginfod.
* src/Makefile.am: consolidate including EXTRA_DIST, split clean levels,
define with normal =, define with variables.
* tests/Makefile.am: Likewise, but not including EXTRA_DIST.
Signed-off-by: Michael Pratt <mcpratt@pm.me>
---
backends/Makefile.am | 3 ++-
debuginfod/Makefile.am | 5 +++--
lib/Makefile.am | 1 +
libasm/Makefile.am | 4 +++-
libcpu/Makefile.am | 6 +++---
libdw/Makefile.am | 3 ++-
libdwelf/Makefile.am | 2 +-
libdwfl/Makefile.am | 2 +-
libebl/Makefile.am | 2 +-
libelf/Makefile.am | 3 ++-
src/Makefile.am | 10 +++++-----
tests/Makefile.am | 4 ++--
12 files changed, 26 insertions(+), 19 deletions(-)
Comments
Hi Michael,
On Wed, Oct 23, 2024 at 2:34 AM Michael Pratt <mcpratt@pm.me> wrote:
>
> To increase the consistency of how automatic clean targets run,
> define the variables together without +=, default to MOSTLYCLEANFILES
> when there is no need for different levels or
> add more clean levels to match other subdirectories,
> add more files that are built, remove duplication, and cleanup.
>
> Do the same for EXTRA_DIST where it is equally messy.
>
> * backends/Makefile.am: add more objects to clean, improve spacing.
> * debuginfod/Makefile.am: Likewise, and remove duplicates.
> * lib/Makefile.am: improve spacing.
> * libasm/Makefile.am: add more objects to clean, split similar to debuginfod.
> * libcpu/Makefile.am: use normal =, add more objects to clean.
> * libdw/Makefile.am: add more objects to clean, split similar to debuginfod.
> * libdwelf/Makefile.am: add more objects to clean, use lowest clean level.
> * libdwfl/Makefile.am: Likewise.
> * libebl/Makefile.am: add more objects to clean.
> * libelf/Makefile.am: add more objects to clean, split similar to debuginfod.
> * src/Makefile.am: consolidate including EXTRA_DIST, split clean levels,
> define with normal =, define with variables.
> * tests/Makefile.am: Likewise, but not including EXTRA_DIST.
>
> Signed-off-by: Michael Pratt <mcpratt@pm.me>
Thanks for the patch. Pushed.
Aaron
@@ -120,6 +120,7 @@ libebl_backends_pic_a_SOURCES =
am_libebl_backends_pic_a_OBJECTS = $(libebl_backends_a_SOURCES:.c=.os)
noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
+
EXTRA_DIST = $(modules:=_reloc.def)
-MOSTLYCLEANFILES = $(am_libebl_backends_pic_a_OBJECTS)
+MOSTLYCLEANFILES = $(am_libebl_backends_a_OBJECTS) $(am_libebl_backends_pic_a_OBJECTS)
@@ -125,8 +125,9 @@ uninstall: uninstall-am
endif
EXTRA_DIST = libdebuginfod.map
-MOSTLYCLEANFILES = $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME)
-CLEANFILES += $(am_libdebuginfod_pic_a_OBJECTS) libdebuginfod.so
+
+MOSTLYCLEANFILES = $(am_libdebuginfod_a_OBJECTS) $(am_libdebuginfod_pic_a_OBJECTS) $(LIBDEBUGINFOD_SONAME)
+CLEANFILES = libdebuginfod.so
# automake std-options override: arrange to pass LD_LIBRARY_PATH
installcheck-binPROGRAMS: $(bin_PROGRAMS)
@@ -41,4 +41,5 @@ noinst_HEADERS = fixedsizehash.h libeu.h system.h dynamicsizehash.h list.h \
eu-config.h color.h printversion.h bpf.h \
atomics.h stdatomic-fbsd.h dynamicsizehash_concurrent.h \
eu-search.h locks.h
+
EXTRA_DIST = dynamicsizehash.c dynamicsizehash_concurrent.c
@@ -84,6 +84,8 @@ uninstall: uninstall-am
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
noinst_HEADERS = libasmP.h symbolhash.h
+
EXTRA_DIST = libasm.map
-CLEANFILES += $(am_libasm_pic_a_OBJECTS) libasm.so libasm.so.$(VERSION)
+MOSTLYCLEANFILES = $(am_libasm_a_OBJECTS) $(am_libasm_pic_a_OBJECTS) libasm.so.$(VERSION)
+CLEANFILES = libasm.so
@@ -101,6 +101,6 @@ bpf_disasm_CFLAGS = -Wno-format-nonliteral
EXTRA_DIST = defs/i386
-MOSTLYCLEANFILES = $(am_libcpu_pic_a_OBJECTS)
-CLEANFILES += $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
-MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_dis.h)
+MOSTLYCLEANFILES = $(am_libcpu_a_OBJECTS) $(am_libcpu_pic_a_OBJECTS) $(i386_gendis_OBJECTS)
+CLEANFILES = $(foreach P,i386 x86_64,$P_defs $P.mnemonics)
+MAINTAINERCLEANFILES = $(foreach P,i386 x86_64, $P_defs $P_dis.h $P_parse.h)
@@ -152,5 +152,6 @@ noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
EXTRA_DIST = libdw.map
-MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) libdw.so libdw.so.$(VERSION)
+MOSTLYCLEANFILES = $(am_libdw_a_OBJECTS) $(am_libdw_pic_a_OBJECTS) libdw.so.$(VERSION)
+CLEANFILES = libdw.so
MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h
@@ -54,4 +54,4 @@ libeu = ../lib/libeu.a
libdwelf_pic_a_SOURCES =
am_libdwelf_pic_a_OBJECTS = $(libdwelf_a_SOURCES:.c=.os)
-CLEANFILES += $(am_libdwelf_pic_a_OBJECTS)
+MOSTLYCLEANFILES = $(am_libdwelf_a_OBJECTS) $(am_libdwelf_pic_a_OBJECTS)
@@ -94,4 +94,4 @@ am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os)
noinst_HEADERS = libdwflP.h
-CLEANFILES += $(am_libdwfl_pic_a_OBJECTS)
+MOSTLYCLEANFILES = $(am_libdwfl_a_OBJECTS) $(am_libdwfl_pic_a_OBJECTS)
@@ -61,4 +61,4 @@ am_libebl_pic_a_OBJECTS = $(libebl_a_SOURCES:.c=.os)
noinst_HEADERS = libebl.h libeblP.h ebl-hooks.h
-MOSTLYCLEANFILES = $(am_libebl_pic_a_OBJECTS)
+MOSTLYCLEANFILES = $(am_libebl_a_OBJECTS) $(am_libebl_pic_a_OBJECTS)
@@ -135,4 +135,5 @@ uninstall: uninstall-am
EXTRA_DIST = libelf.map
-CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so libelf.so.$(VERSION)
+MOSTLYCLEANFILES = $(am_libelf_a_OBJECTS) $(am_libelf_pic_a_OBJECTS) libelf.so.$(VERSION)
+CLEANFILES = libelf.so
@@ -39,11 +39,12 @@ noinst_LIBRARIES = libar.a
libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c
-EXTRA_DIST = arlib.h debugpred.h
-
bin_SCRIPTS = make-debug-archive
-EXTRA_DIST += make-debug-archive.in
-CLEANFILES += make-debug-archive
+
+EXTRA_DIST = arlib.h debugpred.h make-debug-archive.in
+
+MOSTLYCLEANFILES = *.gconv
+CLEANFILES = $(bin_SCRIPTS)
if BUILD_STATIC
libasm = ../libasm/libasm.a
@@ -122,7 +123,6 @@ installcheck-binPROGRAMS: $(bin_PROGRAMS)
done; \
done; rm -f c$${pid}_.???; exit $$bad
-CLEANFILES += *.gconv
make-debug-archive: $(srcdir)/make-debug-archive.in
$(AM_V_GEN)UNSTRIP=$(bindir)/`echo unstrip | sed '$(transform)'`; \
@@ -871,7 +871,6 @@ declfiles_LDADD = $(libdw)
# Don't include any -I CPPFLAGS. Except when we install our own elf.h.
# For the gelf test we do want our own libelf.h, but nothing else.
BUILT_SOURCES = libelf.h
-CLEANFILES += libelf.h
libelf.h: $(top_srcdir)/libelf/libelf.h
ln -s $< $@
if !INSTALL_ELFH
@@ -885,7 +884,8 @@ system_elf_libelf_test_LDADD = $(libelf)
system_elf_gelf_test_LDADD = $(libelf)
# A lock file used to make sure only one test dumps core at a time
-CLEANFILES += core-dump-backtrace.lock
+MOSTLYCLEANFILES = core-dump-backtrace.lock
+CLEANFILES = $(BUILT_SOURCES)
if GCOV
check: check-am coverage