When I run cabal build for my project, it places my compiled executable in
dist-newstyle/build/$PLATFORM/$GHC/$PACKAGE-$VERSION/x/$PACKAGE/build/$PACKAGE/$PACKAGE
I'm using a Makefile to run cabal build as needed when I need to run the executable.
Since I'm working on different platforms at various times, I need a way to tell my Makefile what to expect the $PLATFORM value to be.
There's a couple ways I could go about this:
run cabal build once unconditionally, and then use wildcards:
BIN := $(wildcard dist-newstyle/build/*/ghc-*/foo-*/x/foo/build/foo/foo)
use uname to predict what the platform will be
BIN := dist-newstyle/build/$(shell uname -m)-$(shell uname -s | some magic)/ghc-$(shell ghc --version | some magic)/foo-$(VERSION)/x/foo/build/foo/foo
give up on making sure the binary is up to date within the Makefile and just run cabal run unconditionally
Any of those would work, but I would like to know if I could just ask cabal to tell me where it expects to place an executable.
Is there a cabal command I can run to tell me what $PLATFORM and/or $GHC values it detects?
cabal exec which $EXENAME$ will give you the full path of the compiled executable.
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