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