Makefiles contain five kinds of things: explicit rules, implicit rules, variable definitions, directives, and comments. Rules, variables, and directives are described at length in later chapters.
objects
as a list of all object files (see Variables Make Makefiles Simpler). make
to do something special while reading the makefile. These include: #
, escape it with a backslash (e.g., \#
). Comments may appear on any line in the makefile, although they are treated specially in certain situations. You cannot use comments within variable references or function calls: any instance of #
will be treated literally (rather than as the start of a comment) inside a variable reference or function call.
Comments within a recipe are passed to the shell, just as with any other recipe text. The shell decides how to interpret it: whether or not this is a comment is up to the shell.
Within a define
directive, comments are not ignored during the definition of the variable, but rather kept intact in the value of the variable. When the variable is expanded they will either be treated as make
comments or as recipe text, depending on the context in which the variable is evaluated.
• Splitting Lines | Splitting long lines in makefiles |
Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Free Software Foundation, Inc.
Licensed under the GNU Free Documentation License.
https://www.gnu.org/software/make/manual/html_node/Makefile-Contents.html