[erlang-questions] Macro expansion

Chandru chandrashekhar.mullaparthi@REDACTED
Fri Aug 14 11:15:46 CEST 2009


2009/8/14 Richard Carlsson <richardc@REDACTED>

> Chandru wrote:
> > Hi all,
> >
> > I need some help with passing command line parameters to the compiler.
> >
> > I have some macros in a module. I want to be able to pass the value for
> > these macros at compile time as command line parameters. I'm using
> Makefiles
> > which invoke 'erl -make'. How do I pass these macro values so that the
> > compiler is able to extract them and compile the module?
>
> From the documentation of make (the erlang module):
>
>  the following Emakefile means that file1 shall be compiled with the
>  options [debug_info,{i,"../foo"}], while all other files in the
>  current directory shall be compiled with only the debug_info flag.
>
>  {'file1',[debug_info,{i,"../foo"}]}.
>  {'*',[debug_info]}.
>
> And from the documentation of the 'compile' module:
>
>  {d,Macro}
>  {d,Macro,Value}
>  Defines a macro Macro to have the value Value. The default is true).
>

Thanks Richard. I know about this feature, but I don't want to put the macro
values in the Emakefile if I can help it. I want to be able to do 'erl
-make' and then include the values for the macros on the command line. It
seems to be possible, but I'm not able to figure out how I supply these on
the command line.

Chandru


More information about the erlang-questions mailing list