[project @ 1999-01-12 13:45:10 by sewardj]
[ghc-hetmet.git] / ghc / interpreter / Makefile
1
2 # ----------------------------------------------------------------------------- #
3 # $Id: Makefile,v 1.1 1999/01/12 13:45:10 sewardj Exp $                        #
4 # ----------------------------------------------------------------------------- #
5
6 TOP = ../..
7 include $(TOP)/mk/boilerplate.mk
8
9 GHC_DIR = $(TOP)/ghc
10 RTS_DIR = $(TOP)/ghc/rts
11
12 # --------------------------------------------------------------------- #
13 # interpreter and relevant .a/.so files                                 #
14 # --------------------------------------------------------------------- #
15
16 HS_SRCS =
17
18 C_SRCS = \
19   charset.c codegen.c compiler.c connect.c derive.c desugar.c \
20   dynamic.c free.c hugs.c input.c interface.c lift.c link.c \
21   machdep.c modules.c optimise.c output.c pat.c pmc.c pp.c static.c \
22   stg.c stgSubst.c storage.c subst.c translate.c type.c
23
24 SRC_CC_OPTS = -g -I$(GHC_DIR)/includes -D__HUGS__
25
26 GHC_LIBS_NEEDED = $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/gmp/libgmp.a
27 GHC_DYN_CBITS_DIR = $(TOP)/ghc/lib/std/cbits
28 GHC_DYN_CBITS = $(GHC_DYN_CBITS_DIR)/libHS_cbits.so
29
30 all :: $(GHC_LIBS_NEEDED) $(GHC_DYN_CBITS) hugs
31
32 hugs: $(C_OBJS)
33         $(CC) -rdynamic -o $@ $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) -lbfd -liberty -ldl -lm
34
35 $(GHC_DYN_CBITS):
36         (cd $(GHC_DYN_CBITS_DIR); make EXTRA_CC_OPTS=-optc-g ; gcc -shared -o libHS_cbits.so *.o)
37         cp -f $(GHC_DYN_CBITS) .
38
39 $(TOP)/ghc/rts/libHSrts.a:
40         (cd $(TOP)/ghc/rts ; make clean ; make)
41 $(TOP)/ghc/rts/gmp/libgmp.a:
42         (cd $(TOP)/ghc/rts/gmp ; make clean ; make)
43
44
45 # --------------------------------------------------------------------- #
46 # Prelude                                                               #
47 # --------------------------------------------------------------------- #
48
49 # HPPFLAGS += "-DBEGIN_FOR_HUGS={-"
50 # HPPFLAGS += "-DEND_FOR_HUGS=-}"
51
52 CPPFLAGS        += -I$(GHC_DIR)/includes 
53 CPPFLAGS        += -D__HUGS__ 
54 HPP = gcc -E -P -traditional -xc -DSTD_PRELUDE=0 $(HPPFLAGS) $(CPPFLAGS) -Iprelude -Ilibrary -I.
55 UNLIT = ../utils/unlit/unlit
56
57 # we cleanup by deleting adjacent blank lines - which just happen to be the
58 # only duplicate adjacent lines in all the files we process
59 CLEANUP = uniq
60
61 # Fiendishly cunning this: 
62 # o PreludeBuiltin.hs contains the BODY of the libraries it requires.
63 # o All the other libraries just contain the HEAD of the file.
64 Prelude.hs      : $(wildcard prelude/*.hs) $(wildcard library/*.hs) $(wildcard ../lib/*/*.lhs)
65         echo Building PreludeBuiltin
66         $(HPP) ../lib/std/PrelHandle.lhs     | $(UNLIT) - PrelHandle.unlit
67         $(HPP) ../lib/std/PrelIOBase.lhs     | $(UNLIT) - PrelIOBase.unlit
68         $(HPP) ../lib/std/PrelException.lhs  | $(UNLIT) - PrelException.unlit
69         $(HPP) ../lib/std/PrelDynamic.lhs    | $(UNLIT) - PrelDynamic.unlit
70         $(HPP) -DBODY ../lib/std/IO.lhs      | $(UNLIT) - IO.unlit
71         $(HPP) -DHEAD ../lib/std/IO.lhs      | $(UNLIT) - IO.hs
72         $(HPP) -DBODY prelude/Prelude.hs     | $(CLEANUP) > PreludeBuiltin.hs
73         $(HPP) -DHEAD prelude/Prelude.hs     | $(CLEANUP) > Prelude.hs
74         $(HPP) -DHEAD library/Array.hs       | $(CLEANUP) > Array.hs      
75         $(HPP) -DHEAD library/Char.hs        | $(CLEANUP) > Char.hs             
76         $(HPP) -DHEAD library/Ix.hs          | $(CLEANUP) > Ix.hs               
77         $(HPP) -DHEAD library/List.hs        | $(CLEANUP) > List.hs             
78         $(HPP) -DHEAD library/Maybe.hs       | $(CLEANUP) > Maybe.hs            
79         $(HPP) -DHEAD library/Numeric.hs     | $(CLEANUP) > Numeric.hs    
80         $(HPP) -DHEAD library/Ratio.hs       | $(CLEANUP) > Ratio.hs      
81         $(HPP) -DHEAD library/UnicodePrims.hs| $(CLEANUP) > UnicodePrims.hs      
82         $(HPP) -DHEAD prelude/PreludeIO.hs   | $(CLEANUP) > PreludeIO.hs  
83         $(HPP) -DHEAD prelude/PreludeList.hs | $(CLEANUP) > PreludeList.hs
84         $(HPP) -DHEAD prelude/PreludeText.hs | $(CLEANUP) > PreludeText.hs      
85         $(HPP) -DHEAD prelude/PrelConc.hs    | $(CLEANUP) > PrelConc.hs
86         echo "Building standard libraries"
87         $(HPP) library/Complex.hs       > Complex.hs            
88         $(HPP) library/Monad.hs         > Monad.hs      
89         $(HPP) ../lib/std/System.lhs    > System.lhs  
90         $(HPP) ../lib/std/Directory.lhs > Directory.lhs         
91         $(HPP) ../lib/std/Locale.lhs    > Locale.lhs  
92         $(HPP) ../lib/std/Random.lhs    > Random.lhs  
93         $(HPP) ../lib/std/CPUTime.lhs   > CPUTime.lhs  
94         $(HPP) ../lib/std/Time.lhs      > Time.lhs  
95         echo "And some standard libraries which ain't done yet"
96         # $(HPP) library/IO.hs            > IO.hs               
97         #
98         echo "Building Hugs-GHC libraries"
99         $(HPP) ../lib/exts/ST.lhs        > ST.lhs     
100         $(HPP) ../lib/misc/Pretty.lhs    > Pretty.lhs     
101         $(HPP) ../lib/exts/IOExts.lhs    > IOExts.lhs     
102         $(HPP) ../lib/exts/NumExts.lhs   > NumExts.lhs     
103         $(HPP) ../lib/exts/Dynamic.lhs   > Dynamic.lhs     
104         $(HPP) ../lib/exts/Bits.lhs      > Bits.lhs     
105         $(HPP) ../lib/exts/Exception.lhs > Exception.lhs     
106         $(HPP) library/Int.hs     > Int.hs     
107         $(HPP) library/Word.hs    > Word.hs     
108         $(HPP) ../lib/exts/Addr.lhs    > Addr.lhs     
109         $(HPP) ../lib/concurrent/Channel.lhs    > Channel.lhs    
110         $(HPP) ../lib/concurrent/ChannelVar.lhs > ChannelVar.lhs 
111         $(HPP) ../lib/concurrent/Concurrent.lhs > Concurrent.lhs 
112         $(HPP) ../lib/concurrent/Merge.lhs      > Merge.lhs      
113         $(HPP) ../lib/concurrent/SampleVar.lhs  > SampleVar.lhs 
114         $(HPP) ../lib/concurrent/Semaphore.lhs  > Semaphore.lhs 
115         echo "And some libraries which ain't converted yet"
116         # $(HPP) ../lib/exts/Foreign.lhs          > Foreign.lhs 
117         #
118         # $(HPP) ../lib/concurrent/Parallel.lhs   > Parallel.lhs   
119
120 prelclean:
121         $(RM) Array.hs           Dynamic.lhs        NumExts.lhs        Pretty.lhs
122         $(RM) Bits.lhs           Exception.lhs      Numeric.hs         Ratio.hs
123         $(RM) Channel.lhs        IOExts.lhs         PrelConc.hs        ST.lhs
124         $(RM) ChannelVar.lhs     Ix.hs              Prelude.hs         SampleVar.lhs
125         $(RM) Char.hs            List.hs            PreludeBuiltin.hs  Semaphore.lhs
126         $(RM) Complex.hs         Maybe.hs           PreludeIO.hs       System.lhs
127         $(RM) Concurrent.lhs     Merge.lhs          PreludeList.hs     UnicodePrims.hs
128         $(RM) Directory.lhs      Monad.hs           PreludeText.hs
129         $(RM) Locale.lhs Int.hs IO.hs Addr.lhs Time.lhs Word.hs
130         $(RM) *.unlit
131
132
133 # --------------------------------------------------------------------- #
134 # Cleanery & misc                                                       #
135 # --------------------------------------------------------------------- #
136
137 CLEAN_FILES += hugs libHS_cbits.so $(GHC_DYN_CBITS) $(GHC_DYN_CBITS_DIR)/*.o 
138 CLEAN_FILES += $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/*.o
139 CLEAN_FILES += $(TOP)/ghc/rts/gmp/libgmp.a  $(TOP)/ghc/rts/gmp/*.o $(TOP)/ghc/rts/gmp/*/*.o
140
141 INSTALL_LIBEXECS = hugs
142
143 clean :: prelclean
144
145 depend :: $(LOOPS) $(SRCS_UGNHS)
146
147
148 include $(TOP)/mk/target.mk
149
150