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