ctags-lang-make(7)
π 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 π
ctags(1)[DINMAKE]β CONFIG_X86_X32_ABI is not visible (defined in Makefile, not C or Kconfig) <https://github.com/bootlin/elixir/issues/221> (<https://github.com/bootlin/elixir/issues/221>)
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
- ubuntu resolute: universal-ctags 6.2.1-1 Β· GPL-2.0-or-later
- ubuntu stonking: universal-ctags 6.2.1-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms