You can almost get that with cabal configurations and the field Buildable: [...] Flag devel Default: False [...] Executable foo if flag(devel) Buildable: False [...]
With that if you pass --flags="devel" to configure the executable foo won't be built.