Re: [GHC] #843: Dependency information for the linking step

2006-08-09 Thread GHC
#843: Dependency information for the linking step
+---
  Reporter:  [EMAIL PROTECTED] |  Owner: 
  Type:  feature request| Status:  closed 
  Priority:  normal |  Milestone: 
 Component:  Compiler   |Version:  6.4.1  
  Severity:  normal | Resolution:  fixed  
  Keywords:  dependency generation  | Os:  Linux  
Difficulty:  Easy (1 hr)|   Architecture:  Unknown
+---
Changes (by simonmar):

  * resolution:  => fixed
  * status:  new => closed

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #843: Dependency information for the linking step

2006-08-09 Thread Simon Marlow

Volker Wysk wrote:

On Tuesday 08 August 2006 14:08, GHC wrote:


#843: Dependency information for the linking step
+--
- Reporter:  [EMAIL PROTECTED] |  Owner:
 Type:  feature request| Status:  new
 Priority:  normal |  Milestone:
Component:  Compiler   |Version:  6.4.1
 Severity:  normal | Resolution:
 Keywords:  dependency generation  | Os:  Linux
Difficulty:  Easy (1 hr)|   Architecture:  Unknown
+--
- Comment (by simonmar):

Then I have another trick for you:

{{{
ghc --make -pgml echo Main.hs -v0 | ghc -e 'interact (unwords . filter
(".o" `Data.List.isSuffixOf`) . words)'
}}}

Does this solve the problem?



Yes! I have no idea what's going on, though.


"-pgml echo" uses "echo" as the linker program, so the linker command line is 
sent to stdout, then we pipe it through something that extracts the object 
filenames - I used ghc -e, but you could use sed or perl or something else.  The 
version I gave above doesn't work properly if the filenames contain spaces.


However, it triggers another problem, which I haven't reported. When 
calling "ghc -M src/prog.hs", where "prog.hs" is the main module, then the 
name of the object file is reported as "src/prog.o". When calling it in 
conjunction with "-odir", such as "ghc -M -odir build src/prog.hs", then you 
get "build/Main.o". Of course this can't be used, because all of the 
programs' main modules become "build/Main.o".


This isn't a bug, it's the defined behaviour of -odir.  See the documentation:

http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation.html#output-files

Cheers,
Simon

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #843: Dependency information for the linking step

2006-08-08 Thread Volker Wysk
On Tuesday 08 August 2006 14:08, GHC wrote:
> #843: Dependency information for the linking step
> +--
>- Reporter:  [EMAIL PROTECTED] |  Owner:
>   Type:  feature request| Status:  new
>   Priority:  normal |  Milestone:
>  Component:  Compiler   |Version:  6.4.1
>   Severity:  normal | Resolution:
>   Keywords:  dependency generation  | Os:  Linux
> Difficulty:  Easy (1 hr)|   Architecture:  Unknown
> +--
>- Comment (by simonmar):
>
>  Then I have another trick for you:
>
>  {{{
>  ghc --make -pgml echo Main.hs -v0 | ghc -e 'interact (unwords . filter
>  (".o" `Data.List.isSuffixOf`) . words)'
>  }}}
>
>  Does this solve the problem?

Yes! I have no idea what's going on, though.

However, it triggers another problem, which I haven't reported. When 
calling "ghc -M src/prog.hs", where "prog.hs" is the main module, then the 
name of the object file is reported as "src/prog.o". When calling it in 
conjunction with "-odir", such as "ghc -M -odir build src/prog.hs", then you 
get "build/Main.o". Of course this can't be used, because all of the 
programs' main modules become "build/Main.o".

-- 
public key fingerprint: 6A10 66F1 40A2 C441 BB55 0AA8 FAB1 4FC1 08BE 24EF
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #843: Dependency information for the linking step

2006-08-08 Thread GHC
#843: Dependency information for the linking step
+---
  Reporter:  [EMAIL PROTECTED] |  Owner: 
  Type:  feature request| Status:  new
  Priority:  normal |  Milestone: 
 Component:  Compiler   |Version:  6.4.1  
  Severity:  normal | Resolution: 
  Keywords:  dependency generation  | Os:  Linux  
