ctags-lang-make(7)

πŸ“¦ version 6.2.1, in ubuntu resolute, ubuntu stonking

πŸŽ€ NAME

okay bestie, welcome to ctags-lang-make β€” that's the ctags-lang-make(7) page from the Universal Ctags fam πŸ’–. It's literally just random notes about tagging Make source code with Universal Ctags. No cap, that's the whole vibe.


✨ SYNOPSIS ✨

ctags ... --languages=+Make ...
ctags ... --language-force=Make ...
ctags ... --map-Make=+([Mm]akefile) --map-Make=+(GNUmakefile) ...
ctags ... --map-Make=+.mak --map-Make=+.mk ...

πŸ’… DESCRIPTION πŸ’…

This parser goes and extracts macro and target definitions. It also pulls out included files, but as references, not as definitions. iykyk πŸ¦‹

🌸 Examples 🌸

input.mak β€” she's the moment:

-include base.mak

SRC = hello.c

all: hello
hello: hello.o
hello.o: hello.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $<

output.tags with --options=NONE --extras=+r --fields=+KlrE -o - input.mak β€” look at her go πŸ˜­πŸ’–:

SRC  input.mak       /^SRC = hello.c$/;"     macro   language:Make   roles:def
all  input.mak       /^all: hello$/;"        target  language:Make   roles:def
base.mak     input.mak       /^-include base.mak$/;" makefile        language:Make   roles:optional  extras:reference
hello        input.mak       /^hello: hello.o$/;"    target  language:Make   roles:def
hello.o      input.mak       /^hello.o: hello.c$/;"  target  language:Make   roles:def

πŸ”₯ EXTRACTING CPP MACRO DEFINTIONS DEFINED WITH -DFOO πŸ”₯

so here's the tea β˜• β€” with the -D option in a C compiler like gcc, a programmer can define a macro outside of C source files. And those options show up on a Makefile all the time. For an example:

CPPFLAGS = -DDEBUG

The Make parser has heuristics [DINMAKE] for extracting the macros defined with that option πŸ‘‘. And if you enable the CppDef extra, you can turn those heuristics on. slay.

πŸ¦‹ Examples πŸ¦‹

input.mak:

-include base.mak

CFLAGS = -g -O2
CPPFLAGS = -DOUTPUT=stdout
SRC = hello.c

all: hello
hello: hello.o
hello.o: hello.c
$(CC) -c $(CFLAGS) $(CPPFLAGS) $<

output.tags with --options=NONE --extras-Make=+{CppDef} --fields=+KlE -o - input.mak β€” okay she ate πŸ“:

CFLAGS       input.mak       /^CFLAGS = -g -O2$/;"   macro   language:Make
CPPFLAGS     input.mak       /^CPPFLAGS = -DOUTPUT=stdout$/;"        macro   language:Make
OUTPUT       input.mak       /^CPPFLAGS = -DOUTPUT=stdout$/;"        macro   language:CPreProcessor  extras:CppDef
SRC  input.mak       /^SRC = hello.c$/;"     macro   language:Make
all  input.mak       /^all: hello$/;"        target  language:Make
hello        input.mak       /^hello: hello.o$/;"    target  language:Make
hello.o      input.mak       /^hello.o: hello.c$/;"  target  language:Make

⭐ VERSIONS ⭐

πŸ’œ Change since 0.0

  • New extra CppDef [DINMAKE] ✨

🌈 SEE ALSO 🌈


that's the whole page bestie, go forth and tag your Makefiles πŸ’…

okay and for the cute sign-off: this was Universal Ctags version 6.2.1, page ctags-lang-make(7), mwah πŸ’–πŸ«ΆπŸ§š periodt.

πŸ“¦ where this page comes from