[project @ 1999-03-09 14:51:03 by sewardj]
[ghc-hetmet.git] / ghc / interpreter / Makefile
1
2 # ----------------------------------------------------------------------------- #
3 # $Id: Makefile,v 1.6 1999/03/09 14:51:03 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 = -O2 -Winline -g -I$(GHC_DIR)/includes -I$(GHC_DIR)/rts -D__HUGS__ -Wall -Wstrict-prototypes 
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
36
37 ### EXTREMELY hacky
38 hugs: $(C_OBJS) ../rts/Sanity.o ../rts/Assembler.o ../rts/Disassembler.o ../rts/Evaluator.o ../rts/ForeignCall.o ../rts/GC.o \
39                 ../rts/Printer.o
40         $(CC) -o $@ $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) -lbfd -liberty -ldl -lm
41
42 $(GHC_DYN_CBITS):
43 ###     (cd $(GHC_DYN_CBITS_DIR); make EXTRA_CC_OPTS="-fpic -optc-g" ; gcc -shared -o libHS_cbits.so *.o)
44         (cd $(GHC_DYN_CBITS_DIR); rm -f *.o ; gcc -I../../../includes -fPIC -g -Wall -c *.c ; gcc -shared -o libHS_cbits.so *.o)
45         cp -f $(GHC_DYN_CBITS) .
46
47 $(TOP)/ghc/rts/libHSrts.a:
48         (cd $(TOP)/ghc/rts ; make clean ; make)
49 $(TOP)/ghc/rts/gmp/libgmp.a:
50         (cd $(TOP)/ghc/rts/gmp ; make clean ; make)
51
52 cleanish:
53         /bin/rm *.o
54
55 snapshot:
56         /bin/rm -f snapshot.tar
57         tar cvf snapshot.tar Makefile *.[chy] *-ORIG-* \
58              ../rts/Assembler.c ../rts/Evaluator.c ../rts/Disassembler.c \
59              ../rts/ForeignCall.c ../rts/Printer.c \
60              ../includes/options.h ../includes/Assembler.h nHandle.c \
61              ../includes/Assembler.h ../rts/Bytecodes.h \
62              lib/*.hs
63
64
65 # --------------------------------------------------------------------- #
66 # Testing                                                               #
67 # --------------------------------------------------------------------- #
68
69 check :: all
70         ./test/runtests test/static/*.hs
71         ./test/runtests test/typechecker/*.hs
72         ./test/runtests test/runtime/*.hs
73         ./test/runtests test/std/*.hs
74         ./test/runtests test/exts/*.hs
75
76 checkrun: all
77         ./test/runtests test/runtime/*.hs
78         ./test/runtests test/std/*.hs
79         ./test/runtests test/exts/*.hs
80
81 # --------------------------------------------------------------------- #
82 # Cleanery & misc                                                       #
83 # --------------------------------------------------------------------- #
84
85 CLEAN_FILES += hugs libHS_cbits.so $(GHC_DYN_CBITS) $(GHC_DYN_CBITS_DIR)/*.o 
86 CLEAN_FILES += $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/*.o
87 CLEAN_FILES += $(TOP)/ghc/rts/gmp/libgmp.a  $(TOP)/ghc/rts/gmp/*.o $(TOP)/ghc/rts/gmp/*/*.o
88 CLEAN_FILES += parser.c
89
90 INSTALL_LIBEXECS = hugs
91
92 depend :: $(LOOPS) $(SRCS_UGNHS)
93
94
95 include $(TOP)/mk/target.mk
96
97