syntax_test_makefile.mak (35051B)
1 # SYNTAX TEST "Packages/Makefile/Makefile.sublime-syntax" 2 3 ################################# 4 # 6.3.1 substitution references # 5 ################################# 6 7 P = Hello 8 # <- variable.other 9 # ^ keyword.operator.assignment 10 # ^ - string.unquoted 11 # ^ string.unquoted 12 # ^ string.unquoted 13 # ^ - string.unquoted 14 15 FOO = $P 16 # <- variable.other 17 # ^ keyword.operator.assignment 18 # ^ keyword.other 19 # ^ string variable 20 BAR = $PATH 21 # <- variable.other 22 # ^ keyword.operator.assignment 23 # ^ keyword.other 24 # ^ string variable 25 # ^ string - variable 26 27 foo := a.o b.o c.o 28 # <- variable 29 # ^^ keyword 30 # ^^^^^^^^^^^ string 31 bar := $(foo:.o=.c) 32 # <- variable 33 # ^^ keyword 34 # ^^ keyword.other.block.begin 35 # ^ punctuation 36 # ^ punctuation 37 # ^ keyword.other.block.end 38 bar := $(foo:%.o=%.c) 39 # <- variable 40 # ^^ keyword 41 # ^ - string.unquoted 42 # ^^ keyword.other.block.begin 43 # ^ punctuation 44 # ^ variable.language 45 # ^ punctuation 46 # ^ variable.language 47 # ^ keyword.other.block.end 48 49 bar := ${foo:%.o=%.c} 50 # <- variable 51 # ^^ keyword 52 # ^ - string.unquoted 53 # ^^ keyword.other.block.begin 54 # ^ punctuation 55 # ^ variable.language 56 # ^ punctuation 57 # ^ variable.language 58 # ^ keyword.other.block.end 59 60 foo = bar # a comment 61 # ^ - string.unquoted 62 # ^ string.unquoted 63 # ^ comment.line punctuation - string.unquoted 64 65 foo = bar # a multiline \ 66 comment 67 # ^ comment.line 68 69 ################################# 70 # 6.3.2 computed variable names # 71 ################################# 72 73 x = $(y) 74 y = z 75 z = Hello 76 a := $($(x)) 77 sources := $($(a1)_objects:.o=.c) 78 dir = foo 79 $(dir)_sources := $(wildcard $(dir)/*.c) 80 # <- keyword.other.block.begin 81 #^ keyword.other.block.begin 82 # ^^ keyword.operator.assignment 83 # ^^ keyword.other.block.begin 84 # ^^ keyword.other.block.begin 85 # ^ keyword.other.block.end 86 # ^ variable.language.wildcard 87 # ^ keyword.other.block.end 88 define $(dir)_print = 89 # ^ keyword.control 90 # ^^ keyword.other.block.begin 91 # ^ keyword.other.block.end 92 # ^ keyword.operator.assignment 93 lpr $($(dir)_sources) 94 endef 95 96 define FOO 97 BAR := 1 98 define BAZ 99 # ^^^^^^ string.unquoted.makefile - keyword 100 X := 1 101 endef 102 # ^^^^^^ string.unquoted.makefile - keyword 103 Y := 3 104 endef # comment 105 #^^^^ keyword.control.makefile 106 # ^^^ comment.line.number-sign.makefile 107 108 ######################### 109 # 6.5 setting variables # 110 ######################### 111 112 FOO ?= bar 113 114 ifeq ($(origin FOO), undefined) 115 FOO = bar 116 endif 117 118 hash != printf '\043' 119 # ^ source.shell 120 file_list != find . -name '*.c' 121 # ^ source.shell 122 123 hash := $(shell printf '\043') 124 # ^ support.function 125 # ^ source.shell 126 var := $(shell find . -name "*.c") 127 # ^ support.function 128 # ^ source.shell 129 130 ######################################## 131 # 6.6 appending more text to variables # 132 ######################################## 133 134 objects = main.o foo.o bar.o utils.o 135 objects += another.o 136 CFLAGS = $(includes) -O 137 CFLAGS += -pg # enable profiling 138 139 ############################## 140 # 6.7 the override directive # 141 ############################## 142 143 override variable = value 144 # ^ keyword.control 145 override variable := value 146 override variable += more text 147 override CFLAGS += -g 148 override define foo 149 # <-keyword 150 # ^ keyword 151 # ^ variable.other 152 # ^ - string.unquoted 153 asdf 154 # <- string.unquoted 155 endef 156 # <- keyword 157 override define foo = 158 # <- keyword 159 # ^ keyword 160 # ^ variable.other 161 # ^ keyword.operator.assignment 162 # ^ - string 163 bar 164 endef 165 override define foo ?= 166 # ^^ keyword.operator.assignment 167 # ^ - string 168 bar 169 endef 170 override define foo := 171 # ^^ keyword.operator.assignment 172 # ^ - string 173 bar 174 endef 175 # ^ keyword.control 176 177 endef 178 # <- invalid.illegal.stray 179 180 ######################################## 181 # 6.11 target-specific variable values # 182 ######################################## 183 184 prog : CFLAGS = -g 185 # ^ keyword.operator 186 # ^ variable - string 187 # ^ keyword 188 # ^ - string 189 # ^^ string - meta.function.arguments 190 191 ######################################### 192 # 6.12 pattern-specific variable values # 193 ######################################### 194 195 lib/%.o: CFLAGS := -fPIC -g 196 # ^ keyword.operator 197 # ^ - string 198 # ^ string 199 # ^ - string 200 %.o: CFLAGS := -g 201 # ^ keyword.operator 202 # ^ - string 203 # ^^ string 204 # ^ - string 205 206 # Line comment 207 # <- comment 208 209 ifeq ($(shell test -r $(MAKEFILE_PATH)Makefile.Defs; echo $$?), 0) 210 # <- keyword.control 211 # ^ support.function 212 # ^^ variable.parameter keyword.other.block.begin 213 # ^^^^^^^^^^^^^ variable.parameter 214 # ^ variable.parameter keyword.other.block.end 215 # ^^^ variable.language.automatic 216 include $(MAKEFILE_PATH)Makefile.Defs 217 # <- keyword.control 218 # ^ - string 219 # ^ string 220 # IMPORTANT NOTE: Extra spaces are allowed and ignored at the beginning of 221 # the line, but the first character must not be a tab (or the value of 222 # .RECIPEPREFIX) — if the line begins with a tab, it will be considered a 223 # recipe line. 224 endif 225 # <- keyword.control 226 227 a_objects := a.o b.o c.o 228 # ^ variable.other 229 # ^^ keyword.operator.assignment 230 # ^^^^^^^^^^^ string 231 1_objects := 1.o 2.o 3.o 232 # ^^^^^^^ variable.other 233 # ^^ keyword.operator.assignment 234 # ^^^^^^^^^^^ string.unquoted 235 236 # This is NOT the start of a rule... 237 # A comment with a tab and with a : colon 238 # <- comment.line - meta.function - entity.name.function 239 240 all: foo.o 241 # ^ - string 242 # ^ string 243 # ^ - string 244 ld a 245 ar b 246 asdf 247 @echo "that's, like, your opinion man!" # some movie? 248 asdf 249 # <- invalid.illegal.inconsistent.expected.spaces 250 251 all: foo.o 252 ld a 253 ar b 254 asdf 255 @echo "that's, like, your opinion man!" # some movie? 256 # <- constant.language 257 asdf 258 # <- invalid.illegal.inconsistent.expected.tab 259 260 all: foo.o # a comment 261 # <- meta.function entity.name.function 262 # ^ keyword.operator.assignment 263 # ^ - string 264 # ^ string 265 # ^ meta.function.arguments string.unquoted 266 # ^ string 267 # ^ comment.line. punctuation - meta.function.arguments - string.unquoted 268 # ^ comment.line - punctuation - meta.function.arguments - string.unquoted 269 rm -rf / 270 # <- meta.function.body 271 272 # A make comment. 273 # ^ comment.line.number-sign.makefile 274 foo: qux 275 @bar # A shell comment. 276 # ^ comment.line.number-sign.shell 277 278 sources := $($(a1)_objects:.o=.c) 279 # ^ variable 280 # ^^ keyword.operator 281 # ^^ string variable keyword.other.block.begin 282 # ^^ string variable variable keyword.other.block.begin 283 # ^^ string variable variable 284 # ^ string variable variable keyword.other.block.end 285 # ^^^^^^^^ string variable 286 # ^ string variable punctuation.definition 287 # ^^ string variable 288 # ^ string variable punctuation.definition 289 # ^^ string variable 290 # ^ string variable keyword.other.block.end 291 292 .build/vernum: ../meta/version 293 sed -i.bak 's/.*automatically updated.*/version = "$(VER)" # automatically updated/' setup.py 294 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.body.makefile source.shell.embedded meta.function-call 295 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.single - comment 296 # ^^^^^^ variable.parameter.makefile 297 298 CC=g++ 299 #<- variable.other 300 # ^ keyword.operator.assignment 301 # ^^^ string.unquoted 302 CFLAGS=-c -Wall 303 LDFLAGS= 304 #<- variable.other 305 # ^ keyword.operator.assignment 306 SOURCES=main.cpp hello.cpp factorial.cpp 307 OBJECTS=$(SOURCES:.cpp=.o) 308 #<- variable.other 309 # ^ keyword.operator.assignment 310 # ^^ string.unquoted keyword.other.block.begin 311 # ^ string.unquoted variable.parameter punctuation.definition.substitution 312 # ^ string.unquoted variable.parameter punctuation.definition 313 # ^ string.unquoted keyword.other.block.end 314 EXECUTABLE=hello 315 316 lib: foo.o bar.o lose.o win.o 317 ar r lib $@ 318 ar whatevs 319 # <- meta.function.body 320 # <- meta.function.body 321 # BIG NOTE: This comment is actually a shell comment, not a makefile 322 # comment. Everything on a recipe line is passed to the shell; even lines 323 # starting with a numbrer sign! It depends on the particular shell if it 324 # gets treated as comments, but for all intents and purposes it should. 325 326 all: $(SOURCES) $(EXECUTABLE) 327 #<- entity.name.function 328 # ^ keyword.operator.assignment 329 # ^^ variable.parameter keyword.other.block.begin 330 # ^^^^^^^ variable.parameter 331 # ^ variable.parameter keyword.other.block.end 332 # ^^ variable.parameter keyword.other.block.begin 333 # ^^^^^^^^^^ variable.parameter 334 # ^ variable.parameter keyword.other.block.end 335 336 export FOO=foo 337 # ^ keyword.control 338 # ^ variable.other 339 # ^ keyword.operator.assignment 340 # ^ string.unquoted 341 342 $(EXECUTABLE): $(OBJECTS) 343 # <- meta.function entity.name.function 344 $(CC) $(LDFLAGS) $(OBJECTS) -o $@ 345 346 347 .cpp.o: a.c b.c 348 # <- meta.function entity.name.function 349 $(CC) $(CFLAGS) $< -o $@ 350 # ^^ meta.function.body variable.language.automatic 351 # ^^ meta.function.body variable.language.automatic 352 353 FOO = some \ 354 line \ 355 continuation \ 356 in \ 357 here 358 # ^ string.unquoted 359 360 # echo I am a comment \ 361 echo I am a comment, too! 362 # ^^^^^^^^^^^^^^^^^^^^^^^^^^ comment.line 363 364 # echo I am a comment \ 365 echo I am a comment, too! 366 echo I am no comment... 367 # ^^^^^^^^^^^^^^^^^^^^^^^ - comment.line 368 369 reverse = $(2) $(1) 370 # <- variable.other 371 # ^ keyword.operator.assignment 372 # ^^ keyword.other.block.begin 373 # ^ string.unquoted variable.parameter 374 # ^ string.unquoted 375 # ^^ keyword.other.block.begin 376 # ^ string.unquoted variable.parameter 377 # ^ keyword.other.block.end 378 379 foo = $(call reverse,a,b) 380 # ^ constant.language.call 381 # ^ string.unquoted - meta.function-call.arguments 382 # ^ string.unquoted punctuation.separator - meta.function-call.arguments 383 # ^ string.unquoted meta.function-call.arguments 384 # ^ string.unquoted meta.function-call.arguments punctuation.separator 385 # ^ string.unquoted meta.function-call.arguments 386 # ^ string.unquoted keyword.other.block.end 387 388 foo = $(call something) 389 # ^ - variable.function 390 391 foo = $(eval $(call bar)) 392 # ^ support.function 393 # ^ constant.language 394 # ^ variable.function 395 # ^^ string.unquoted keyword.other.block.end - variable.function 396 397 pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH))))) 398 # ^^^^^^^^^ meta.function-call support.function 399 # ^^^^^^^^ meta.function-call.arguments meta.function-call support.function 400 # ^^^^^^^^^ meta.function-call.arguments meta.function-call.arguments meta.function-call support.function 401 # ^ meta.function-call.arguments meta.function-call.arguments meta.function-call.arguments 402 # ^^ keyword.other.block.begin 403 # ^ meta.function-call.arguments meta.function-call.arguments meta.function-call.arguments variable.parameter 404 # ^ keyword.other.block.end 405 # ^ punctuation.separator 406 # ^^ keyword.other.block.begin 407 # ^^^^^ meta.function-call.arguments meta.function-call.arguments meta.function-call.arguments meta.function-call support.function 408 # ^ string.unquoted 409 # ^ punctuation.separator 410 # ^ string.unquoted 411 # ^ punctuation.separator 412 # ^^ keyword.other.block.begin 413 # ^^^^ meta.function-call.arguments meta.function-call.arguments meta.function-call.arguments meta.function-call.arguments variable.parameter 414 # ^ meta.function-call.arguments meta.function-call.arguments meta.function-call.arguments meta.function-call.arguments variable.parameter keyword.other.block.end 415 # ^ meta.function-call.arguments meta.function-call.arguments meta.function-call.arguments keyword.other.block.end 416 # ^ meta.function-call.arguments meta.function-call.arguments keyword.other.block.end 417 # ^ meta.function-call.arguments keyword.other.block.end 418 # ^ keyword.other.block.end 419 420 LS := $(call pathsearch,ls) 421 422 -include $(MAKEFILE_PATH)Makefile.Defs 423 # <- keyword.control.import 424 425 sinclude $(MAKEFILE_PATH)Makefile.Defs 426 # <- keyword.control.import 427 # ^ string.unquoted variable.parameter keyword.other.block.begin 428 # ^ string.unquoted variable.parameter 429 # ^ string.unquoted variable.parameter keyword.other.block.end 430 431 432 CC=g++ 433 # <- variable.other 434 # ^ keyword.operator.assignment 435 # ^ string.unquoted 436 SOURCES=main.cpp 437 SOURCES+=hello.cpp 438 # <- variable.other 439 # ^ keyword.operator.assignment 440 # ^ string.unquoted 441 442 EXECUTABLE=hello 443 444 OBJECTS=$(SOURCES:.cpp=.o) 445 # ^ string.unquoted.makefile variable.parameter.makefile 446 447 all: $(SOURCES) hello.o 448 # <- entity.name.function.makefile 449 # ^ keyword.other.block.begin 450 # ^ variable.parameter.makefile 451 452 $(EXECUTABLE): $(OBJECTS) 453 # <- keyword.other.block.begin 454 # ^ variable.parameter.makefile 455 # ^ keyword.other.block.begin 456 # ^ variable.parameter.makefile 457 @$(CC) $(LDFLAGS) $(OBJECTS) -o $@ 458 # <- constant.language 459 # ^^ variable.language.automatic 460 461 462 all: whatevs 463 @asdf 464 # <- constant.language 465 466 all: whatevs 467 @asdf 468 @echo "Heyo!" 469 # <- constant.language 470 471 export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ 472 -name CVS -o -name .pc -o -name .hg -o -name .git \) \ 473 -prune -o 474 export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \ 475 --exclude CVS --exclude .pc --exclude .hg --exclude .git 476 477 # Use spaces instead of tabs... This complicates matters. 478 .RECIPEPREFIX += 479 480 help:: 481 @echo "Excutable is $(EXECUTABLE)" 482 # <- constant.language 483 484 $(warning he:llo) 485 # ^ meta.function-call support.function 486 # ^^^ meta.function-call.arguments.makefile - punctuation 487 # ^ keyword.other.block.end 488 489 all: deps 490 $(warning he:llo) 491 # ^ meta.function-call support.function 492 # ^^^ meta.function-call.arguments.makefile - punctuation 493 # ^ keyword.other.block.end 494 deps: 495 $(warning he:llo) 496 # ^ meta.function-call support.function 497 # ^^^ meta.function-call.arguments.makefile - punctuation 498 # ^ keyword.other.block.end 499 all: 500 # ^ meta.function entity.name.function 501 # ^ keyword.operator.assignment 502 asdf 503 # <- meta.function.body 504 505 # OS detecting makefile 506 # http://stackoverflow.com/questions/714100/os-detecting-makefile 507 # 508 ifeq ($(OS),Windows_NT) 509 # ^ keyword.control 510 SEPARATOR = ; 511 # ^ variable.other 512 # ^ - variable.other 513 # ^ keyword.operator.assignment 514 # ^ string.unquoted 515 516 else 517 # ^ keyword.control 518 SEPARATOR = : 519 # ^ variable.other 520 # ^ - variable.other 521 # ^ keyword.operator.assignment 522 # ^ string.unquoted 523 endif 524 # ^ keyword.control 525 526 a_percentage_%_sign := $(SOME_C%MPLEX:SUBSTITUTI%N) 527 # ^ variable.other - variable.language 528 # ^ string.unquoted variable.parameter variable.language 529 # ^ punctuation 530 # ^ string.unquoted variable.parameter variable.language 531 532 %.cpp: %.o 533 # <- meta.function entity.name.function variable.language 534 # ^ keyword.operator 535 # ^ meta.function.arguments string.unquoted variable.language 536 @rm -rf / 537 @rm -rf / 538 # <- meta.function.body constant.language 539 #^ meta.function.body - constant.language 540 541 a = b # c 542 #<- variable.other 543 # ^ keyword.operator.assignment 544 # ^ string.unquoted 545 # ^ comment.line.number-sign punctuation.definition.comment 546 # ^ comment.line.number-sign 547 548 a = b # c 549 #<- variable.other 550 # ^ keyword.operator.assignment 551 # ^ string.unquoted 552 # ^ comment.line.number-sign punctuation.definition.comment 553 # ^ comment.line.number-sign 554 555 _modinst_: 556 @rm -rf $(MODLIB)/kernel 557 # <- constant.language 558 @rm -f $(MODLIB)/source 559 # <- constant.language 560 @mkdir -p $(MODLIB)/kernel 561 # <- constant.language 562 @ln -s `cd $(srctree) && /bin/pwd` $(MODLIB)/source 563 # <- constant.language 564 @if [ ! $(objtree) -ef $(MODLIB)/build ]; then \ 565 rm -f $(MODLIB)/build ; \ 566 ln -s $(CURDIR) $(MODLIB)/build ; \ 567 fi 568 @cp -f $(objtree)/modules.order $(MODLIB)/ 569 # <- constant.language 570 @cp -f $(objtree)/modules.builtin $(MODLIB)/ 571 # <- constant.language 572 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst 573 574 575 $(sort $(a)): $(b) ; 576 # ^ keyword.operator 577 578 %:x 579 # <- meta.function entity.name.function variable.language 580 #^ keyword.operator 581 rm -rf / 582 583 a : b ; 584 # <- meta.function entity.name.function 585 # ^ keyword.operator - entity.name.function 586 # ^ - string.unquoted 587 # ^ meta.function.arguments string.unquoted 588 # ^ - string.unquoted 589 # ^ punctuation.terminator 590 591 a : b \ 592 more prerequisites \ 593 on a third line even 594 # ^ meta.function.arguments string.unquoted 595 @rm -rf / 596 # <- meta.function.body constant.language 597 598 a : b ; rm -rf / 599 # ^ punctuation.terminator 600 # ^ source.shell 601 602 a-$(b) := c 603 # ^ keyword.other.block.begin 604 # ^ keyword.other.block.end 605 # ^^ keyword.operator 606 # ^ string.unquoted 607 608 $(a): b 609 # <- keyword.other.block.begin 610 # ^ meta.function entity.name.function keyword.other.block.end 611 # ^ keyword.operator 612 # ^ meta.function.arguments string.unquoted 613 $(Q)$(MAKE) $(build)=$@ 614 # <- meta.function.body 615 # ^^ meta.function.body variable.language.automatic 616 617 $(a:b=c) : d 618 # <- meta.function entity.name.function 619 # ^ - meta.function.arguments 620 # ^ meta.function.arguments 621 $(Q)$(MAKE) $(build)=$@ 622 # <- meta.function.body 623 # ^^ meta.function.body variable.language.automatic 624 625 $(X:a=b) : w ; 626 # <- meta.function entity.name.function variable.parameter keyword.other.block.begin 627 # ^ keyword.operator 628 # ^ meta.function.arguments string.unquoted 629 # ^ - string.unquoted 630 # ^ punctuation.terminator 631 632 $(Y:%.cpp=%.o) := $(Z) 633 # <- - meta.function 634 # ^^ keyword.operator.assignment 635 636 $(call my_func,my_arg): deps 637 # <- meta.function entity.name.function 638 # ^ keyword.operator.assignment 639 # ^ - keyword.operator.assignment 640 rm -rf / 641 642 $(foreach i,j,k): deps 643 # <- meta.function entity.name.function 644 # ^ keyword.operator.assignment 645 # ^ - keyword.operator.assignment 646 rm -rf / 647 # <- meta.function.body 648 649 $(foreach i,$(a),$(foreach j,$(b),x)): deps 650 # <- meta.function entity.name.function 651 # ^ keyword.operator.assignment 652 # ^ - keyword.operator.assignment 653 rm -rf / 654 # <- meta.function.body 655 656 include $(c) 657 ifneq ($(a),) 658 $(b): ; rm -rf / 659 # ^ meta.function.body source.shell 660 @git clone asdf 661 # <- meta.function.body constant.language 662 # ^ meta.function.body 663 endif 664 665 define filechk_utsrelease.h 666 if [ `echo -n "$(KERNELRELEASE)" | wc -c ` -gt $(uts_len) ]; then \ 667 echo '"$(KERNELRELEASE)" exceeds $(uts_len) characters' >&2; \ 668 exit 1; \ 669 fi; \ 670 (echo \#define UTS_RELEASE \"$(KERNELRELEASE)\";) 671 endef 672 # <- keyword.control 673 674 endef 675 # <- invalid.illegal.stray 676 677 # meta.group.conditional balancing 678 ifeq ($(shell git status >/dev/null 2>&1 && echo USING_GIT),USING_GIT) 679 ifeq ($(shell git svn info >/dev/null 2>&1 && echo USING_GIT_SVN),USING_GIT_SVN) 680 # git-svn 681 ifeq ($(REVISION),) 682 REVISION := $(shell git svn find-rev git-svn) 683 endif 684 VCSTURD := $(subst $(SPACE),\ ,$(shell git rev-parse --git-dir)/refs/remotes/git-svn) 685 else 686 # plain git 687 ifeq ($(REVISION),) 688 REVISION := $(shell git describe --always HEAD) 689 endif 690 GIT_BRANCH := $(shell git symbolic-ref HEAD 2>/dev/null) 691 VCSTURD := $(subst $(SPACE),\ ,$(shell git rev-parse --git-dir)/$(GIT_BRANCH)) 692 endif 693 else ifeq ($(shell hg root >/dev/null 2>&1 && echo USING_HG),USING_HG) 694 # ^ keyword.control 695 # ^ keyword.control 696 # mercurial 697 ifeq ($(REVISION),) 698 REVISION := $(shell hg id -i) 699 endif 700 VCSTURD := $(subst $(SPACE),\ ,$(shell hg root)/.hg/dirstate) 701 else ifeq ($(shell svn info >/dev/null && echo USING_SVN),USING_SVN) 702 # ^ keyword.control 703 # ^ keyword.control 704 # subversion 705 ifeq ($(REVISION),) 706 REVISION := $(subst :,-,$(shell svnversion -n)) 707 endif 708 # This used to break the makefile syntax because we didn't properly account 709 # for closing parentheses in shell-strings. We now use our own quoted string 710 # context in the with_prototype override so that we can account for this. 711 # This does mean that the shell syntax looks a tiny bit different. 712 VCSTURD := $(addsuffix /.svn/entries, $(shell svn info | grep 'Root Path' | sed -e 's/\(.*\:\)\(.*\) /\2/')) 713 # ^ string.quoted.single.shell punctuation.definition.string.begin.shell 714 # ^ string.quoted.single.shell punctuation.definition.string.end.shell 715 endif 716 # <- keyword.control 717 718 ifeq (0,1) 719 $(info zero is one) 720 else ifneq (1,2) 721 $(info one is not equal to two) 722 else ifeq ("asf",asdf") 723 $(info foo) 724 else ifeq (2,3) 725 $(info one is equal to three) 726 else ifeq "2" "3" 727 $(info asdf) 728 else ifeq '2' "3" 729 $(info asdf) 730 else ifeq "2" '3' 731 $(info asdf) 732 else ifeq '2' '3' 733 $(info asdf) 734 else ifdef X 735 $(info X is defined) 736 else ifndef Y 737 $(info Y is not defined) 738 endif 739 # <- keyword 740 741 ifeq (0,1) 742 $(info asdf) 743 else 744 ifeq (0,1) 745 $(info asdf) 746 endif 747 # <- keyword 748 749 a:b 750 ifeq (0,1) 751 $(info asdf) 752 else # some comment 753 # ^ comment.line 754 $(info asdf) 755 endif 756 # <- keyword 757 758 # Another case where the lookahead for the colon used to fail: 759 ifneq ($(words $(subst :, ,$(CURDIR))), 1) 760 # ^ meta.function-call.arguments meta.function-call.arguments - keyword.operator 761 $(error main directory cannot contain spaces nor colons) 762 endif 763 764 ifeq ($(shell which inkscape >/dev/null 2>&1 && echo USING_INKSCAPE),USING_INKSCAPE) 765 # <- keyword.control.conditional 766 $(FIGS)/%.pdf: $(FIGS)/%.svg ## Figures for the manuscript 767 # <- meta.function entity.name.function 768 # ^ keyword.operator.assignment 769 # ^ meta.function.arguments string.unquoted 770 # ^ comment.line - string.unquoted 771 inkscape -C -z --file=$< --export-pdf=$@ 2> /dev/null 772 # <- meta.function.body 773 endif 774 # <- keyword.control.conditional 775 776 vpath dir/*/whatevs whatevs 777 # ^ keyword.control.vpath 778 # ^ variable.language.wildcard 779 # ^ string.unquoted.makefile 780 781 vpath asdf/* 782 # ^ keyword.control.vpath 783 # ^ variable.language.wildcard 784 vpath 785 # ^ keyword.control.vpath.makefile 786 787 # a comment check 788 # <- comment.line 789 790 rule: asdf 791 @rm -rf / 792 # <- meta.function.body 793 794 ifneq ($(REVISION),) 795 # ^ keyword.control.conditional 796 REVDEPS += revision.tex 797 revision.tex: $(VCSTURD) 798 /bin/echo '\newcommand{\Revision}'"{$(subst _,\_,$(REVISION))}" > $@ 799 # ^ - invalid.illegal 800 # ^ meta.function-call.makefile 801 # ^^ meta.function.body meta.function-call.arguments variable.parameter 802 AUXFILES += revision.aux 803 endif 804 805 build_target: 806 @echo "${INFO_CLR}>> Building $(TARGET)...${RESTORE_CLR}${RESULT_CLR}" 807 # <- constant.language 808 ifdef WORKSPACE 809 @xcodebuild -sdk iphoneos -workspace "$(WORKSPACE).xcworkspace" -target "$(TARGET)" -configuration "$(CONFIG)" SYMROOT="$(BUILD_PATH)/Products" -jobs 6 build 2>/dev/null | tail -n 2 | cat && printf "${RESET_CLR}" 810 # <- constant.language 811 else 812 @xcodebuild -sdk iphoneos -project "$(PROJECT).xcodeproj" -target "$(TARGET)" -configuration "$(CONFIG)" CONFIGURATION_BUILD_DIR="$(BUILD_PATH)/Products" -jobs 6 build 2>/dev/null | tail -n 2 | cat && printf "${RESET_CLR}" 813 # <- constant.language 814 endif 815 ifndef ARDMK_DIR_MSG 816 $(call show_config_variable,ARDMK_DIR,[COMPUTED],(relative to $(notdir $(lastword $(MAKEFILE_LIST))))) 817 # ^ variable.function 818 # ^ support.function 819 # ^ support.function 820 # ^ - keyword.other.block.end 821 # ^ keyword.other.block.end 822 else 823 $(call show_config_variable,ARDMK_DIR,[USER]) 824 # ^ constant.language 825 # ^ variable.function 826 endif 827 828 kselftest-merge: 829 $(if $(wildcard $(objtree)/.config),, $(error No .config exists, config your kernel first!)) 830 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \ 831 -m $(objtree)/.config \ 832 # ^ - constant.language.makefile 833 $(srctree)/tools/testing/selftests/*/config 834 +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig 835 836 search: 837 @$(MAKE) --no-print-directory \ 838 -f core/core.mk $(addprefix -f,$(wildcard index/*.mk)) -f core/index.mk \ 839 # ^ variable.language.wildcard 840 search 841 842 CC_VERSION := $(shell $(CC) -dumpversion) 843 $(call show_config_variable,CC_VERSION,[COMPUTED],($(CC_NAME))) 844 # ^ keyword.other.block.end 845 # ^ - keyword.other.block.end 846 # ^ keyword.other.block.end 847 848 # A recipe may contain empty lines like below 849 help: 850 @echo 'Cleaning targets:' 851 # <- meta.function.body constant.language 852 853 @echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' 854 # <- meta.function.body constant.language 855 # ^ - keyword.operator.assignment 856 # ^ string.quoted.single.shell 857 @echo ' 1: warnings which may be relevant and do not occur too often' 858 # <- meta.function.body constant.language 859 # ^ - keyword.operator.assignment 860 @echo ' 2: warnings which occur quite often but may still be relevant' 861 # <- meta.function.body constant.language 862 863 CC_VERSION := $(shell $(CC) -dumpversion) 864 $(call show_config_variable,CC_VERSION,[COMPUTED],($(CC_NAME))) 865 # ^ keyword.other.block.end 866 # ^ - keyword.other.block.end 867 # ^ keyword.other.block.end 868 869 LIBRARIES := $(filter $(notdir $(wildcard $(HOME)/energia_sketchbook/libraries/*)), \ 870 $(shell sed -ne "s/^ *\# *include *[<\"]\(.*\)\.h[>\"]/\1/p" $(SOURCES))) 871 # ^ string.quoted.double.shell punctuation.definition.string.begin.shell 872 # ^ string.quoted.double.shell punctuation.definition.string.end.shell 873 874 # FIX: https://github.com/sublimehq/Packages/issues/1941 875 escape_shellstring = $(subst `,\`,$(subst ",\",$(subst $$,\$$,$(subst \,\\,$1)))) 876 # ^^^^^^^^ meta.function-call.makefile 877 # ^^^^^ meta.function-call.arguments.makefile - meta.function-call.makefile 878 # ^^^^^^^^ meta.function-call.arguments.makefile meta.function-call.makefile 879 # ^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile - meta.function-call.makefile 880 # ^^^^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.makefile 881 # ^^^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile - meta.function-call.makefile 882 # ^^^^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.makefile 883 # ^^^^^^^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile - meta.function-call.makefile 884 # ^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile meta.function-call.arguments.makefile keyword.other.block.end.makefile 885 # ^ meta.function-call.arguments.makefile meta.function-call.arguments.makefile keyword.other.block.end.makefile 886 # ^ meta.function-call.arguments.makefile keyword.other.block.end.makefile 887 # ^ keyword.other.block.end.makefile 888 # ^ - meta 889 # ^ - punctuation 890 # ^ punctuation.separator.makefile 891 # ^^ - punctuation 892 # ^ - punctuation 893 # ^ punctuation.separator.makefile 894 # ^^ - punctuation 895 896 .SECONDEXPANSION: 897 # <- meta.function entity.name.function 898 # ^ keyword.operator.assignment - entity.name.function 899 # ^ - keyword.operator.assignment - entity.name.function 900 $(DO_IMPLS): $$(foreach s,$$(STEPS),$$(call $$(@)_STEP_TO_PROG,$$(s))) 901 # <- meta.function entity.name.function 902 # ^ keyword.operator.assignment - entity.name.function 903 # ^ - keyword.operator.assignment - entity.name.function 904 # ^ meta.function.arguments support.function 905 # ^^^^^^^^^^^^^^^^^^ variable.function 906 # ^ punctuation.separator 907 908 .SECONDEXPANSION: 909 $(foreach i,$(DO_IMPLS),$(foreach s,$(STEPS),$(i)^$(s))): $$(call $$(word 1,$$(subst ^, ,$$(@)))_STEP_TO_PROG,$$(word 2,$$(subst ^, ,$$(@)))) 910 # <- meta.function entity.name.function 911 # ^ keyword.operator.assignment 912 # ^ - keyword.operator.assignment 913 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variable.function 914 # ^ punctuation.separator 915 NAME = FeedProcessorSIAC 916 917 target2: 918 @# Comment Text 919 #^ comment - variable 920 @# FeedProcessorSIAC -origin CQS -decodeData "binData" 921 #^ comment - variable 922 923 @# # Regular Message 924 #^ comment - variable 925 @FeedProcessorSIAC -origin CTS -decodeData "binData" 926 927 TESTTOOL = sh -c '\ 928 # ^ keyword.operator.assignment.makefile 929 # ^^^^^^ meta.string.makefile - meta.interpolation 930 # ^^^ meta.string.makefile meta.interpolation.makefile 931 # ^^^^^^ string.unquoted.makefile 932 # ^ punctuation.section.interpolation.begin.makefile 933 # ^ source.shell.embedded punctuation.separator.continuation.line.shell - source.shell source.shell 934 if something; then 935 build_thisway $$1 $$2; 936 fi' TESTTOOL 937 # ^^^ meta.string.makefile meta.interpolation.makefile 938 # ^^^^^^^^^ meta.string.makefile string.unquoted.makefile - meta.interpolation 939 # ^^ source.shell.embedded keyword.control.conditional.end.shell - source.shell source.shell 940 # ^ punctuation.section.interpolation.end.makefile 941 942 943 # Fix https://github.com/sublimehq/Packages/issues/2388 944 html: 945 $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) 946 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function.body.makefile source.shell.embedded.makefile - source.shell source.shell 947 # ^^^^^^^^^^ meta.function-call.identifier.shell 948 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ meta.function-call.arguments.shell 949 # ^^^^^^^^^^^ variable.parameter.makefile 950 # ^^ variable.parameter.option.shell 951 # ^^^^^^^^^^^ variable.parameter.makefile 952 # ^^ variable.parameter.option.shell 953 # ^^^^^^^^^^^ variable.parameter.makefile 954 # ^^^^^^^^^^^^^^ variable.parameter.makefile