From b2f225d6bff8201874bdc6fdcb8dff1bcf1b814f Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 23 Oct 2024 06:33:18 +0000 Subject: [PATCH] Consolidate and add files to clean target variables 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 --- 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(-) diff --git a/backends/Makefile.am b/backends/Makefile.am index 926464ae1..347dad52a 100644 --- a/backends/Makefile.am +++ b/backends/Makefile.am @@ -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) diff --git a/debuginfod/Makefile.am b/debuginfod/Makefile.am index 5ad4e188c..45b5339f4 100644 --- a/debuginfod/Makefile.am +++ b/debuginfod/Makefile.am @@ -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) diff --git a/lib/Makefile.am b/lib/Makefile.am index e324c18d1..50c8036ba 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -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 diff --git a/libasm/Makefile.am b/libasm/Makefile.am index 1e6b63e83..324fd095a 100644 --- a/libasm/Makefile.am +++ b/libasm/Makefile.am @@ -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 diff --git a/libcpu/Makefile.am b/libcpu/Makefile.am index 4ba1be56d..328352378 100644 --- a/libcpu/Makefile.am +++ b/libcpu/Makefile.am @@ -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) diff --git a/libdw/Makefile.am b/libdw/Makefile.am index 4b9c44137..62f4359e4 100644 --- a/libdw/Makefile.am +++ b/libdw/Makefile.am @@ -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 diff --git a/libdwelf/Makefile.am b/libdwelf/Makefile.am index a35a2873c..30abdf816 100644 --- a/libdwelf/Makefile.am +++ b/libdwelf/Makefile.am @@ -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) diff --git a/libdwfl/Makefile.am b/libdwfl/Makefile.am index 57c89604c..171bb368b 100644 --- a/libdwfl/Makefile.am +++ b/libdwfl/Makefile.am @@ -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) diff --git a/libebl/Makefile.am b/libebl/Makefile.am index d84e7ee2c..e94eaa7fb 100644 --- a/libebl/Makefile.am +++ b/libebl/Makefile.am @@ -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) diff --git a/libelf/Makefile.am b/libelf/Makefile.am index 2d3dbdf22..e91bcd6e9 100644 --- a/libelf/Makefile.am +++ b/libelf/Makefile.am @@ -138,4 +138,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 diff --git a/src/Makefile.am b/src/Makefile.am index 6bdf2dfbc..97a0c61aa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -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)'`; \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 6dc255a9b..44cbb8258 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -874,7 +874,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 @@ -888,7 +887,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 -- 2.39.5