[project @ 2000-05-12 13:41:59 by sewardj]
[ghc-hetmet.git] / ghc / interpreter / Makefile
1
2 # --------------------------------------------------------------------------- #
3 # $Id: Makefile,v 1.35 2000/05/12 13:41:59 sewardj Exp $                      #
4 # --------------------------------------------------------------------------- #
5
6 TOP = ..
7 include $(TOP)/mk/boilerplate.mk
8 SUBDIRS = lib
9
10 # --------------------------------------------------------------------- #
11 # interpreter and relevant .a/.so files                                 #
12 # --------------------------------------------------------------------- #
13
14 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
15 DYN_EXT=.dll
16 LIB_DL=
17 else
18 DYN_EXT=.so
19 LIB_DL=-ldl
20 endif
21
22 ifeq "$(HaveLibGmp)$" "YES"
23 LIB_GMP=-lgmp
24 else
25 LIB_GMP=../rts/gmp/libgmp.a
26 endif
27
28 YACC = bison -y
29 %.c: %.y
30         -$(YACC) $<
31         mv y.tab.c $@
32         rm -f input.o
33
34 HS_SRCS =
35
36 Y_SRCS = parser.y
37 C_SRCS = link.c type.c static.c storage.c derive.c input.c compiler.c subst.c \
38      translate.c codegen.c lift.c free.c stgSubst.c output.c   \
39      hugs.c dynamic.c stg.c sainteger.c object.c interface.c
40
41 SRC_CC_OPTS = -I$(GHC_INTERPRETER_DIR) -I$(GHC_INCLUDE_DIR) -I$(GHC_RUNTIME_DIR) -D__HUGS__ -DCOMPILING_RTS -DNO_REGS -Wall -Wstrict-prototypes -Wno-unused -DDEBUG -Winline -g -O -DDIET_HEP
42
43 GHC_LIBS_NEEDED = $(GHC_RUNTIME_DIR)/libHSrts.a
44
45 all :: parser.c $(GHC_LIBS_NEEDED) nHandle$(DYN_EXT) hugs
46
47 ### EXTREMELY hacky
48 hugs: $(C_OBJS) ../rts/Sanity.o ../rts/Assembler.o ../rts/Disassembler.o   \
49       ../rts/Evaluator.o ../rts/ForeignCall.o ../rts/GC.o ../rts/Printer.o \
50       ../rts/StgCRun.o ../rts/PrimOps.o ../rts/Prelude.o ../rts/Storage.o \
51       ../rts/Schedule.o ../rts/libHSrts.a
52         $(CC) -o $@ $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) \
53                  -lbfd -liberty $(LibsReadline) $(LIB_DL) \
54                  $(LIB_GMP) -lm
55
56 foobar:
57         rm -f ../rts/libHSrts.a  ../rts/libHSrts_u.a
58         rm -f ../rts/StgCRun.o ../rts/StgCRun.u_o
59         make all
60
61 nHandle$(DYN_EXT): nHandle.c
62 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
63         gcc -mno-cygwin -O -Wall -o nHandle.o -c nHandle.c
64         dllwrap -mno-cygwin --target=i386-mingw32 -o nHandle.dll \
65                 -def nHandle.def nHandle.o
66 else
67         gcc -O -Wall -shared -fPIC -o nHandle.so nHandle.c
68 endif
69
70 $(GHC_RUNTIME_DIR)/libHSrts.a:
71         (cd $(GHC_RUNTIME_DIR) ; make clean ; make EXTRA_CC_OPTS=-I$(GHC_INTERPRETER_DIR))
72
73 cleanish:
74         /bin/rm *.o
75 rtsclean:
76         (cd $(GHC_RUNTIME_DIR) ; make clean)
77
78 binaries:
79         tar cvzf stghugs.tar.gz hugs$(exeext) nHandle$(DYN_EXT) lib/*lhs lib/Prelude.hs
80
81 snapshot:
82         /bin/rm -f snapshot.tar
83         tar cvf snapshot.tar Makefile *.[chy] \
84              ../rts/Assembler.c ../rts/Evaluator.c ../rts/Disassembler.c \
85              ../rts/ForeignCall.c ../rts/Printer.c ../rts/QueueTemplate.h \
86              ../includes/options.h ../includes/Assembler.h nHandle.c \
87              ../includes/Assembler.h ../rts/Bytecodes.h ../includes/ClosureMacros.h \
88              lib/*.hs runnofib runallnofib
89
90
91 # --------------------------------------------------------------------- #
92 # Testing                                                               #
93 # --------------------------------------------------------------------- #
94
95 check :: all
96         ./test/runtests test/static/*.hs
97         ./test/runtests test/typechecker/*.hs
98         ./test/runtests test/runtime/*.hs
99         ./test/runtests test/std/*.hs
100         ./test/runtests test/exts/*.hs
101
102 checkrun: all
103         ./test/runtests test/runtime/*.hs
104         ./test/runtests test/std/*.hs
105         ./test/runtests test/exts/*.hs
106
107 # --------------------------------------------------------------------- #
108 # Cleanery & misc                                                       #
109 # --------------------------------------------------------------------- #
110
111 CLEAN_FILES += hugs nHandle.dll
112 CLEAN_FILES += $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/*.o
113 CLEAN_FILES += parser.c
114
115 INSTALL_LIBEXECS = hugs
116
117 depend :: parser.c $(LOOPS) $(SRCS_UGNHS)
118
119
120 include $(TOP)/mk/target.mk
121
122