#7311: -odir option changes .o and .hi names of main source file to Main.hi/o -------------------------------+-------------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.1 Resolution: wontfix | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: -------------------------------+--------------------------------------------
Comment(by slyfox): Replying to [comment:1 simonmar]: > This is the intended behaviour, and it is documented: [http://www.haskell.org/ghc/docs/latest/html/users_guide/separate- compilation.html#output-files]. > > Consider this: > > {{{ > $ ghc -odir out ../src/foo.hs > }}} > > where do you want the object file to go? > > If you're using `-odir`, why not put the output files in separate directories? > I'd expect it to be '''out/foo.{o,hi}''', or '''out/src/foo.{o,hi}''' (whatever is used by other non-Main modules). I see. It's a bit more complicated, than I thought. My initial use case was like that: {{{ -- layout: tool1.hs tool2.hs ToolModule{1..10}.hs -- and both tools use those ToolModule{1..10}.hs $ ghc --make -odir vanilla tool1.hs $ ghc --make -odir vanilla tool2.hs $ ghc --make -odir prof -prof tool1.hs $ ghc --make -odir prof -prof tool2.hs }}} where both tools would reuse some (10) of common module depends. Custom Makefile did consider all %.hs get translated to %.o and %.hi. As I understand it might be incorrect to assume that ToolModule*.hi won't change when compiled against different tool{1,2}.hs files (if we lack type signatures in those modules they might be dependent on tool{1,2}.hs users), but it's already the problem for standard case: {{{ $ ghc --make tool1.hs $ ghc --make tool2.hs }}} But that's a bit confusing to suddently change main file's name to Main.o especially for '-odir .' Thanks for the pointers! -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7311#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs