vslavik/bakefile — pull request #27 by vadz (2014-03-09 22:10:25+00:00)
Title: Minimal support for configurations in gnu backend.

There are two things here:

First, apparently using configurations in gnu backend just works already. I'm sure I must be missing something here, but I'd need you to tell me what exactly.

Second, and actually more important to me in practice, I want `make config=debug` to do the right thing. This is my first (and not final) attempt to do this and I'd like to know what do you think of it. Things I have my own doubts about:
1. What should be done by default if no configuration is specified? Currently I do nothing because I couldn't decide what to do, but I'm not sure if this is a good rationale. Although it does seem consistent with a "default" makefile behaviour.
1. Is it a problem that configurations are called "Debug" and "Release" and the comparison is case-sensitive? It would be definitely more Unix-ish to use `config=debug` instead of `config=Debug` that you actually need now. But I don't know what to do about this neither.
1. Should it be `config` (Premake 4), `CONFIG` (Premake 3, some Google tools, many others), `CFG` (nmake transfuges?) or something else? This is trivial, of course, but there just doesn't seem to be any predominant convention here.
1. Should it even be `make whatever=debug` at all or just `make debug=1` or even simply `make debug`? I discarded the latter because it doesn't allow to build only some file in debug, but it's definitely the most convenient for the most common case. And the one before last is inconvenient from implementation point of view as it's not clear what should happen when `make debug=1 release=1` is used but, again, arguably it's more natural from the user point of view.
1. Is it worth making this more customizable, e.g. instead of setting `XFLAGS` directly, set some `$(config)_XFLAGS` and then use them as part of `XFLAGS`? This would make both adding flags and overriding `-g` with `-ggdb` or something like that on make command line easier, but would make the makefile preamble even more complicated. Is it worth it?