File: multiline_recipe.mk

package info (click to toggle)
android-platform-build-kati 10.0.0%2Br32%2Bgit20220314.09dfa26c4e59-7.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,628 kB
  • sloc: cpp: 10,340; sh: 1,087; python: 85; makefile: 46
file content (54 lines) | stat: -rw-r--r-- 671 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# TODO(c/test6): fix test6 - \t$${empty} should be empty.
MAKEVER:=$(shell make --version | grep "Make [0-9]" | sed -E 's/.*Make ([0-9]).*/\1/')
ifeq ($(MAKEVER),4)
AT=@
endif

# http://www.gnu.org/software/make/manual/make.html#Splitting-Recipe-Lines
test1:
	$(AT) echo no\
space
	$(AT) # echo no\
	# space
	$(AT) echo one \
	space
	$(AT) echo one\
	 space

test2:
	$(AT) for d in foo bar; do \
	  echo $$d ; done

define cmd3
echo foo
echo bar
endef

test3:
	$(cmd3)

define cmd4
echo foo ; \
echo bar
endef

test4:
	$(cmd4)

test5:
	$(AT) echo foo \
	$$empty bar

test6:
	echo foo\
	$${empty}bar

define cmd7
@echo first
@echo second
endef

test7:
	$(cmd7) \
	 third