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