help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Passing values to compiler from command line


From: Bert Wesarg
Subject: Re: Passing values to compiler from command line
Date: Mon, 28 Jun 2010 12:05:45 +0200

On Mon, Jun 28, 2010 at 11:43, Gary <address@hidden> wrote:
> What is the accepted way to do this, please?
>
> At the moment I have
> ,----[ Makefile ]
> |...
> | DEBUG_OPT=-D _DEBUG
> | CFLAGS=${DEBUG} ...
> |...
> | debug:
> |       $(MAKE) DEBUG="${DEBUG_OPT}"
> `----
>
> So if I want to build everything as debug, I just do
> ,----
> | $ make debug
> `----
>
> And if I want to build single targets, I do
> ,----
> | $ env DEBUG='-D _DEBUG' make ./Src/equipment/manufacturer/foo/bar.php
> `----
>
> It's a bit clumsy in the latter case, but it works. Is there a better
> solution?

I'm using for smal Makefiles this:

--8<--
ifdef DEBUG
CFLAGS+=-D _DEBUG
endif
-->8--

and use it like this:

$ make DEBUG=1 <target>

Bert

>
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]