2 " Language: automake Makefile.am
3 " Maintainer: John Williams <jrw@pobox.com>
4 " Last change: 2001 May 09
7 " This script adds support for automake's Makefile.am format. It highlights
8 " Makefile variables significant to automake as well as highlighting
9 " autoconf-style @variable@ substitutions . Subsitutions are marked as errors
10 " when they are used in an inappropriate place, such as in defining
14 " Read the Makefile syntax to start with
16 source <sfile>:p:h/make.vim
18 runtime! syntax/make.vim
21 syn match automakePrimary "^[A-Za-z0-9_]\+\(_PROGRAMS\|LIBRARIES\|_LIST\|_SCRIPTS\|_DATA\|_HEADERS\|_MANS\|_TEXINFOS\|_JAVA\|_LTLIBRARIES\)\s*="me=e-1
22 syn match automakePrimary "^TESTS\s*="me=e-1
23 syn match automakeSecondary "^[A-Za-z0-9_]\+\(_SOURCES\|_LDADD\|_LIBADD\|_LDFLAGS\|_DEPENDENCIES\)\s*="me=e-1
24 syn match automakeSecondary "^OMIT_DEPENDENCIES\s*="me=e-1
25 syn match automakeExtra "^EXTRA_[A-Za-z0-9_]\+\s*="me=e-1
26 syn match automakeOptions "^\(AUTOMAKE_OPTIONS\|ETAGS_ARGS\|TAGS_DEPENDENCIES\)\s*="me=e-1
27 syn match automakeClean "^\(MOSTLY\|DIST\|MAINTAINER\)\=CLEANFILES\s*="me=e-1
28 syn match automakeSubdirs "^\(DIST_\)\=SUBDIRS\s*="me=e-1
29 syn match automakeConditional "^\(if\s*[a-zA-Z0-9_]\+\|else\|endif\)\s*$"
31 syn match automakeSubst "@[a-zA-Z0-9_]\+@"
32 syn match automakeSubst "^\s*@[a-zA-Z0-9_]\+@"
33 syn match automakeComment1 "#.*$" contains=automakeSubst
34 syn match automakeComment2 "##.*$"
36 syn match automakeMakeError "$[{(][^})]*[^a-zA-Z0-9_})][^})]*[})]" " GNU make function call
38 syn region automakeNoSubst start="^EXTRA_[a-zA-Z0-9_]*\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent
39 syn region automakeNoSubst start="^DIST_SUBDIRS\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent
40 syn region automakeNoSubst start="^[a-zA-Z0-9_]*_SOURCES\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent
41 syn match automakeBadSubst "@\([a-zA-Z0-9_]*@\=\)\=" contained
43 syn region automakeMakeDString start=+"+ skip=+\\"+ end=+"+ contains=makeIdent,automakeSubstitution
44 syn region automakeMakeSString start=+'+ skip=+\\'+ end=+'+ contains=makeIdent,automakeSubstitution
45 syn region automakeMakeBString start=+`+ skip=+\\`+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine,automakeSubstitution
47 " Define the default highlighting.
48 " For version 5.7 and earlier: only when not done already
49 " For version 5.8 and later: only when an item doesn't have highlighting yet
50 if version >= 508 || !exists("did_automake_syntax_inits")
52 let did_automake_syntax_inits = 1
53 command -nargs=+ HiLink hi link <args>
55 command -nargs=+ HiLink hi def link <args>
58 HiLink automakePrimary Statement
59 HiLink automakeSecondary Type
60 HiLink automakeExtra Special
61 HiLink automakeOptions Special
62 HiLink automakeClean Special
63 HiLink automakeSubdirs Statement
64 HiLink automakeConditional PreProc
65 HiLink automakeSubst PreProc
66 HiLink automakeComment1 makeComment
67 HiLink automakeComment2 makeComment
68 HiLink automakeMakeError makeError
69 HiLink automakeBadSubst makeError
70 HiLink automakeMakeDString makeDString
71 HiLink automakeMakeSString makeSString
72 HiLink automakeMakeBString makeBString
77 let b:current_syntax = "automake"