2 " Language: automake Makefile.am
3 " Maintainer: Felipe Contreras <felipe.contreras@gmail.com>
4 " Former Maintainer: John Williams <jrw@pobox.com>
5 " Last Change: $LastChangedDate: 2006-04-16 22:06:40 -0400 (dom, 16 apr 2006) $
6 " URL: http://svn.debian.org/wsvn/pkg-vim/trunk/runtime/syntax/automake.vim?op=file&rev=0&sc=0
8 " This script adds support for automake's Makefile.am format. It highlights
9 " Makefile variables significant to automake as well as highlighting
10 " autoconf-style @variable@ substitutions . Subsitutions are marked as errors
11 " when they are used in an inappropriate place, such as in defining
15 " Read the Makefile syntax to start with
17 source <sfile>:p:h/make.vim
19 runtime! syntax/make.vim
22 syn match automakePrimary "^[A-Za-z0-9_]\+_\(PROGRAMS\|LIBRARIES\|LISP\|PYTHON\|JAVA\|SCRIPTS\|DATA\|HEADERS\|MANS\|TEXINFOS\|LTLIBRARIES\)\s*="me=e-1
24 syn match automakeSecondary "^[A-Za-z0-9_]\+_\(SOURCES\|AR\|LIBADD\|LDADD\|LDFLAGS\|DEPENDENCIES\|LINK\|SHORTNAME\)\s*="me=e-1
25 syn match automakeSecondary "^[A-Za-z0-9_]\+_\(CCASFLAGS\|CFLAGS\|CPPFLAGS\|CXXFLAGS\|FFLAGS\|GCJFLAGS\|LFLAGS\|OBJCFLAGS\|RFLAGS\|YFLAGS\)\s*="me=e-1
27 syn match automakeExtra "^EXTRA_DIST\s*="me=e-1
28 syn match automakeExtra "^EXTRA_PROGRAMS\s*="me=e-1
29 syn match automakeExtra "^EXTRA_[A-Za-z0-9_]\+_SOURCES\s*="me=e-1
32 syn match automakePrimary "^TESTS\s*="me=e-1
33 syn match automakeSecondary "^OMIT_DEPENDENCIES\s*="me=e-1
34 syn match automakeOptions "^\(AUTOMAKE_OPTIONS\|ETAGS_ARGS\|TAGS_DEPENDENCIES\)\s*="me=e-1
35 syn match automakeClean "^\(MOSTLY\|DIST\|MAINTAINER\)\=CLEANFILES\s*="me=e-1
36 syn match automakeSubdirs "^\(DIST_\)\=SUBDIRS\s*="me=e-1
37 syn match automakeConditional "^\(if\s*[a-zA-Z0-9_]\+\|else\|endif\)\s*$"
39 syn match automakeSubst "@[a-zA-Z0-9_]\+@"
40 syn match automakeSubst "^\s*@[a-zA-Z0-9_]\+@"
41 syn match automakeComment1 "#.*$" contains=automakeSubst
42 syn match automakeComment2 "##.*$"
44 syn match automakeMakeError "$[{(][^})]*[^a-zA-Z0-9_})][^})]*[})]" " GNU make function call
46 syn region automakeNoSubst start="^EXTRA_[a-zA-Z0-9_]*\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent
47 syn region automakeNoSubst start="^DIST_SUBDIRS\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent
48 syn region automakeNoSubst start="^[a-zA-Z0-9_]*_SOURCES\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent
49 syn match automakeBadSubst "@\([a-zA-Z0-9_]*@\=\)\=" contained
51 syn region automakeMakeDString start=+"+ skip=+\\"+ end=+"+ contains=makeIdent,automakeSubstitution
52 syn region automakeMakeSString start=+'+ skip=+\\'+ end=+'+ contains=makeIdent,automakeSubstitution
53 syn region automakeMakeBString start=+`+ skip=+\\`+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine,automakeSubstitution
55 " Define the default highlighting.
56 " For version 5.7 and earlier: only when not done already
57 " For version 5.8 and later: only when an item doesn't have highlighting yet
58 if version >= 508 || !exists("did_automake_syntax_inits")
60 let did_automake_syntax_inits = 1
61 command -nargs=+ HiLink hi link <args>
63 command -nargs=+ HiLink hi def link <args>
66 HiLink automakePrimary Statement
67 HiLink automakeSecondary Type
68 HiLink automakeExtra Special
69 HiLink automakeOptions Special
70 HiLink automakeClean Special
71 HiLink automakeSubdirs Statement
72 HiLink automakeConditional PreProc
73 HiLink automakeSubst PreProc
74 HiLink automakeComment1 makeComment
75 HiLink automakeComment2 makeComment
76 HiLink automakeMakeError makeError
77 HiLink automakeBadSubst makeError
78 HiLink automakeMakeDString makeDString
79 HiLink automakeMakeSString makeSString
80 HiLink automakeMakeBString makeBString
85 let b:current_syntax = "automake"