diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-11-08 16:52:42 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-11-08 16:53:29 +0100 |
commit | 9070a9c1030c65bc181f1d00e7226167508059c4 (patch) | |
tree | b12564cfb738a95107ad60dfac211e13f3b7d4a7 | |
parent | 862e8bf8c63bd74b915798677f1894da11b2be60 (diff) |
build-sys: add make check-api-unused
-rw-r--r-- | Makefile.am | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am index 53685c11c2..a67f18b77a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4578,3 +4578,23 @@ check-api-docs: $(lib_LTLIBRARIES) man echo "‣ Symbol $$symbol() lacks documentation." ; \ fi ; \ done + +OBJECT_VARIABLES:=$(filter %_OBJECTS,$(.VARIABLES)) +ALL_OBJECTS:=$(foreach v,$(OBJECT_VARIABLES),$($(v))) + +defined: $(ALL_OBJECTS) + $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \ + nm -g --undefined-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \ + done | cut -c 20- | cut -d @ -f 1 | sort -u > $(builddir)/undefined + +undefined: + $(AM_V_GEN)for f in $(ALL_OBJECTS) ; do \ + nm -g --defined-only `echo $(builddir)/"$$f" | sed -e 's,\([^/]*\).lo$$,.libs/\1.o,'` ; \ + done | cut -c 20- | cut -d @ -f 1 | sort -u > $(builddir)/defined + +CLEANFILES += \ + defined \ + undefined + +check-api-unused: defined undefined + diff -u undefined defined | grep ^+ | grep -v ^+++ | cut -c2- |