[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] mintlib Makefile requires bash as shell
Hi,
On Sunday 18 October 2009, Vincent Rivière wrote:
> >> I mean makefile "variables" are constants that can't be reaffected by
> >> the command part of the rules.
> >
> > Sorry, still don't understand. Can you give an example?
>
> $ cat Makefile
> RESULT = false
> all:
> RESULT = true
>
> $ make
> RESULT = true
> make: RESULT: Command not found
> make: *** [all] Error 127
The problem here is that in shell you cannot have spaces around '='.
> RESULT is a "makefile variable", it can't be assigned during the
> execution of "make" (or maybe there is another syntax).
RESULT = false
RESULT = true
works fine.
As I think should:
RESULT ?= false
all:
if ($$(RESULT) == false) \
RESULT=true $(MAKE); \
fi
But above is of course better if you split setting the stuff
and using them into separate Makefiles. And have some variable
which blocks the build if it notices that things are called without
calling the thing that sets up things.
- Eero