RE: Makefile patch for cscope and saner Ctags

2001-06-01 Thread Khachaturov, Vassilii

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:[EMAIL PROTECTED]]
> 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 <[EMAIL PROTECTED]> 
> [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.
> 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



RE: Makefile patch for cscope and saner Ctags

2001-06-01 Thread Khachaturov, Vassilii

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:[EMAIL PROTECTED]]
 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 [EMAIL PROTECTED] 
 [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.
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Mark Frazer

Khachaturov, Vassilii <[EMAIL PROTECTED]> [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.


--- Makefile.oldMon May 28 22:44:01 2001
+++ MakefileThu May 31 16:29:38 2001
@@ -334,10 +334,41 @@
 
 # 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.files: 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
+   @[ -f cscope.files ] || touch cscope.files
+   @if cmp -s .cscope.files cscope.files ; then \
+   /bin/rm .cscope.files ; \
+   else \
+   rm cscope.files ; mv .cscope.files cscope.files ; \
+   fi
+
+.PHONY: cscope
+cscope: cscope.out
+cscope.out: cscope.files \
+$(shell [ -f cscope.files ] && grep -v include/linux/compile.h cscope.files)
+   cscope -k -b -I include
 
 ifdef CONFIG_MODULES
 ifdef CONFIG_MODVERSIONS
@@ -416,7 +447,8 @@
 distclean: mrproper
rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-   -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS 
tags
+   -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS 
+tags \
+   cscope.files cscope.out
 
 backup: mrproper
cd .. && tar cf - linux/ | gzip -9 > backup.gz



RE: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Khachaturov, Vassilii

> From: Mark Frazer [mailto:[EMAIL PROTECTED]]
> Khachaturov, Vassilii <[EMAIL PROTECTED]> 
> > 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/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Mark Frazer

Pete Wyckoff <[EMAIL PROTECTED]> [01/05/31 13:56]:
> 
> You seem not to have read my response to your earlier mail proprosing
> such a thing (for tags only, not cscope):
> 
> http://boudicca.tux.org/hypermail/linux-kernel/2001week21/1869.html

I did.  I didn't want to sign up to maintain the ctags-ignore file though.

> 
> How does the patch above fix anything?  You're sorting so that
> include/linux/*.h comes before include/linux/{mtd,lockd,raid,...}/*.h,
> but I don't see how that can be an improvement, or how it addresses
> your original complaint "ctags doesn't honour any CPP #if'ing".

The sort -s is a stable sort, so by putting things into ctags in the
order I want them to appear in my tags file I get what I want.  YMMV

My original complaint ain't gonna get fixed anytime soon.

Your script is definitely a better solution IMO.

-mark
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Mark Frazer

Khachaturov, Vassilii <[EMAIL PROTECTED]> [01/05/31 12:12]:
> Great stuff. May I suggest adding -k to the cscope cmdline:
> 
> > +   cscope -b -I include
> 
> should become 
>   +   cscope -b -k -I include

The cscope on my RH7.0 box didn't take -k!
[root@mjftest linux-2.4.5]# ls -l cscope.files
-rw-r--r--1 root root   105530 May 30 17:58 cscope.files
[root@mjftest linux-2.4.5]# cscope -b -k -I include
cscope: unknown option: -k
Usage:  cscope [-bcCdelLqTuUV] [-f file] [-F file] [-i file] [-I dir] [-s dir]
   [-p number] [-P path] [-[0-8] pattern] [source files]
[root@mjftest linux-2.4.5]# which cscope
/usr/bin/cscope
[root@mjftest linux-2.4.5]# rpm -qf /usr/bin/cscope
cscope-13.0-6

weird, as man cscope documents -k's existence

> 
> 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)

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.

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

> 
> 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

Backout the old patch and try this one.

--- Makefile.oldMon May 28 22:44:01 2001
+++ MakefileThu May 31 14:02:30 2001
@@ -334,11 +334,41 @@
 
 # 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.files:
+   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.out: cscope.files dummy
+   @while read file ; do \
+   if [ $$file -nt cscope.out ] ; then\
+   cscope -b -I include ; \
+   break ; \
+   fi ; \
+   done  backup.gz
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Pete Wyckoff

[EMAIL PROTECTED] said:
> 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

You seem not to have read my response to your earlier mail proprosing
such a thing (for tags only, not cscope):

http://boudicca.tux.org/hypermail/linux-kernel/2001week21/1869.html

How does the patch above fix anything?  You're sorting so that
include/linux/*.h comes before include/linux/{mtd,lockd,raid,...}/*.h,
but I don't see how that can be an improvement, or how it addresses
your original complaint "ctags doesn't honour any CPP #if'ing".

-- Pete
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



RE: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Khachaturov, Vassilii

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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



RE: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Khachaturov, Vassilii

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
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Pete Wyckoff

[EMAIL PROTECTED] said:
 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

You seem not to have read my response to your earlier mail proprosing
such a thing (for tags only, not cscope):

http://boudicca.tux.org/hypermail/linux-kernel/2001week21/1869.html

How does the patch above fix anything?  You're sorting so that
include/linux/*.h comes before include/linux/{mtd,lockd,raid,...}/*.h,
but I don't see how that can be an improvement, or how it addresses
your original complaint ctags doesn't honour any CPP #if'ing.

-- Pete
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Mark Frazer

Khachaturov, Vassilii [EMAIL PROTECTED] [01/05/31 12:12]:
 Great stuff. May I suggest adding -k to the cscope cmdline:
 
  +   cscope -b -I include
 
 should become 
   +   cscope -b -k -I include

The cscope on my RH7.0 box didn't take -k!
[root@mjftest linux-2.4.5]# ls -l cscope.files
-rw-r--r--1 root root   105530 May 30 17:58 cscope.files
[root@mjftest linux-2.4.5]# cscope -b -k -I include
cscope: unknown option: -k
Usage:  cscope [-bcCdelLqTuUV] [-f file] [-F file] [-i file] [-I dir] [-s dir]
   [-p number] [-P path] [-[0-8] pattern] [source files]
[root@mjftest linux-2.4.5]# which cscope
/usr/bin/cscope
[root@mjftest linux-2.4.5]# rpm -qf /usr/bin/cscope
cscope-13.0-6

weird, as man cscope documents -k's existence

 
 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)

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.

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

 
 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

Backout the old patch and try this one.

--- Makefile.oldMon May 28 22:44:01 2001
+++ MakefileThu May 31 14:02:30 2001
@@ -334,11 +334,41 @@
 
 # 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.files:
+   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.out: cscope.files dummy
+   @while read file ; do \
+   if [ $$file -nt cscope.out ] ; then\
+   cscope -b -I include ; \
+   break ; \
+   fi ; \
+   done cscope.files
+
+.PHONY: scsope
+cscope: cscope.out
+   
 ifdef CONFIG_MODULES
 ifdef CONFIG_MODVERSIONS
 MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
@@ -416,7 +446,8 @@
 distclean: mrproper
rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-   -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS 
tags
+   -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS 
+tags \
+   cscope.files cscope.out
 
 backup: mrproper
cd ..  tar cf - linux/ | gzip -9  backup.gz
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Mark Frazer

Pete Wyckoff [EMAIL PROTECTED] [01/05/31 13:56]:
 
 You seem not to have read my response to your earlier mail proprosing
 such a thing (for tags only, not cscope):
 
 http://boudicca.tux.org/hypermail/linux-kernel/2001week21/1869.html

I did.  I didn't want to sign up to maintain the ctags-ignore file though.

 
 How does the patch above fix anything?  You're sorting so that
 include/linux/*.h comes before include/linux/{mtd,lockd,raid,...}/*.h,
 but I don't see how that can be an improvement, or how it addresses
 your original complaint ctags doesn't honour any CPP #if'ing.

The sort -s is a stable sort, so by putting things into ctags in the
order I want them to appear in my tags file I get what I want.  YMMV

My original complaint ain't gonna get fixed anytime soon.

Your script is definitely a better solution IMO.

-mark
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



RE: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Khachaturov, Vassilii

 From: Mark Frazer [mailto:[EMAIL PROTECTED]]
 Khachaturov, Vassilii [EMAIL PROTECTED] 
  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/
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: Makefile patch for cscope and saner Ctags

2001-05-31 Thread Mark Frazer

Khachaturov, Vassilii [EMAIL PROTECTED] [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.


--- Makefile.oldMon May 28 22:44:01 2001
+++ MakefileThu May 31 16:29:38 2001
@@ -334,10 +334,41 @@
 
 # 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.files: 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
+   @[ -f cscope.files ] || touch cscope.files
+   @if cmp -s .cscope.files cscope.files ; then \
+   /bin/rm .cscope.files ; \
+   else \
+   rm cscope.files ; mv .cscope.files cscope.files ; \
+   fi
+
+.PHONY: cscope
+cscope: cscope.out
+cscope.out: cscope.files \
+$(shell [ -f cscope.files ]  grep -v include/linux/compile.h cscope.files)
+   cscope -k -b -I include
 
 ifdef CONFIG_MODULES
 ifdef CONFIG_MODVERSIONS
@@ -416,7 +447,8 @@
 distclean: mrproper
rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-   -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS 
tags
+   -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -type f -print` TAGS 
+tags \
+   cscope.files cscope.out
 
 backup: mrproper
cd ..  tar cf - linux/ | gzip -9  backup.gz



Makefile patch for cscope and saner Ctags

2001-05-30 Thread Mark Frazer

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


--- Makefile.oldMon May 28 22:44:01 2001
+++ MakefileWed 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Makefile patch for cscope and saner Ctags

2001-05-30 Thread Mark Frazer

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


--- Makefile.oldMon May 28 22:44:01 2001
+++ MakefileWed 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
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/