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