unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Yuri Volchkov <yuri.volchkov@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] build: generate cscope and etags source indexes
Date: Wed, 23 Aug 2017 22:55:40 +0200	[thread overview]
Message-ID: <1503521740-32330-1-git-send-email-yuri.volchkov@gmail.com> (raw)

Just a handy tool to generate source code indexes for your favorite
editor.

To make tags for vim run:
  $ make cscope
To make tags for emacs:
  $ make TAGS
To make both:
  $ make alltags

Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
---
 Makefile.local | 24 ++++++++++++++++++++++++
 configure      | 30 ++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)

diff --git a/Makefile.local b/Makefile.local
index af12ca7..15075bb 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -280,6 +280,30 @@ endif
 SRCS  := $(SRCS) $(notmuch_client_srcs)
 CLEAN := $(CLEAN) notmuch notmuch-shared $(notmuch_client_modules)
 CLEAN := $(CLEAN) version.stamp notmuch-*.tar.gz.tmp
+CLEAN := $(CLEAN) cscope.out TAGS
+
+.PHONY: alltags cscope
+alltags: cscope.out TAGS
+cscope: cscope.out
+
+ifeq ($(HAVE_CSCOPE),1)
+cscope.out: $(SRCS)
+	$(call quiet, CSCOPE) -b $(SRCS)
+else
+.PHONY: cscope.out
+cscope.out:
+	$(warning "$@ is not generated. Please make sure you have cscope installed")
+endif
+
+ifeq ($(HAVE_ETAGS),1)
+TAGS: $(SRCS)
+	@rm -f $@
+	$(call quiet, ETAGS) -a $(SRCS)
+else
+.PHONY: TAGS
+TAGS:
+	$(warning "$@ is not generated. Please make sure you have etags installed")
+endif
 
 DISTCLEAN := $(DISTCLEAN) .first-build-message Makefile.config sh.config
 
diff --git a/configure b/configure
index c5e2ffe..4467016 100755
--- a/configure
+++ b/configure
@@ -603,6 +603,24 @@ else
     have_emacs=0
 fi
 
+printf "Checking if cscope is available... "
+if cscope -V > /dev/null 2>&1; then
+    printf "Yes.\n"
+    have_cscope=1
+else
+    printf "No (so will not generate cscope code index - file cscope.out)\n"
+    have_cscope=0
+fi
+
+printf "Checking if etags is available... "
+if etags -V > /dev/null 2>&1; then
+    printf "Yes.\n"
+    have_etags=1
+else
+    printf "No (so will not generate etags code index - file TAGS)\n"
+    have_etags=0
+fi
+
 have_doxygen=0
 if [ $WITH_API_DOCS = "1" ] ; then
     printf "Checking if doxygen is available... "
@@ -1011,6 +1029,12 @@ WARN_CXXFLAGS=${WARN_CXXFLAGS}
 # Flags to enable warnings when using the C compiler
 WARN_CFLAGS=${WARN_CFLAGS}
 
+# Command to execute cscope from Makefiles
+CSCOPE = cscope
+
+# Command  to execute etags from Makefiles
+ETAGS = etags
+
 # Name of python interpreter
 PYTHON = ${python}
 
@@ -1046,6 +1070,12 @@ emacsetcdir=${EMACSETCDIR}
 # Whether there's an emacs binary available for byte-compiling
 HAVE_EMACS = ${have_emacs}
 
+# Whether there's a cscope available for source code indexing (development only)
+HAVE_CSCOPE = ${have_cscope}
+
+# Whether there's a etags available for source code indexing (development only)
+HAVE_ETAGS = ${have_etags}
+
 # Whether there's a sphinx-build binary available for building documentation
 HAVE_SPHINX=${have_sphinx}
 
-- 
2.7.4

             reply	other threads:[~2017-08-23 20:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 20:55 Yuri Volchkov [this message]
2017-08-24  5:51 ` [PATCH] build: generate cscope and etags source indexes Jani Nikula
2017-08-24  6:49   ` Tomi Ollila
2017-08-24  9:13     ` Yuri Volchkov
2017-08-24  9:55       ` Jani Nikula
2017-08-24 10:11         ` Yuri Volchkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503521740-32330-1-git-send-email-yuri.volchkov@gmail.com \
    --to=yuri.volchkov@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).