[project @ 1999-11-12 16:38:31 by sewardj]
[ghc-hetmet.git] / ghc / interpreter / Makefile
1
2 # ----------------------------------------------------------------------------- #
3 # $Id: Makefile,v 1.16 1999/11/12 16:38:31 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 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
17 DYN_EXT=.dll
18 LIB_DL=
19 else
20 DYN_EXT=.so
21 LIB_DL=-ldl
22 endif
23
24 ifeq "$(HaveLibReadLine)$" "YES"
25 LIB_READLINE=-lreadline
26 else
27 LIB_READLINE=
28 endif
29
30 YACC = bison -y
31 %.c: %.y
32         -$(YACC) $<
33         mv y.tab.c $@
34         rm -f input.o
35
36 HS_SRCS =
37
38 Y_SRCS = parser.y
39 C_SRCS = link.c type.c static.c storage.c derive.c input.c compiler.c subst.c \
40      translate.c codegen.c lift.c free.c stgSubst.c optimise.c output.c   \
41      hugs.c dynamic.c stg.c sainteger.c interface.c
42
43 SRC_CC_OPTS = -g -O -I$(GHC_DIR)/interpreter -I$(GHC_DIR)/includes -I$(GHC_DIR)/rts -D__HUGS__ -DCOMPILING_RTS -Wall -Wstrict-prototypes -Wno-unused -DDEBUG -DDEBUG_EXTRA -Winline
44
45 GHC_LIBS_NEEDED = $(TOP)/ghc/rts/libHSrts.a
46
47 all :: parser.c $(GHC_LIBS_NEEDED) nHandle.$(DYN_EXT) hugs
48
49 ### EXTREMELY hacky
50 hugs: $(C_OBJS) ../rts/Sanity.o ../rts/Assembler.o ../rts/Disassembler.o \
51       ../rts/Evaluator.o ../rts/ForeignCall.o ../rts/GC.o ../rts/Printer.o \
52       ../rts/StgCRun.o
53         $(CC) -o $@ $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) -lreadline \
54                -lbfd -liberty $(LIB_READLINE) $(LIB_DL) -lm
55
56 nHandle.$(DYN_EXT): nHandle.c
57 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
58         gcc -mno-cygwin -O -Wall -o nHandle.o -c nHandle.c
59         dllwrap -mno-cygwin --target=i386-mingw32 -o nHandle.dll \
60                 -def nHandle.def nHandle.o
61 else
62         gcc -O -Wall -shared -fPIC -o nHandle.so nHandle.c
63 endif
64
65 $(TOP)/ghc/rts/libHSrts.a:
66         (cd $(TOP)/ghc/rts ; make clean ; make EXTRA_CC_OPTS=-I$(GHC_DIR)/interpreter)
67
68 cleanish:
69         /bin/rm *.o
70
71 snapshot:
72         /bin/rm -f snapshot.tar
73         tar cvf snapshot.tar Makefile *.[chy] \
74              ../rts/Assembler.c ../rts/Evaluator.c ../rts/Disassembler.c \
75              ../rts/ForeignCall.c ../rts/Printer.c ../rts/QueueTemplate.h \
76              ../includes/options.h ../includes/Assembler.h nHandle.c \
77              ../includes/Assembler.h ../rts/Bytecodes.h ../includes/ClosureMacros.h \
78              lib/*.hs runnofib runallnofib
79
80
81 # --------------------------------------------------------------------- #
82 # Testing                                                               #
83 # --------------------------------------------------------------------- #
84
85 check :: all
86         ./test/runtests test/static/*.hs
87         ./test/runtests test/typechecker/*.hs
88         ./test/runtests test/runtime/*.hs
89         ./test/runtests test/std/*.hs
90         ./test/runtests test/exts/*.hs
91
92 checkrun: all
93         ./test/runtests test/runtime/*.hs
94         ./test/runtests test/std/*.hs
95         ./test/runtests test/exts/*.hs
96
97 # --------------------------------------------------------------------- #
98 # Cleanery & misc                                                       #
99 # --------------------------------------------------------------------- #
100
101 CLEAN_FILES += hugs nHandle.dll
102 CLEAN_FILES += $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/*.o
103 CLEAN_FILES += parser.c
104
105 INSTALL_LIBEXECS = hugs
106
107 depend :: $(LOOPS) $(SRCS_UGNHS)
108
109
110 include $(TOP)/mk/target.mk
111
112 HUGSCPP = ../utils/hscpp/hscpp -D__HUGS__ -DUSE_REPORT_PRELUDE
113
114 libs:
115         $(HUGSCPP) ../lib/std/List.lhs > lib/List.lhs
116         $(HUGSCPP) ../lib/std/Ix.lhs > lib/Ix.lhs
117         $(HUGSCPP) ../lib/std/Complex.lhs > lib/Complex.lhs
118         $(HUGSCPP) ../lib/std/Char.lhs > lib/Char.lhs
119         $(HUGSCPP) ../lib/std/Ratio.lhs > lib/Ratio.lhs
120         $(HUGSCPP) ../lib/std/Random.lhs > lib/Random.lhs
121         $(HUGSCPP) ../lib/std/Array.lhs > lib/Array.lhs
122         $(HUGSCPP) ../lib/std/Maybe.lhs > lib/Maybe.lhs
123         $(HUGSCPP) ../lib/std/Monad.lhs > lib/Monad.lhs
124         $(HUGSCPP) ../lib/std/Numeric.lhs > lib/Numeric.lhs
125         $(HUGSCPP) ../lib/std/Directory.lhs > lib/Directory.lhs
126         $(HUGSCPP) ../lib/std/System.lhs > lib/System.lhs
127         $(HUGSCPP) ../lib/std/Locale.lhs > lib/Locale.lhs
128         $(HUGSCPP) ../lib/std/CPUTime.lhs > lib/CPUTime.lhs
129         $(HUGSCPP) ../lib/std/IO.lhs > lib/IO.lhs