Ticket #4195: Makefile-tags-targets_v2.patch

File Makefile-tags-targets_v2.patch, 2.4 KB (added by psprint, 3 years ago)

Added extra tags for #include macros

  • Makefile.am

    From 22fad061c612abb08c56e1d1c6ebd71d1cb59b63 Mon Sep 17 00:00:00 2001
    From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
    Date: Mon, 8 Feb 2021 23:08:35 -0600
    Subject: New utility make targets for tags.
    
    ---
     Makefile.am | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
     1 file changed, 48 insertions(+), 1 deletion(-)
    
    diff --git a/Makefile.am b/Makefile.am
    index f86f6ed38..196a474af 100644
    a b CONFIG_STATUS_DEPENDENCIES = $(top_srcdir)/version.h 
    2525        cppcheck-portability \ 
    2626        cppcheck-style \ 
    2727        cppcheck-warning \ 
    28         cppcheck-all 
     28        cppcheck-all \ 
     29        tags \ 
     30        tags-emacs \ 
     31        tags-vim 
    2932 
     33# Invoke a ctags utility to generate Emacs and Vim's format tag file. 
     34# The meaning of the flags: 
     35# - `p` kind enables function prototypes, 
     36# - `x` kind enables extern and forward variable declarations, 
     37# - `S` field enables function signatures, 
     38# - `properties` field enables static, volatile, etc. properties, 
     39# - `macrodef` field enables macro definitions. 
     40# 
     41# Generate two formats at once: Emacs and Vim's. 
     42tags: tags-emacs tags-vim 
     43 
     44# Build only the Emacs-style `TAGS` file. 
     45tags-emacs: 
     46        @if type ctags >/dev/null 2>&1; then \ 
     47                if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \ 
     48                        ctags -e -R --languages=C --langmap=C:.h.c --c-kinds=+px \ 
     49                            --fields=+S --fields-c=+"{properties}" --fields-c=+"{macrodef}" \ 
     50                            --extras=+qr; \ 
     51                else \ 
     52                        ctags -e -R --languages=C --langmap=C:.h.c --c-kinds=+px \ 
     53                            --fields=+S; \ 
     54                fi; \ 
     55                printf "Created the Emacs \`TAGS\` file.\\n"; \ 
     56        else \ 
     57            printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \ 
     58            'version) utility first.\n'; \ 
     59        fi 
     60 
     61# Build only the Vim-style `tags` file. 
     62tags-vim: 
     63        @if type ctags >/dev/null 2>&1; then \ 
     64                if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \ 
     65                        ctags -R --languages=C --langmap=C:.h.c --c-kinds=+px \ 
     66                            --fields=+S --fields-c=+"{properties}" --fields-c=+"{macrodef}" \ 
     67                            --extras=+qr; \ 
     68                else \ 
     69                        ctags -R --languages=C --langmap=C:.h.c --c-kinds=+px \ 
     70                            --fields=+S; \ 
     71                fi; \ 
     72                printf "Created the Vim's style \`tags\` file.\\n"; \ 
     73        else \ 
     74            printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \ 
     75            'version) utility first.\n'; \ 
     76        fi 
    3077 
    3178update-version: 
    3279        @if test -x $(top_srcdir)/maint/utils/version.sh; then \