ctags-lang-make(7) Universal Ctags ctags-lang-make(7)

# [Name](#Name)

ctags-lang-make - Random notes about tagging Make source code with Universal Ctags

# [SYNOPSIS](#SYNOPSIS)

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

# [DESCRIPTION](#DESCRIPTION)

This parser extracts macro and target definitions. It also extracts included files as references.

## [Examples](#Examples)

"input.mak"

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

```
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](#EXTRACTING_CPP_MACRO_DEFINTIONS_DEFINED_WITH_-DFOO)

With **-D** option in a C compiler like gcc, a programmer can define a macro outside C source files. The options appears on a Makefile frequently. For an example:

```
CPPFLAGS = -DDEBUG
```

The Make parser has heuristics \[DINMAKE] for extracting the macros defined with the option. With enabling **CppDef** extra, you can turn on the heuristics.

## [Examples](#Examples~2)

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

```
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](#VERSIONS)

## [Change since "0.0"](#Change_since_)

•

New extra **CppDef** \[DINMAKE]

# [SEE ALSO](#SEE_ALSO)

[ctags(1)](/man/os/universal-ctags/ctags.1)

\[DINMAKE]

CONFIG\_X86\_X32\_ABI is not visible (defined in Makefile, not C or Kconfig) &lt;https://github.com/bootlin/elixir/issues/221&gt; (&lt;https://github.com/bootlin/elixir/issues/221&gt;)

6.2.1

---

Document: ctags-lang-make(7) from universal-ctags 6.2.1-r1 (Chainguard OS)
Source: https://github.com/universal-ctags/ctags
