Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: automake Makefile.am |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 3 | " Maintainer: Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> |
| 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 |
| 7 | " |
| 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! |
| 13 | " |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 14 | " 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 | |
| 20 | |
| 21 | " Read the Makefile syntax to start with |
| 22 | if version < 600 |
| 23 | source <sfile>:p:h/make.vim |
| 24 | else |
| 25 | runtime! syntax/make.vim |
| 26 | endif |
| 27 | |
| 28 | syn match automakePrimary "^[A-Za-z0-9_]\+\(_PROGRAMS\|LIBRARIES\|_LIST\|_SCRIPTS\|_DATA\|_HEADERS\|_MANS\|_TEXINFOS\|_JAVA\|_LTLIBRARIES\)\s*="me=e-1 |
| 29 | syn match automakePrimary "^TESTS\s*="me=e-1 |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 30 | syn match automakeSecondary "^[A-Za-z0-9_]\+\(_SOURCES\|_LDADD\|_LIBADD\|_LDFLAGS\|_DEPENDENCIES\|_CPPFLAGS\)\s*="me=e-1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 31 | syn match automakeSecondary "^OMIT_DEPENDENCIES\s*="me=e-1 |
| 32 | syn match automakeExtra "^EXTRA_[A-Za-z0-9_]\+\s*="me=e-1 |
| 33 | syn match automakeOptions "^\(AUTOMAKE_OPTIONS\|ETAGS_ARGS\|TAGS_DEPENDENCIES\)\s*="me=e-1 |
| 34 | syn match automakeClean "^\(MOSTLY\|DIST\|MAINTAINER\)\=CLEANFILES\s*="me=e-1 |
| 35 | syn match automakeSubdirs "^\(DIST_\)\=SUBDIRS\s*="me=e-1 |
| 36 | syn match automakeConditional "^\(if\s*[a-zA-Z0-9_]\+\|else\|endif\)\s*$" |
| 37 | |
| 38 | syn match automakeSubst "@[a-zA-Z0-9_]\+@" |
| 39 | syn match automakeSubst "^\s*@[a-zA-Z0-9_]\+@" |
| 40 | syn match automakeComment1 "#.*$" contains=automakeSubst |
| 41 | syn match automakeComment2 "##.*$" |
| 42 | |
| 43 | syn match automakeMakeError "$[{(][^})]*[^a-zA-Z0-9_})][^})]*[})]" " GNU make function call |
| 44 | |
| 45 | syn region automakeNoSubst start="^EXTRA_[a-zA-Z0-9_]*\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent |
| 46 | syn region automakeNoSubst start="^DIST_SUBDIRS\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent |
| 47 | syn region automakeNoSubst start="^[a-zA-Z0-9_]*_SOURCES\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent |
| 48 | syn match automakeBadSubst "@\([a-zA-Z0-9_]*@\=\)\=" contained |
| 49 | |
| 50 | syn region automakeMakeDString start=+"+ skip=+\\"+ end=+"+ contains=makeIdent,automakeSubstitution |
| 51 | syn region automakeMakeSString start=+'+ skip=+\\'+ end=+'+ contains=makeIdent,automakeSubstitution |
| 52 | syn region automakeMakeBString start=+`+ skip=+\\`+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine,automakeSubstitution |
| 53 | |
| 54 | " Define the default highlighting. |
| 55 | " For version 5.7 and earlier: only when not done already |
| 56 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 57 | if version >= 508 || !exists("did_automake_syntax_inits") |
| 58 | if version < 508 |
| 59 | let did_automake_syntax_inits = 1 |
| 60 | command -nargs=+ HiLink hi link <args> |
| 61 | else |
| 62 | command -nargs=+ HiLink hi def link <args> |
| 63 | endif |
| 64 | |
| 65 | HiLink automakePrimary Statement |
| 66 | HiLink automakeSecondary Type |
| 67 | HiLink automakeExtra Special |
| 68 | HiLink automakeOptions Special |
| 69 | HiLink automakeClean Special |
| 70 | HiLink automakeSubdirs Statement |
| 71 | HiLink automakeConditional PreProc |
| 72 | HiLink automakeSubst PreProc |
| 73 | HiLink automakeComment1 makeComment |
| 74 | HiLink automakeComment2 makeComment |
| 75 | HiLink automakeMakeError makeError |
| 76 | HiLink automakeBadSubst makeError |
| 77 | HiLink automakeMakeDString makeDString |
| 78 | HiLink automakeMakeSString makeSString |
| 79 | HiLink automakeMakeBString makeBString |
| 80 | |
| 81 | delcommand HiLink |
| 82 | endif |
| 83 | |
| 84 | let b:current_syntax = "automake" |
| 85 | |
| 86 | " vi: ts=8 sw=4 sts=4 |