# Re: \[PATCH 2/3\] Makefile: fix "cscope" target to refer to cscope.out

- From: Jeff King \<hidden\>
- Date: 2021-06-22 19:25:32 
- List: git
- Page: https://ratatoskr.run/git/2021/06/7893192
- Thread: https://ratatoskr.run/git/2021/06/7893158/t.md

```text
On Tue, Jun 22, 2021 at 04:21:26PM +0200, Ævar Arnfjörð Bjarmason wrote:

> The cscope target added in a2a9150bf06 (makefile: Add a cscope target,
> 2007-10-06) has for some reason been referring to cscope* instead of
> cscope.out. Let's generate the cscope.out file directly so we don't
> need to speculate.
> 
> The "-fcscope.out" (note, no whitespace) argument is enabled by
> default on my system's cscope 15.9, but let's provide it explicitly
> for good measure.

I don't use cscope myself, but it can generate other files (e.g., with
"-q"). It looks like we don't even allow people to set $(CSCOPE),
though, so that shouldn't ever happen.

(I wonder if anybody even really uses cscope. I wanted to love it as a
better form of ctags, but I have always found it so baroque and
complicated that it ends up being a waste of my time to try it).

> +cscope.out:
> +	$(FIND_SOURCE_FILES) | xargs cscope -f$@ -b
> +
>  .PHONY: cscope
> -cscope:
> -	$(RM) cscope*
> -	$(FIND_SOURCE_FILES) | xargs cscope -b
> +cscope: cscope.out

This drops the $(RM). Does cscope always overwrite the output file, or
does it append? Just trying "cscope -b foo.c; cscope -b bar.c", it looks
like it overwrites. Which makes your patch correct, but that existing
"xargs" is somewhat questionable (if it splits into two commands, the
first half will get dropped).

-Peff
```
