Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland MAKE v4.0 - string substitutions in macros http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
String substitutions in macros
------------------------------
MAKE lets you temporarily substitute characters in a previously
defined macro.  For example, if you defined a macro called SOURCE as
"SOURCE = f1.cpp f2.cpp f3.cpp", you could substitute the characters
.OBJ for the characters .CPP by using "$(SOURCE:.CPP=.OBJ)". The
substitution doesn't redefine the macro.

Rules for macro substitution:

  o  Syntax: $(MacroName:original_text=new_text)

  o  No whitespace before or after the colon.

  o  Characters in "original_text" must exactly match the characters in the
     macro definition; this text is case-sensitive.

MAKE now lets you use macros within substitution macros. For example:

  MYEXT=.C
  SOURCE=f1.cpp f2.cpp f3.cpp
  $(SOURCE:.cpp=$(MYEXT))         #Changes f1.cpp to f1.C, etc.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson