public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Makefile patch for cscope and saner Ctags
@ 2001-05-30 22:02 Mark Frazer
  2001-05-31 17:45 ` Pete Wyckoff
  0 siblings, 1 reply; 9+ messages in thread
From: Mark Frazer @ 2001-05-30 22:02 UTC (permalink / raw)
  To: Linux Kernel

The following patch generates saner Ctags and will build cscope
output.  It's against 2.4.5


--- Makefile.old	Mon May 28 22:44:01 2001
+++ Makefile	Wed May 30 17:50:01 2001
@@ -334,11 +334,32 @@
 
 # Exuberant ctags works better with -I
 tags: dummy
-	CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
+	CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "--sort=no -I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
 	ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
-	find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
+	find include -type f -name '*.h' -mindepth 2 -maxdepth 2 \
+	    | grep -v include/asm- | grep -v include/config \
+	    | xargs -r ctags $$CTAGSF -a && \
+	find include -type f -name '*.h' -mindepth 3 -maxdepth 3 \
+	    | grep -v include/asm- | grep -v include/config \
+	    | xargs -r ctags $$CTAGSF -a && \
+	find include -type f -name '*.h' -mindepth 4 -maxdepth 4 \
+	    | grep -v include/asm- | grep -v include/config \
+	    | xargs -r ctags $$CTAGSF -a && \
+	find include -type f -name '*.h' -mindepth 5 -maxdepth 5 \
+	    | grep -v include/asm- | grep -v include/config \
+	    | xargs -r ctags $$CTAGSF -a && \
 	find $(SUBDIRS) init -name '*.c' | xargs ctags $$CTAGSF -a
+	mv tags tags.unsorted
+	LC_ALL=C sort -k 1,1 -s tags.unsorted > tags
+	rm tags.unsorted
 
+cscope: dummy
+	find include/asm-$(ARCH) -name '*.h' >cscope.files
+	find include $(SUBDIRS) init -type f -name '*.[ch]' \
+	    | grep -v include/asm- | grep -v include/config >> cscope.files
+	cscope -b -I include
+
+	
 ifdef CONFIG_MODULES
 ifdef CONFIG_MODVERSIONS
 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: Makefile patch for cscope and saner Ctags
@ 2001-05-31 16:11 Khachaturov, Vassilii
  2001-05-31 18:06 ` Mark Frazer
  0 siblings, 1 reply; 9+ messages in thread
From: Khachaturov, Vassilii @ 2001-05-31 16:11 UTC (permalink / raw)
  To: 'Mark Frazer'; +Cc: Linux Kernel

Great stuff. May I suggest adding -k to the cscope cmdline:

> +	cscope -b -I include

should become 
  +	cscope -b -k -I include

Also, I think you should separate cscope.files creation into a different
rule,
and make the cscope target depend on it and on the files in it. (Like the
stuff
with .flags)

The new .files should be created  in a different file, and the old file
shouldn't 
be replaced if there's no change.

Lastly, you need to clean up. I think cscope.out should be cleaned up
in the clean target, while the cscope.files should probably should only be
cleaned on rmproper or such.

Vassilii

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: Makefile patch for cscope and saner Ctags
@ 2001-05-31 18:52 Khachaturov, Vassilii
  2001-05-31 20:44 ` Mark Frazer
  0 siblings, 1 reply; 9+ messages in thread
From: Khachaturov, Vassilii @ 2001-05-31 18:52 UTC (permalink / raw)
  To: 'Mark Frazer'; +Cc: Linux Kernel

> From: Mark Frazer [mailto:mark@somanetworks.com]
> Khachaturov, Vassilii <Vassilii.Khachaturov@comverse.com> 
> > Great stuff. May I suggest adding -k to the cscope cmdline:
> >   +	cscope -b -k -I include
> 
> The cscope on my RH7.0 box didn't take -k!
> [root@mjftest linux-2.4.5]# cscope -b -k -I include
> cscope: unknown option: -k
> [root@mjftest linux-2.4.5]# rpm -qf /usr/bin/cscope
> cscope-13.0-6
> 
> weird, as man cscope documents -k's existence

Don't forget to bug RH package maintainer on that. Whatever 
version they ship (I don't know, maybe 13 indeed didn't have -k) 
the mans and the binaries must be consistent. 

I use source-built cscope v.15.1, and -k works for me here, 
atop RH70 too. You can download it 
at http://cscope.sourceforge.net And, the cscope project
guys are very responsive and willing to fix/implement things
in their product. 

(BTW, anyone here knows how to submit
a cvsweb patch/bug and get an answer? cvsweb at sourceforge
seems dead, as well as cvsweb.org :-( )

You definitely want -k in the kernel Makefile to avoid 
irrelevant things from /usr/include!!!

> I didn't see a way to add >>'ing the file to cscope.files 
> without greping
> for it's entrance there already.  So I've left the find ... method of
> creating cscope.files.

Sorry for being unclear. I meant: output the new find results into smth like
.cscope.files, then compare (cmp -s) it to the current cscope.files,
and replace the latter with it ONLY if there were diffs:
> > The new .files should be created  in a different file, and the old file
> > shouldn't be replaced if there's no change.

> cscope.out is now built by a shell command which does the checking
> against the age of the files in cscope.files

WHY?! Isn't it better to put $(shell cat cscope.files) on the list of
cscope.out
dependencies? Or, maybe better yet,

cscope.make: cscope.files
	echo -n 'cscope.out: ' > .$@
	cat $< >> .$@	
	mv .$@ $@

include cscope.make

(or should it be `-include' here?)

> Backout the old patch and try this one.

[patch mostly snipped]
> +.PHONY: scsope
[patch mostly snipped]

s/scs/csc/

^ permalink raw reply	[flat|nested] 9+ messages in thread
* RE: Makefile patch for cscope and saner Ctags
@ 2001-06-01 18:39 Khachaturov, Vassilii
  0 siblings, 0 replies; 9+ messages in thread
From: Khachaturov, Vassilii @ 2001-06-01 18:39 UTC (permalink / raw)
  To: 'Mark Frazer'
  Cc: 'Pete Wyckoff', Linux Kernel, 'kaos@ocs.com.au'

cscope:

Minor stuff:
1) in cscope.files - I'd be replacing cscope.files with $@ within the rule -
you don't need a yellow belt to know $@ within a Makefile
2) /bin/rm vs rm

tags: Not going deep into it, I possibly should say here that hardwiring
depth 5 is not the best thing probably - once someone extends down to 6,
this place in the Makefile will for sure not be updated. You can make a loop
here to max depth, which you can discover right here, rather than the
current manually unrolled loop.

In general, I am not a tags user in the kernel (sticking to local tags +
global cscope), so I'd be happy if you and 
Pete could merge together your tags stuff. As for the ignore list, I don't
see much of maintenance work there - and, if you guys think there is, maybe
it is just possible to add Pete on the Kernel Build maintainers WRT to that
file?

Overall, IMHO, after you give it the last touch (maybe just dismissing my
present letter :-) ) the cscope stuff is mature enough for going to KO & Co.
(i.e. the kernel build guys); I don't consider myself a hardcore tags user
to say so about the tags portion. 

Keith, what do you think?

Vassilii

> -----Original Message-----
> From: Mark Frazer [mailto:mark@somanetworks.com]
> Sent: Thursday, May 31, 2001 4:45 PM
> To: Khachaturov, Vassilii
> Cc: Linux Kernel
> Subject: Re: Makefile patch for cscope and saner Ctags
> 
> 
> Khachaturov, Vassilii <Vassilii.Khachaturov@comverse.com> 
> [01/05/31 15:00]:
> > Don't forget to bug RH package maintainer on that. Whatever 
> 
> bugzilla submitted
> 
> > I use source-built cscope v.15.1, and -k works for me here, 
> 
> works for me too!
> 
> > WHY?! Isn't it better to put $(shell cat cscope.files) on 
> the list of
> 
> I only have a yellow belt in makefile kungfu.  These fancy 
> gnu make things
> are relatively new to some of us...
> 
> The latest patch is attached.  include/linux/compile.h seems to get
> built whenever I run make, so that's why I've excluded it 
> from the deps
> for cscope.out.
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-06-01 18:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-30 22:02 Makefile patch for cscope and saner Ctags Mark Frazer
2001-05-31 17:45 ` Pete Wyckoff
2001-05-31 18:17   ` Mark Frazer
  -- strict thread matches above, loose matches on Subject: below --
2001-05-31 16:11 Khachaturov, Vassilii
2001-05-31 18:06 ` Mark Frazer
2001-05-31 18:56   ` george anzinger
2001-05-31 18:52 Khachaturov, Vassilii
2001-05-31 20:44 ` Mark Frazer
2001-06-01 18:39 Khachaturov, Vassilii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox