blob: b34f7516b2ab7fdc04c9f73445017d8ee5ea0daf [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00002" Language: automake Makefile.am
3" Maintainer: Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>
4" Former Maintainer: John Williams <jrw@pobox.com>
Bram Moolenaar251e1912011-06-19 05:09:16 +02005" Last Change: 2011-06-13
6" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/automake.vim
Bram Moolenaar3577c6f2008-06-24 21:16:56 +00007"
8" XXX This file is in need of a new maintainer, Debian VIM Maintainers maintain
9" it only because patches have been submitted for it by Debian users and the
10" former maintainer was MIA (Missing In Action), taking over its
11" maintenance was thus the only way to include those patches.
12" If you care about this file, and have time to maintain it please do so!
Bram Moolenaara93fa7e2006-04-17 22:14:47 +000013"
Bram Moolenaar071d4272004-06-13 20:20:40 +000014" This script adds support for automake's Makefile.am format. It highlights
15" Makefile variables significant to automake as well as highlighting
16" autoconf-style @variable@ substitutions . Subsitutions are marked as errors
17" when they are used in an inappropriate place, such as in defining
18" EXTRA_SOURCES.
19
Bram Moolenaar251e1912011-06-19 05:09:16 +020020" Standard syntax initialization
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020021if exists("b:current_syntax")
Bram Moolenaar251e1912011-06-19 05:09:16 +020022 finish
23endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
25" Read the Makefile syntax to start with
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020026runtime! syntax/make.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +000027
Bram Moolenaar251e1912011-06-19 05:09:16 +020028syn match automakePrimary "^\w\+\(_PROGRAMS\|_LIBRARIES\|_LISP\|_PYTHON\|_JAVA\|_SCRIPTS\|_DATA\|_HEADERS\|_MANS\|_TEXINFOS\|_LTLIBRARIES\)\s*\ze+\=="
29syn match automakePrimary "^TESTS\s*\ze+\=="me=e-1
30syn match automakeSecondary "^\w\+\(_SOURCES\|_LIBADD\|_LDADD\|_LDFLAGS\|_DEPENDENCIES\|_AR\|_CCASFLAGS\|_CFLAGS\|_CPPFLAGS\|_CXXFLAGS\|_FCFLAGS\|_FFLAGS\|_GCJFLAGS\|_LFLAGS\|_LIBTOOLFLAGS\|OBJCFLAGS\|RFLAGS\|UPCFLAGS\|YFLAGS\)\s*\ze+\=="
31syn match automakeSecondary "^\(LDADD\|ARFLAGS\|OMIT_DEPENDENCIES\|AM_MAKEFLAGS\|\(AM_\)\=\(MAKEINFOFLAGS\|RUNTESTDEFAULTFLAGS\|ETAGSFLAGS\|CTAGSFLAGS\|JAVACFLAGS\)\)\s*\ze+\=="
32syn match automakeExtra "^EXTRA_\w\+\s*\ze+\=="
33syn match automakeOptions "^\(ACLOCAL_AMFLAGS\|AUTOMAKE_OPTIONS\|DISTCHECK_CONFIGURE_FLAGS\|ETAGS_ARGS\|TAGS_DEPENDENCIES\)\s*\ze+\=="
34syn match automakeClean "^\(MOSTLY\|DIST\|MAINTAINER\)\=CLEANFILES\s*\ze+\=="
35syn match automakeSubdirs "^\(DIST_\)\=SUBDIRS\s*\ze+\=="
36syn match automakeConditional "^\(if\s*!\=\w\+\|else\|endif\)\s*$"
Bram Moolenaar071d4272004-06-13 20:20:40 +000037
Bram Moolenaar251e1912011-06-19 05:09:16 +020038syn match automakeSubst "@\w\+@"
39syn match automakeSubst "^\s*@\w\+@"
Bram Moolenaar071d4272004-06-13 20:20:40 +000040syn match automakeComment1 "#.*$" contains=automakeSubst
41syn match automakeComment2 "##.*$"
42
43syn match automakeMakeError "$[{(][^})]*[^a-zA-Z0-9_})][^})]*[})]" " GNU make function call
Bram Moolenaar251e1912011-06-19 05:09:16 +020044syn match automakeMakeError "^AM_LDADD\s*\ze+\==" " Common mistake
Bram Moolenaar071d4272004-06-13 20:20:40 +000045
Bram Moolenaar251e1912011-06-19 05:09:16 +020046syn region automakeNoSubst start="^EXTRA_\w*\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent
47syn region automakeNoSubst start="^DIST_SUBDIRS\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent
48syn region automakeNoSubst start="^\w*_SOURCES\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent
49syn match automakeBadSubst "@\(\w*@\=\)\=" contained
Bram Moolenaar071d4272004-06-13 20:20:40 +000050
51syn region automakeMakeDString start=+"+ skip=+\\"+ end=+"+ contains=makeIdent,automakeSubstitution
52syn region automakeMakeSString start=+'+ skip=+\\'+ end=+'+ contains=makeIdent,automakeSubstitution
53syn region automakeMakeBString start=+`+ skip=+\\`+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine,automakeSubstitution
54
55" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020056" Only when an item doesn't have highlighting yet
57command -nargs=+ HiLink hi def link <args>
Bram Moolenaar071d4272004-06-13 20:20:40 +000058
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020059HiLink automakePrimary Statement
60HiLink automakeSecondary Type
61HiLink automakeExtra Special
62HiLink automakeOptions Special
63HiLink automakeClean Special
64HiLink automakeSubdirs Statement
65HiLink automakeConditional PreProc
66HiLink automakeSubst PreProc
67HiLink automakeComment1 makeComment
68HiLink automakeComment2 makeComment
69HiLink automakeMakeError makeError
70HiLink automakeBadSubst makeError
71HiLink automakeMakeDString makeDString
72HiLink automakeMakeSString makeSString
73HiLink automakeMakeBString makeBString
Bram Moolenaar071d4272004-06-13 20:20:40 +000074
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020075delcommand HiLink
Bram Moolenaar071d4272004-06-13 20:20:40 +000076
77let b:current_syntax = "automake"
78
79" vi: ts=8 sw=4 sts=4