Adding extra C compiler arguments when building with hadrian?

Daniel Gröber dxld at darkboxed.org
Mon Feb 10 13:15:55 UTC 2020


Hi,

On Mon, Feb 10, 2020 at 03:57:27PM +0300, Ömer Sinan Ağacan wrote:
> In make build system I can add extra C compiler arguments to any flavor using
> something like
> 
>     BuildFlavour = ...
> 
>     ifneq "$(BuildFlavour)" ""
>     include mk/flavours/$(BuildFlavour).mk
>     endif
> 
>     GhcRtsHcOpts += -O0 -g3
> 
> How do I do the same in hadrian when defining a flavor?

I was experimenting with building ghc with -fsanitize=address and have
this in hadrin/UserSettings.hs still:

    userFlavour = defaultFlavour
      { name = "user"
      , args = mconcat
        [ builder Cc ? arg "-fsanitize=address"
        , builder (Ghc CompileCWithGhc) ? arg "-optc -fsanitize=address"
        , builder (Ghc LinkHs) ? arg "-optl -fsanitize=address"
        ]
      }

I'm not sure when (builder Cc) is used vs. (Ghc CompileCWithGhc) so I
just add flags to both ;)

I think you can restrict these args to just the rts package with
something like `package rts ? ...` on each line, also `import Package`
to get the `rts` binder.

--Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200210/37ad25c9/attachment.sig>


More information about the ghc-devs mailing list