I was trying to use bnfc
tool to generate a bunch of files, like lexer, parser, etc. for me. This works fine. Now I wanted to clean this up a bit by not having to manually compile the bnfc
file and having it generate a number of files which clutter my /src
folder.
I tried the Cabal mechanism where you list the tool in build-tools
field of the .cabal
file and mention the files you expect to be generated by extra-source-files
field. This worked for me for Alex and Happy as they are recognised as build-tools by Cabal but bnfc
isn't. Is there a way I can hook up bnfc
or any tool in general with Cabal and have Cabal recognise them as build-tools?
Apparently cabal doesn't know about bnfc (doesn't appear on the list).
Looks like there's no way to do it using just the .cabal file, but there's an example of how to hook up a preprocessor in your Setup.hs
in the cabal sources under tests/PackageTests/CustomPreProcess/Setup.hs using the user hook hookedPreProcessors
(all hooks are in UserHooks.hs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With