Skip to main content
Bounty Awarded with 100 reputation awarded by sideshowbarker
Commonmark migration
Source Link

If you're using GNU make, you can use the define syntax for multi-line variables:

define message =
You can also include make macros like
    $$@ = $@
in a multi-line variable
endef

help:; @ $(info $(message)) :

By playing with the value function and the export directive, you can also include a whole script in your Makefile, which will allow you to use a multi-line command without turning on .ONESHELL globally:

define _script
echo SHELL is $SHELL, PID is $$
cat <<'EOF'
literally $SHELL and $$
EOF
endef
export script = $(value _script)

run:; @ eval "$$script"

will give

SHELL is /bin/sh, PID is 12434
literally $SHELL and $$

If you're using GNU make, you can use the define syntax for multi-line variables:

define message =
You can also include make macros like
    $$@ = $@
in a multi-line variable
endef

help:; @ $(info $(message)) :

By playing with the value function and the export directive, you can also include a whole script in your Makefile, which will allow you to use a multi-line command without turning on .ONESHELL globally:

define _script
echo SHELL is $SHELL, PID is $$
cat <<'EOF'
literally $SHELL and $$
EOF
endef
export script = $(value _script)

run:; @ eval "$$script"

will give

SHELL is /bin/sh, PID is 12434
literally $SHELL and $$

If you're using GNU make, you can use the define syntax for multi-line variables:

define message =
You can also include make macros like
    $$@ = $@
in a multi-line variable
endef

help:; @ $(info $(message)) :

By playing with the value function and the export directive, you can also include a whole script in your Makefile, which will allow you to use a multi-line command without turning on .ONESHELL globally:

define _script
echo SHELL is $SHELL, PID is $$
cat <<'EOF'
literally $SHELL and $$
EOF
endef
export script = $(value _script)

run:; @ eval "$$script"

will give

SHELL is /bin/sh, PID is 12434
literally $SHELL and $$
added 638 characters in body
Source Link
user313992
user313992

If you're using GNU make, you can use the define syntax for multi-line variables:

define message =
You can also include make macros like
    $$@ = $@
in a multi-line variable
endef

help:; @ $(info $(message)) :

By playing with the value function and the export directive, you can also include a whole script in your Makefile, which will allow you to use a multi-line command without turning on .ONESHELL globally:

define _script
echo SHELL is $SHELL, PID is $$
cat <<'EOF'
literally $SHELL and $$
EOF
endef
export script = $(value _script)

run:; @ eval "$$script"

will give

define message =
You can also include make macros like
    $$@SHELL =is $@
in/bin/sh, aPID multi-lineis variable
endef
12434
help:; @literally $(info$SHELL $(message))and :$$

If you're using GNU make, you can use the define syntax for multi-line variables:

define message =
You can also include make macros like
    $$@ = $@
in a multi-line variable
endef

help:; @ $(info $(message)) :

If you're using GNU make, you can use the define syntax for multi-line variables:

define message =
You can also include make macros like
    $$@ = $@
in a multi-line variable
endef

help:; @ $(info $(message)) :

By playing with the value function and the export directive, you can also include a whole script in your Makefile, which will allow you to use a multi-line command without turning on .ONESHELL globally:

define _script
echo SHELL is $SHELL, PID is $$
cat <<'EOF'
literally $SHELL and $$
EOF
endef
export script = $(value _script)

run:; @ eval "$$script"

will give

SHELL is /bin/sh, PID is 12434
literally $SHELL and $$
added 50 characters in body
Source Link
user313992
user313992

If you're using GNU make, you can use the define syntax for multi-line variables:

define message =
putYou somecan longalso messageinclude heremake macros like
    $$@ = $@
in a multi-line variable
endef

help:; @ $(info $(message)) :

If you're using GNU make, you can use the define syntax for multi-line variables:

define message =
put some long message here 
endef

help:; @ $(info $(message)) :

If you're using GNU make, you can use the define syntax for multi-line variables:

define message =
You can also include make macros like
    $$@ = $@
in a multi-line variable
endef

help:; @ $(info $(message)) :
Source Link
user313992
user313992
Loading