Hmmm, if we go for proper libraries, most flags could be made to only affect the particular package and I think they should.

The following scheme should work: The user can decide globally via configuration about stuff like -g/debug -inline -O -noboundscheck, ...

Packages can blacklist or force certain (compiler abstracted) flags if needed:

E.g.:

"buildFlags" : [ "noinline", "boundscheck" ]

Meaning:

  • Even if the user specified -inline, don't use it for this package, because of some bug.
  • Use boundscheck even if user disabled it, because our code really sucks, so this should really not be disabled.

If needed, a package could also specify default flags for the case that the user did not specify anything, but get overridden with user data, instead of only providing the option to override user choices.

The default flags for a package could even be extracted from the developer's global settings at release time to make sure that the best tested settings are the default.