Ticket #4195: Makefile-tags-targets.patch

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

    From b5fdd14c361b579b38db9da8659c3b531ce06d32 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 | 47 ++++++++++++++++++++++++++++++++++++++++++++++-
     1 file changed, 46 insertions(+), 1 deletion(-)
    
    diff --git a/Makefile.am b/Makefile.am
    index f86f6ed38..4b9196ad0 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                else \ 
     51                        ctags -e -R --languages=C --langmap=C:.h.c --c-kinds=+px \ 
     52                            --fields=+S; \ 
     53                fi; \ 
     54                printf "Created the Emacs \`TAGS\` file.\\n"; \ 
     55        else \ 
     56            printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \ 
     57            'version) utility first.\n'; \ 
     58        fi 
     59 
     60# Build only the Vim-style `tags` file. 
     61tags-vim: 
     62        @if type ctags >/dev/null 2>&1; then \ 
     63                if ctags --version | grep >/dev/null 2>&1 "Universal Ctags"; then \ 
     64                        ctags -R --languages=C --langmap=C:.h.c --c-kinds=+px \ 
     65                            --fields=+S --fields-c=+"{properties}" --fields-c=+"{macrodef}"; \ 
     66                else \ 
     67                        ctags -R --languages=C --langmap=C:.h.c --c-kinds=+px \ 
     68                            --fields=+S; \ 
     69                fi; \ 
     70                printf "Created the Vim's style \`tags\` file.\\n"; \ 
     71        else \ 
     72            printf 'Error: Please install a Ctags (e.g.: either the Exuberant or Universal %b' \ 
     73            'version) utility first.\n'; \ 
     74        fi 
    3075 
    3176update-version: 
    3277        @if test -x $(top_srcdir)/maint/utils/version.sh; then \