Break long dependencies in Makefile into several lines

from the documentation https://www.gnu.org/software/make/manual/make.html#Splitting-Lines

Makefiles use a “line-based” syntax in which the newline character is special and marks the end of a statement. GNU make has no limit on the length of a statement line, up to the amount of memory in your computer.

However, it is difficult to read lines which are too long to display without wrapping or scrolling. So, you can format your makefiles for readability by adding newlines into the middle of a statement: you do this by escaping the internal newlines with a backslash (\) character.

It works for targets too, i.e.:

a b c d:
        touch $@

multiline_dependencies: a \
 b \
 c \
 d
        touch $@

and to verify, make multiline_dependencies --dry-run gives the following output

touch a
touch b
touch c
touch d
touch multiline_dependencies

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)