Q:

Howto make gnumake behave as if default options in command line were passed?

I am using a makefile in which if I pass options in the command line like
make OPT1=opt1 OPT1=2

I get a different behavior than if I edit Makefile and write there
OPT1=opt1
OPT2=opt2

and then then run 
make

on the command line.
The behavior I want is the one where I use the options in the command line.Right now I am using an alias but I am interested in knowing if this can be done purely with the Makefile alone.
Thanks.

A:

The way I end up solving this was the following:
mv Makefile Makefile.aux

then create a now Makefile with the contents
OPT1=true
OPT2=false

DEFAULT_OPTS=--no-print-directory OPT1=$(OPT1) OPT2=$(OPT2)

.PHONY : $(MAKECMDGOALS)
$(MAKECMDGOALS):
        $(MAKE) -f Makefile.aux $(DEFAULT_OPTS) $(MAKEFLAGS) $(MAKECMDGOALS)

.PHONY: all
all:
        $(MAKE) -f Makefile.aux $(DEFAULT_OPTS) $(MAKEFLAGS) $(MAKECMDGOALS)

The reason I use --no-print-directory is because if I use this method without this option it will print an extra message in the beggining and in the end of the compilation.

