Giving profiled object files a different extension (was: RE: Profiling suggestion)

Simon Marlow simonmar@microsoft.com
Fri, 10 May 2002 16:24:33 +0100


> Re the current and recurring conflicts between profiling and
> non-profiling code; how hard would it be to name GHC's output files
> differently when compiling with -prof?
>=20
> I.e. without, you get the normal foo.hs -> foo.o result, but with
> -prof you could get e.g. foo.po or foo.p.o instead?  (And of course,=20
> linking these instead when making the executable)
>=20
> I can probably hack this in a makefile, but it'd be nice to be able to
> just ghc --make as well.

We've wondered about this from time to time, but it's not clear to me
that it's an all-round good idea.  So if anyone else has any opinions
please chime in - if the general concensus is to make this change then
we'll do it.

The proposal, therefore, is to extend the meaning of '-prof' to mean
'-prof -osuf p_o -hisuf p_hi' or similar.

To summarise the advantages/disadvantages:

  - win: you could store profiled and normal objects in the same
    directory.

  - win: you'd be less likely to mix up profiled and normal objects.

  - lose: Makefile writing gets harder.  Extra suffix rules have to
    be added to deal with the new suffixes, and 'make depend' has
    to add dependency rules for the extra suffixes (ghc -M has some
    support for doing this).  If you're using ghc --make this doesn't
    affect you.

Cheers,
	Simon