Add 'tags' target to Makefile

The 'make tags' indexes all the header and source files known to the
Makefile, and also all the non-standard library headers used for
compiling, such as libsodium, JNI and Android NDK.

This supports the sp-mktags utility in serval-tools, which tries "make
tags" before falling back to its own ctags command.
This commit is contained in:
Andrew Bettison 2017-09-18 16:04:16 +09:30
parent 8e69bd8a6c
commit ad676ad678

View File

@ -109,7 +109,8 @@ clean:
libservaldaemon.so libservaldaemon.a \
libservalclient.so libservalclient.a \
libmonitorclient.so libmonitorclient.a \
tfw_createfile directory_service fakeradio simulator serval-tests
tfw_createfile directory_service fakeradio simulator serval-tests \
tags
# Only provide Java targets if the Java compiler is available.
ifneq ($(JAVAC),)
@ -309,6 +310,15 @@ libmonitorclient.so: $(MONITOR_CLIENT_OBJS) $(OBJSDIR_TOOLS)/version.o
@echo LINK $@
@$(CC) -Wall -shared -o $@ $^ $(LDFLAGS)
# The tags will always index all the Serval DNA headers and source files. If
# serval-tools is installed, then it will also index all the libsodium, JNI
# and Android NDK header files.
tags: Makefile $(HDRS) $(ALL_SOURCES)
{ for file in $(HDRS) $(ALL_SOURCES); do echo "$$file"; done; \
sp-find-gcc-headers $(CFLAGS) 2>/dev/null; \
ndk_prefix=$$(sp-ndk-prefix . 2>/dev/null) && find "$$ndk_prefix/arch-arm/usr/include" -type f; \
} | ctags -L- -f $@ --tag-relative=yes --c-kinds=defgmpstuv
# Helpful target to update the COPYRIGHT.txt file by harvesting copyright
# information from the contents of all the source and header files. This
# should be run periodically and the results reviewed, manually adjusted and