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