Difficulty:  Easy (1 hr)|   Architecture:  Unknown
+---
Comment (by simonmar):

 Then I have another trick for you:

 {{{
 ghc --make -pgml echo Main.hs -v0 | ghc -e 'interact (unwords . filter
 (".o" `Data.List.isSuffixOf`) . words)'
 }}}

 Does this solve the problem?

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #843: Dependency information for the linking step

2006-08-07 Thread Volker Wysk
On Monday 07 August 2006 15:06, GHC wrote:
> #843: Dependency information for the linking step
> +--
>- Reporter:  [EMAIL PROTECTED] |  Owner:
>   Type:  feature request| Status:  new
>   Priority:  normal |  Milestone:
>  Component:  Compiler   |Version:  6.4.1
>   Severity:  normal | Resolution:
>   Keywords:  dependency generation  | Os:  Linux
> Difficulty:  Easy (1 hr)|   Architecture:  Unknown
> +--
>- Comment (by simonmar):
>
>  Did you know that you don't have to give the names of all the modules in
>  the program to ghc -M?  The -M option behaves just like {{{--make}}}, that
>  is it traverses the dependency graph.
>
>  Does this solve the problem for you?

No, it doesn't. It reports the immediate dependencies for each module, but not 
the dependencies of the binary program, which is made in the linking step 
from all modules, which are directly or _indirectly_ imported by the Main 
module.

For myself, I've already solved the problem, by writing a little program, 
which reads the dependencies generated by "ghc -M" and forms the transitive 
hull of all the modules imported by the Main module. That's what "ghc --make" 
must be doing internally before calling the linker.

Note that the generated dependency information is needed only for ensuring the 
up-to-date-ness of all modules, even .chs ones. You could let "ghc --make" 
collect the right object files for linking, but it doesn't know about c2hs.

Regards,
V.W.

-- 
public key fingerprint: 6A10 66F1 40A2 C441 BB55 0AA8 FAB1 4FC1 08BE 24EF
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Re: [GHC] #843: Dependency information for the linking step

2006-08-07 Thread GHC
#843: Dependency information for the linking step
+---
  Reporter:  [EMAIL PROTECTED] |  Owner: 
  Type:  feature request| Status:  new
  Priority:  normal |  Milestone: 
 Component:  Compiler   |Version:  6.4.1  
  Severity:  normal | Resolution: 
  Keywords:  dependency generation  | Os:  Linux  
Difficulty:  Easy (1 hr)|   Architecture:  Unknown
+---
Comment (by simonmar):

 Did you know that you don't have to give the names of all the modules in
 the program to ghc -M?  The -M option behaves just like {{{--make}}}, that
 is it traverses the dependency graph.

 Does this solve the problem for you?

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


[GHC] #843: Dependency information for the linking step

2006-08-03 Thread GHC
#843: Dependency information for the linking step
---+
Reporter:  [EMAIL PROTECTED]  |Owner:   
Type:  feature request |   Status:  new  
Priority:  normal  |Milestone:   
   Component:  Compiler|  Version:  6.4.1
Severity:  normal  | Keywords:  dependency generation
  Os:  Linux   |   Difficulty:  Easy (1 hr)  
Architecture:  Unknown |  
---+
I'd like to let GHC report which object files are linked together when
 called with "--make", such as: "ghc -M --make Prog.hs". "-M" can't be used
 in conjunction with "--make".

 I have many small main programs that share inner modules. Some of the
 inner and main modules are c2hs-input files (.chs), which must be
 processed by c2hs first, to produce a .hs file. "ghc --make" can be used
 in the linking step, but it doesn't know about c2hs, and can't call it
 automatically. So I need the makefile to take care of the dependencies.

 Normally, you'd have just one main module, and link everything together.
 But I want to recompile only the modules needed for some specific program.
 There's no easy way to get the information which object files make up a
 program, and must be recompiled, because the object files depend only on
 the .hi-files of the imported modules, not on the modules themselves.

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs