Benjamin Kovach
Benjamin Kovach

Reputation: 3260

How do I change GHC's compile directory?

I have a program, say src/sample.hs, and I want it to compile (using ghc --make) to build/sample.exe.

I've figured out how to map the .hi and .o files over to the build folder, but I can't seem to find anything on how to compile the executable to a different directory. Does anyone know how to do this?

Thanks!

Upvotes: 2

Views: 2246

Answers (1)

Nathan Howell
Nathan Howell

Reputation: 4637

How about explicitly setting the output filename including the directory? Works over here, I haven't tested on Windows so I'm not sure if you need the .exe extension or not.

ghc --make -o build/sample.exe src/sample.hs

Also worth noting: --make is enabled by default as of GHC 7.0.

Upvotes: 4

Related Questions