[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Defining macros
---------------
The general syntax for defining a macro in a makefile is:
MacroName = expansion_text
o "MacroName" is case-sensitive and is limited to 512 characters.
o "expansion_text" is limited to 4096 characters consisting of
alpha-numeric characters, punc-tuation, and white space.
Each macro must be on a separate line in a makefile. Macros are
usually put at the top of the makefile. If MAKE finds more than one
definition for a "macroName", the new definition replaces the old one.
Macros can also be defined using the command-line option -D. More than
one macro can be defined by separating them with spaces. The following
examples show macros defined at the command line:
make -Dsourcedir=c:\projecta
make command="bcc -c"
make command=bcc option=-c
The following differences in syntax exist between macros entered on
the command line and macros written in a makefile.
Makefile Command line
-------- ------------
Spaces allowed before
and after = Yes No
Space allowed before
macroName No Yes
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson