* automake.in (handle_tags): Handle cscope.
* doc/automake.texi (Tags): Document cscope.
* lib/am/tags.am (CSCOPE): New macro.
[TOPDIR_P] (AM_RECURSIVE_TARGETS): Add cscope.
(cscope): New target.
(cscopeclean): Likewise.
(cscope.files): Likewise.
(cscopelist): Likewise.
(distclean-tags): Remove `cscope.out', `cscope.in.out',
`cscope.po.out' and `cscope.files'.
* NEWS: Update.
Based upon earlier patch from Jesse Barnes.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+2009-09-25 Debarshi Ray <rishi@gnu.org>
+
+ New target to generate cscope database.
+ * automake.in (handle_tags): Handle cscope.
+ * doc/automake.texi (Tags): Document cscope.
+ * lib/am/tags.am (CSCOPE): New macro.
+ [TOPDIR_P] (AM_RECURSIVE_TARGETS): Add cscope.
+ (cscope): New target.
+ (cscopeclean): Likewise.
+ (cscope.files): Likewise.
+ (cscopelist): Likewise.
+ (distclean-tags): Remove `cscope.out', `cscope.in.out',
+ `cscope.po.out' and `cscope.files'.
+ * NEWS: Update.
+ Based upon earlier patch from Jesse Barnes.
+
2009-09-18 Peter Johansson <trojkan@gmail.com> (tiny change)
Fix link to "Recursive Make Considered Harmful" paper.
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir dist dist-all distcheck
+ cscope distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
+CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
+cscopelist-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+ done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscope: cscopeclean cscope.files
+ $(CSCOPE) -b -q $(CSCOPEFLAGS) $(AM_CSCOPEFLAGS) \
+ -i cscope.files $(CSCOPE_ARGS)
+
+cscopeclean:
+ -rm -f cscope.files
+
+cscope.files: cscopelist-recursive cscopelist
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ for i in $$list; do \
+ if test -f "$$i"; \
+ then echo \"$(subdir)/$$i\"; \
+ else \
+ echo \"$(abs_srcdir)/$$i\"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags cscope.out cscope.in.out \
+ cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
uninstall-am: uninstall-binSCRIPTS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-exec-am install-strip tags-recursive \
- uninstall-am
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
+ cscopelist-recursive ctags-recursive install-am \
+ install-exec-am install-strip tags-recursive uninstall-am
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
- ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
- dist-hook dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
- distcheck distclean distclean-generic distclean-tags \
- distcleancheck distdir distuninstallcheck dvi dvi-am html \
- html-am info info-am install install-am install-binSCRIPTS \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-exec-hook install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- installdirs-am maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
- tags-recursive uninstall uninstall-am uninstall-binSCRIPTS \
- uninstall-hook
+ cscope cscopeclean cscopelist cscopelist-recursive ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
+ dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
+ distclean distclean-generic distclean-tags distcleancheck \
+ distdir distuninstallcheck dvi dvi-am html html-am info \
+ info-am install install-am install-binSCRIPTS install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-exec-hook install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-binSCRIPTS uninstall-hook
install-exec-hook:
New in 1.11.0a:
+* New targets:
+
+ - New `cscope' target (builds cscope database).
+
Bugs fixed in 1.11.0a:
* Bugs introduced by 1.11:
{
my @tag_deps = ();
my @ctag_deps = ();
+ my @cscope_deps = ();
if (var ('SUBDIRS'))
{
$output_rules .= ("tags-recursive:\n"
push (@ctag_deps, 'ctags-recursive');
&depend ('.PHONY', 'ctags-recursive');
&depend ('.MAKE', 'ctags-recursive');
+
+ $output_rules .= ("cscopelist-recursive:\n"
+ . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n"
+ # Never fail here if a subdir fails; it
+ # isn't important.
+ . "\t test \"\$\$subdir\" = . || (cd \$\$subdir"
+ . " && \$(MAKE) \$(AM_MAKEFLAGS) cscopelist); \\\n"
+ . "\tdone\n");
+ push (@cscope_deps, 'cscopelist-recursive');
+ &depend ('.PHONY', 'cscopelist-recursive');
+ &depend ('.MAKE', 'cscopelist-recursive');
}
if (&saw_sources_p (1)
new Automake::Location,
CONFIG => "@config",
TAGSDIRS => "@tag_deps",
- CTAGSDIRS => "@ctag_deps");
+ CTAGSDIRS => "@ctag_deps",
+ CSCOPEDIRS => "@cscope_deps");
set_seen 'TAGS_DEPENDENCIES';
}
# Otherwise, it would be possible for a top-level "make TAGS"
# to fail because some subdirectory failed.
$output_rules .= "tags: TAGS\nTAGS:\n\n";
- # Ditto ctags.
+ # Ditto ctags and cscope.
$output_rules .= "ctags: CTAGS\nCTAGS:\n\n";
+ $output_rules .= "cscopelist:\n\n";
}
}
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ for i in $$list; do \
+ if test -f "$$i"; \
+ then echo \"$(subdir)/$$i\"; \
+ else \
+ echo \"$(abs_srcdir)/$$i\"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags cscope.out cscope.in.out \
+ cscope.po.out cscope.files
distdir: $(DISTFILES)
@list='$(MANS)'; if test -n "$$list"; then \
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-aminfo \
- clean-generic ctags dist-info distclean distclean-generic \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am \
- install-dist_docDATA install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-man1 install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-aminfo maintainer-clean-generic \
- maintainer-clean-vti mostlyclean mostlyclean-aminfo \
- mostlyclean-generic mostlyclean-vti pdf pdf-am ps ps-am tags \
- uninstall uninstall-am uninstall-dist_docDATA uninstall-dvi-am \
- uninstall-html-am uninstall-info-am uninstall-man \
- uninstall-man1 uninstall-pdf-am uninstall-ps-am
+ clean-generic cscopelist ctags dist-info distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_docDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man1 install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-aminfo \
+ maintainer-clean-generic maintainer-clean-vti mostlyclean \
+ mostlyclean-aminfo mostlyclean-generic mostlyclean-vti pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-dist_docDATA uninstall-dvi-am uninstall-html-am \
+ uninstall-info-am uninstall-man uninstall-man1 \
+ uninstall-pdf-am uninstall-ps-am
$(dist_man1_MANS): $(top_srcdir)/configure.ac
$(srcdir)/aclocal.1 $(srcdir)/automake.1:
Miscellaneous Rules
-* Tags:: Interfacing to etags and mkid
+* Tags:: Interfacing to cscope, etags and mkid
* Suffixes:: Handling new file extensions
* Multilibs:: Support for multilibs.
There are a few rules and variables that didn't fit anywhere else.
@menu
-* Tags:: Interfacing to etags and mkid
+* Tags:: Interfacing to cscope, etags and mkid
* Suffixes:: Handling new file extensions
* Multilibs:: Support for multilibs.
@end menu
directory-by-directory basis.
@trindex id
+Similarly, the @code{cscope} rule will create a list of all the source
+files in the tree and run @command{cscope} to build an inverted index
+database. The variable @code{CSCOPE} is the name of the program to invoke
+(by default @command{cscope}); @code{CSCOPEFLAGS} and
+@code{CSCOPE_ARGS} can be used by the user to pass additional flags and
+file names respectively, while @code{AM_CSCOPEFLAGS} can be used by the
+@file{Makefile.am}.
+
Finally, Automake also emits rules to support the
@uref{http://www.gnu.org/software/global/, GNU Global Tags program}.
The @code{GTAGS} rule runs Global Tags and puts the
@c LocalWords: LTALLOCA MALLOC malloc memcmp strdup alloca libcompat xyz DFOO
@c LocalWords: unprefixed buildable preprocessed DBAZ DDATADIR WARNINGCFLAGS
@c LocalWords: LIBFOOCFLAGS LIBFOOLDFLAGS ftable testSubDir obj LIBTOOLFLAGS
-@c LocalWords: barexec Pinard's automatize initialize lzma xz
+@c LocalWords: barexec Pinard's automatize initialize lzma xz cscope
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
+cscopelist-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+ done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ for i in $$list; do \
+ if test -f "$$i"; \
+ then echo \"$(subdir)/$$i\"; \
+ else \
+ echo \"$(abs_srcdir)/$$i\"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags cscope.out cscope.in.out \
+ cscope.po.out cscope.files
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
uninstall-am: uninstall-dist_perllibDATA uninstall-nodist_perllibDATA
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
+ cscopelist-recursive ctags-recursive install-am install-strip \
+ tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic ctags \
- ctags-recursive distclean distclean-generic distclean-tags \
- distdir dvi dvi-am html html-am info info-am install \
- install-am install-data install-data-am \
- install-dist_perllibDATA install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man \
+ all all-am check check-am clean clean-generic cscopelist \
+ cscopelist-recursive ctags ctags-recursive distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dist_perllibDATA install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
install-nodist_perllibDATA install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
ctags: CTAGS
CTAGS:
+cscopelist:
+
# To be appended to the command running the test. Handle the stdout
# and stderr redirection, and catch the exit status.
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
+cscopelist-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+ done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ for i in $$list; do \
+ if test -f "$$i"; \
+ then echo \"$(subdir)/$$i\"; \
+ else \
+ echo \"$(abs_srcdir)/$$i\"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags cscope.out cscope.in.out \
+ cscope.po.out cscope.files
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
uninstall-am: uninstall-dist_pkgvdataDATA uninstall-dist_scriptDATA
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-data-am install-strip tags-recursive
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) \
+ cscopelist-recursive ctags-recursive install-am \
+ install-data-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic ctags \
- ctags-recursive distclean distclean-generic distclean-tags \
- distdir dvi dvi-am html html-am info info-am install \
- install-am install-data install-data-am install-data-hook \
- install-dist_pkgvdataDATA install-dist_scriptDATA install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installcheck-local \
- installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
- pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ all all-am check check-am clean clean-generic cscopelist \
+ cscopelist-recursive ctags ctags-recursive distclean \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-data-hook install-dist_pkgvdataDATA \
+ install-dist_scriptDATA install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installcheck-local installdirs \
+ installdirs-am maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
+ tags-recursive uninstall uninstall-am \
uninstall-dist_pkgvdataDATA uninstall-dist_scriptDATA
ctags: CTAGS
CTAGS:
+cscopelist:
+
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
&& gtags -i $(GTAGS_ARGS) "$$here"
+## ------- ##
+## cscope ##
+## ------- ##
+
+if %?TOPDIR_P%
+
+CSCOPE = cscope
+.PHONY: cscope cscopeclean
+AM_RECURSIVE_TARGETS += cscope
+
+cscope: cscopeclean cscope.files
+ $(CSCOPE) -b -q $(CSCOPEFLAGS) $(AM_CSCOPEFLAGS) \
+ -i cscope.files $(CSCOPE_ARGS)
+
+cscopeclean:
+ -rm -f cscope.files
+
+cscope.files: %CSCOPEDIRS% cscopelist
+
+endif %?TOPDIR_P%
+
+.PHONY: cscopelist
+cscopelist: %CSCOPEDIRS% $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ for i in $$list; do \
+ if test -f "$$i"; \
+ then echo \"$(subdir)/$$i\"; \
+ else \
+ echo \"$(abs_srcdir)/$$i\"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+
## ---------- ##
## Cleaning. ##
## ---------- ##
.PHONY distclean-am: distclean-tags
distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags cscope.out cscope.in.out \
+ cscope.po.out cscope.files
ctags: CTAGS
CTAGS:
+cscopelist:
+
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
ctags: CTAGS
CTAGS:
+cscopelist:
+
# To be appended to the command running the test. Handle the stdout
# and stderr redirection, and catch the exit status.