I almost thought I had it solved, but I can't quite get it to do exactly what I want.

I'm trying to write a makefile that will create either debug or release files depending on what I specify. What I'd like to be able to run is:
Code:
make debug all
make release static
make debug shared
...
I thought I found the solution by doing: ifeq "$@" "debug" ..., but I think when it gets to the next parameter ("all" for example), whatever variables I set in the first stage with "debug" are lost.

Is there a way to do this?
I want to do exactly the same thing in both debug & release, except in debug I want to add a few things to the end of my CFLAGS, HEADERS & OBJS variables.