This fixes a problem with commands like gzip, where if $GZIP is exported in the environment, then when make runs a command it'll put the Makefile variable's value in the environment. But gzip treats $GZIP as arguments for itself, so when we run gzip it thinks we're giving it "gzip" as an argument.
Now, adding dyn to $(GhcLibWays) is how shared libs are enabled. Everything else keys off that, rather than testing $(BuildSharedLibs).
Building a profiled GHC is as simple as adding GhcLibWays += p GhcProfiled = YES to your build.mk and saying 'make'. Then you have a profiled inplace/bin/ghc-stage2.
- get rid of $(FptoolsHcOpts), it was ill-conceived. As it was, $(FptoolsHcOpts) was overriding options in $(GhcHcOpts). Now, we just use $(SRC_HC_OPTS) instead, which can be overriden by $(GhcHcOpts). - Don't bother adding -ldl to $(SRC_HC_OPTS) in config.mk. It is added to the RTS's package configuration if necessary.