Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: automake Makefile.am |
| 3 | " Maintainer: John Williams <jrw@pobox.com> |
| 4 | " Last change: 2001 May 09 |
| 5 | |
| 6 | |
| 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 |
| 11 | " EXTRA_SOURCES. |
| 12 | |
| 13 | |
| 14 | " Read the Makefile syntax to start with |
| 15 | if version < 600 |
| 16 | source <sfile>:p:h/make.vim |
| 17 | else |
| 18 | runtime! syntax/make.vim |
| 19 | endif |
| 20 | |
| 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*$" |
| 30 | |
| 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 "##.*$" |
| 35 | |
| 36 | syn match automakeMakeError "$[{(][^})]*[^a-zA-Z0-9_})][^})]*[})]" " GNU make function call |
| 37 | |
| 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 |
| 42 | |
| 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 |
| 46 | |
| 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") |
| 51 | if version < 508 |
| 52 | let did_automake_syntax_inits = 1 |
| 53 | command -nargs=+ HiLink hi link <args> |
| 54 | else |
| 55 | command -nargs=+ HiLink hi def link <args> |
| 56 | endif |
| 57 | |
| 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 |
| 73 | |
| 74 | delcommand HiLink |
| 75 | endif |
| 76 | |
| 77 | let b:current_syntax = "automake" |
| 78 | |
| 79 | " vi: ts=8 sw=4 sts=4 |