Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 2 | " 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 Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 5 | " Last Change: 2011-06-13 |
| 6 | " URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/automake.vim |
Bram Moolenaar | 3577c6f | 2008-06-24 21:16:56 +0000 | [diff] [blame] | 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! |
Bram Moolenaar | a93fa7e | 2006-04-17 22:14:47 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 20 | " Standard syntax initialization |
| 21 | if version < 600 |
| 22 | syntax clear |
| 23 | elseif exists("b:current_syntax") |
| 24 | finish |
| 25 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 26 | |
| 27 | " Read the Makefile syntax to start with |
| 28 | if version < 600 |
| 29 | source <sfile>:p:h/make.vim |
| 30 | else |
| 31 | runtime! syntax/make.vim |
| 32 | endif |
| 33 | |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 34 | syn match automakePrimary "^\w\+\(_PROGRAMS\|_LIBRARIES\|_LISP\|_PYTHON\|_JAVA\|_SCRIPTS\|_DATA\|_HEADERS\|_MANS\|_TEXINFOS\|_LTLIBRARIES\)\s*\ze+\==" |
| 35 | syn match automakePrimary "^TESTS\s*\ze+\=="me=e-1 |
| 36 | syn match automakeSecondary "^\w\+\(_SOURCES\|_LIBADD\|_LDADD\|_LDFLAGS\|_DEPENDENCIES\|_AR\|_CCASFLAGS\|_CFLAGS\|_CPPFLAGS\|_CXXFLAGS\|_FCFLAGS\|_FFLAGS\|_GCJFLAGS\|_LFLAGS\|_LIBTOOLFLAGS\|OBJCFLAGS\|RFLAGS\|UPCFLAGS\|YFLAGS\)\s*\ze+\==" |
| 37 | syn match automakeSecondary "^\(LDADD\|ARFLAGS\|OMIT_DEPENDENCIES\|AM_MAKEFLAGS\|\(AM_\)\=\(MAKEINFOFLAGS\|RUNTESTDEFAULTFLAGS\|ETAGSFLAGS\|CTAGSFLAGS\|JAVACFLAGS\)\)\s*\ze+\==" |
| 38 | syn match automakeExtra "^EXTRA_\w\+\s*\ze+\==" |
| 39 | syn match automakeOptions "^\(ACLOCAL_AMFLAGS\|AUTOMAKE_OPTIONS\|DISTCHECK_CONFIGURE_FLAGS\|ETAGS_ARGS\|TAGS_DEPENDENCIES\)\s*\ze+\==" |
| 40 | syn match automakeClean "^\(MOSTLY\|DIST\|MAINTAINER\)\=CLEANFILES\s*\ze+\==" |
| 41 | syn match automakeSubdirs "^\(DIST_\)\=SUBDIRS\s*\ze+\==" |
| 42 | syn match automakeConditional "^\(if\s*!\=\w\+\|else\|endif\)\s*$" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 43 | |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 44 | syn match automakeSubst "@\w\+@" |
| 45 | syn match automakeSubst "^\s*@\w\+@" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 46 | syn match automakeComment1 "#.*$" contains=automakeSubst |
| 47 | syn match automakeComment2 "##.*$" |
| 48 | |
| 49 | syn match automakeMakeError "$[{(][^})]*[^a-zA-Z0-9_})][^})]*[})]" " GNU make function call |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 50 | syn match automakeMakeError "^AM_LDADD\s*\ze+\==" " Common mistake |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 51 | |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 52 | syn region automakeNoSubst start="^EXTRA_\w*\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent |
| 53 | syn region automakeNoSubst start="^DIST_SUBDIRS\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent |
| 54 | syn region automakeNoSubst start="^\w*_SOURCES\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent |
| 55 | syn match automakeBadSubst "@\(\w*@\=\)\=" contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 56 | |
| 57 | syn region automakeMakeDString start=+"+ skip=+\\"+ end=+"+ contains=makeIdent,automakeSubstitution |
| 58 | syn region automakeMakeSString start=+'+ skip=+\\'+ end=+'+ contains=makeIdent,automakeSubstitution |
| 59 | syn region automakeMakeBString start=+`+ skip=+\\`+ end=+`+ contains=makeIdent,makeSString,makeDString,makeNextLine,automakeSubstitution |
| 60 | |
| 61 | " Define the default highlighting. |
| 62 | " For version 5.7 and earlier: only when not done already |
| 63 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 64 | if version >= 508 || !exists("did_automake_syntax_inits") |
| 65 | if version < 508 |
| 66 | let did_automake_syntax_inits = 1 |
| 67 | command -nargs=+ HiLink hi link <args> |
| 68 | else |
| 69 | command -nargs=+ HiLink hi def link <args> |
| 70 | endif |
| 71 | |
| 72 | HiLink automakePrimary Statement |
| 73 | HiLink automakeSecondary Type |
| 74 | HiLink automakeExtra Special |
| 75 | HiLink automakeOptions Special |
| 76 | HiLink automakeClean Special |
| 77 | HiLink automakeSubdirs Statement |
| 78 | HiLink automakeConditional PreProc |
| 79 | HiLink automakeSubst PreProc |
| 80 | HiLink automakeComment1 makeComment |
| 81 | HiLink automakeComment2 makeComment |
| 82 | HiLink automakeMakeError makeError |
| 83 | HiLink automakeBadSubst makeError |
| 84 | HiLink automakeMakeDString makeDString |
| 85 | HiLink automakeMakeSString makeSString |
| 86 | HiLink automakeMakeBString makeBString |
| 87 | |
| 88 | delcommand HiLink |
| 89 | endif |
| 90 | |
| 91 | let b:current_syntax = "automake" |
| 92 | |
| 93 | " vi: ts=8 sw=4 sts=4 |