-make

S.D.Mechveliani mechvel@math.botik.ru
Wed, 25 Apr 2001 09:10:14 +0400


Hello,

I have two questions on  ghc-5.00  -make.

The User's Guide says in Section 4.5 that it is simpler to use 
-make  than the Makefile technique. 

1. I try       ghc -make Main.hs
           
with  Main.hs  containing   main = putStr "hello\n"

(in ghc-5.00, binary, i386-unknown, Linux),  
and it reports
               ghc-5.00: unrecognised flag: -make
- ?  


2. How to simplify (eliminate?) Makefile.
-----------------------------------------

My project has many .hs files  in the directories  
   ./source/
   ./source/auxil/
   ./source/pol/factor/
   ...
`make ...' compiles them putting  .hi, .o  files into  ./export/,
then, applies `ar' to make  .a  library.
To do all this, Makefile includes the rules like 

  .hs.o:
         $(HC) -c $< $(HCFlags)
 
and applies the compiler $(HC) with the flags

      ...  -syslib data  -recomp ...
      -i$(E) -odir $(E)  -ohi $(E)/$(notdir $*).hi  $($*_flags)
      ...
Now, this Makefile does not work under  ghc-5.00,  because second
  compilation cannot find  .hi  file of the first compilation:

  ..ghc -c source/auxil/Prelude_.hs -fglasgow-exts ...
   -recomp -iexport -odir export  -ohi        export/Prelude_.hi  
   +RTS -G3 -F1.5 -M29m -RTS -Onot
  ...
  ..ghc -c source/parse/Iparse_.hs -fglasgow-exts ...
   -recomp -iexport -odir export  -ohi        export/Iparse_.hi 
   +RTS -G3 -F1.5 -M29m -RTS -Onot

  source/parse/Iparse_.hs:20:
    failed to load interface for `Prelude_':
        Bad interface file: export/Iparse_.hi
            does not exist

Also what  -make  can do to replace some large part of Makefile.
For 
(a) Makefile has rather odd language, it is not good to force the
    functional programmer to look into it,
(b) one has to think of Makefile versions for different operation 
    systems.


Thank you in advance for the help.

-----------------
Serge Mechveliani
mechvel@botik.ru