Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
Bram Moolenaar | 4c05fa0 | 2019-01-01 15:32:17 +0100 | [diff] [blame] | 2 | " Language: automake Makefile.am |
| 3 | " Maintainer: Debian Vim Maintainers |
| 4 | " Former Maintainer: John Williams <jrw@pobox.com> |
Bram Moolenaar | be4e016 | 2023-02-02 13:59:48 +0000 | [diff] [blame] | 5 | " Last Change: 2023 Jan 16 |
| 6 | " URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/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 |
Bram Moolenaar | 4c05fa0 | 2019-01-01 15:32:17 +0100 | [diff] [blame] | 21 | if exists('b:current_syntax') |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 22 | finish |
| 23 | endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 24 | |
| 25 | " Read the Makefile syntax to start with |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 26 | runtime! syntax/make.vim |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 27 | |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 28 | syn match automakePrimary "^\w\+\(_PROGRAMS\|_LIBRARIES\|_LISP\|_PYTHON\|_JAVA\|_SCRIPTS\|_DATA\|_HEADERS\|_MANS\|_TEXINFOS\|_LTLIBRARIES\)\s*\ze+\==" |
| 29 | syn match automakePrimary "^TESTS\s*\ze+\=="me=e-1 |
| 30 | 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+\==" |
| 31 | syn match automakeSecondary "^\(LDADD\|ARFLAGS\|OMIT_DEPENDENCIES\|AM_MAKEFLAGS\|\(AM_\)\=\(MAKEINFOFLAGS\|RUNTESTDEFAULTFLAGS\|ETAGSFLAGS\|CTAGSFLAGS\|JAVACFLAGS\)\)\s*\ze+\==" |
| 32 | syn match automakeExtra "^EXTRA_\w\+\s*\ze+\==" |
| 33 | syn match automakeOptions "^\(ACLOCAL_AMFLAGS\|AUTOMAKE_OPTIONS\|DISTCHECK_CONFIGURE_FLAGS\|ETAGS_ARGS\|TAGS_DEPENDENCIES\)\s*\ze+\==" |
| 34 | syn match automakeClean "^\(MOSTLY\|DIST\|MAINTAINER\)\=CLEANFILES\s*\ze+\==" |
| 35 | syn match automakeSubdirs "^\(DIST_\)\=SUBDIRS\s*\ze+\==" |
| 36 | syn match automakeConditional "^\(if\s*!\=\w\+\|else\|endif\)\s*$" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 37 | |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 38 | syn match automakeSubst "@\w\+@" |
| 39 | syn match automakeSubst "^\s*@\w\+@" |
Bram Moolenaar | 4c05fa0 | 2019-01-01 15:32:17 +0100 | [diff] [blame] | 40 | syn match automakeComment1 "#.*$" contains=automakeSubst,@Spell |
| 41 | syn match automakeComment2 "##.*$" contains=@Spell |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 42 | |
| 43 | syn match automakeMakeError "$[{(][^})]*[^a-zA-Z0-9_})][^})]*[})]" " GNU make function call |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 44 | syn match automakeMakeError "^AM_LDADD\s*\ze+\==" " Common mistake |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 45 | |
Bram Moolenaar | 251e191 | 2011-06-19 05:09:16 +0200 | [diff] [blame] | 46 | syn region automakeNoSubst start="^EXTRA_\w*\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent |
| 47 | syn region automakeNoSubst start="^DIST_SUBDIRS\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent |
| 48 | syn region automakeNoSubst start="^\w*_SOURCES\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent |
| 49 | syn match automakeBadSubst "@\(\w*@\=\)\=" contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 50 | |
| 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 |
| 54 | |
| 55 | " Define the default highlighting. |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 56 | " Only when an item doesn't have highlighting yet |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 57 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 58 | hi def link automakePrimary Statement |
| 59 | hi def link automakeSecondary Type |
| 60 | hi def link automakeExtra Special |
| 61 | hi def link automakeOptions Special |
| 62 | hi def link automakeClean Special |
| 63 | hi def link automakeSubdirs Statement |
| 64 | hi def link automakeConditional PreProc |
| 65 | hi def link automakeSubst PreProc |
| 66 | hi def link automakeComment1 makeComment |
| 67 | hi def link automakeComment2 makeComment |
| 68 | hi def link automakeMakeError makeError |
| 69 | hi def link automakeBadSubst makeError |
| 70 | hi def link automakeMakeDString makeDString |
| 71 | hi def link automakeMakeSString makeSString |
| 72 | hi def link automakeMakeBString makeBString |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 73 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 74 | |
Bram Moolenaar | 4c05fa0 | 2019-01-01 15:32:17 +0100 | [diff] [blame] | 75 | let b:current_syntax = 'automake' |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 76 | |
| 77 | " vi: ts=8 sw=4 sts=4 |