[project @ 1999-11-24 10:12:47 by andy]
[ghc-hetmet.git] / ghc / interpreter / Makefile
1
2 # --------------------------------------------------------------------------- #
3 # $Id: Makefile,v 1.22 1999/11/24 10:12:47 andy 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 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 interface.c
40
41 SRC_CC_OPTS = -g -O -I$(GHC_INTERPRETER_DIR) -I$(GHC_INCLUDE_DIR) -I$(GHC_RUNTIME_DIR) -D__HUGS__ -DCOMPILING_RTS -Wall -Wstrict-prototypes -Wno-unused -DDEBUG -Winline
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
51         $(CC) -o $@ $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) \
52                  -lbfd -liberty $(LIB_READLINE) $(LIB_DL) -lm
53
54 nHandle$(DYN_EXT): nHandle.c
55 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
56         gcc -mno-cygwin -O -Wall -o nHandle.o -c nHandle.c
57         dllwrap -mno-cygwin --target=i386-mingw32 -o nHandle.dll \
58                 -def nHandle.def nHandle.o
59 else
60         gcc -O -Wall -shared -fPIC -o nHandle.so nHandle.c
61 endif
62
63 $(GHC_RUNTIME_DIR)/libHSrts.a:
64         (cd $(GHC_RUNTIME_DIR) ; make clean ; make EXTRA_CC_OPTS=-I$(GHC_INTERPRETER_DIR))
65
66 cleanish:
67         /bin/rm *.o
68 rtsclean:
69         (cd $(GHC_RUNTIME_DIR) ; make clean)
70
71 binaries:
72         tar cvzf stghugs.tar.gz hugs$(exeext) nHandle$(DYN_EXT) lib/*lhs lib/Prelude.hs
73
74 snapshot:
75         /bin/rm -f snapshot.tar
76         tar cvf snapshot.tar Makefile *.[chy] \
77              ../rts/Assembler.c ../rts/Evaluator.c ../rts/Disassembler.c \
78              ../rts/ForeignCall.c ../rts/Printer.c ../rts/QueueTemplate.h \
79              ../includes/options.h ../includes/Assembler.h nHandle.c \
80              ../includes/Assembler.h ../rts/Bytecodes.h ../includes/ClosureMacros.h \
81              lib/*.hs runnofib runallnofib
82
83
84 # --------------------------------------------------------------------- #
85 # Testing                                                               #
86 # --------------------------------------------------------------------- #
87
88 check :: all
89         ./test/runtests test/static/*.hs
90         ./test/runtests test/typechecker/*.hs
91         ./test/runtests test/runtime/*.hs
92         ./test/runtests test/std/*.hs
93         ./test/runtests test/exts/*.hs
94
95 checkrun: all
96         ./test/runtests test/runtime/*.hs
97         ./test/runtests test/std/*.hs
98         ./test/runtests test/exts/*.hs
99
100 # --------------------------------------------------------------------- #
101 # Cleanery & misc                                                       #
102 # --------------------------------------------------------------------- #
103
104 CLEAN_FILES += hugs nHandle.dll
105 CLEAN_FILES += $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/*.o
106 CLEAN_FILES += parser.c
107
108 INSTALL_LIBEXECS = hugs
109
110 depend :: $(LOOPS) $(SRCS_UGNHS)
111
112
113 include $(TOP)/mk/target.mk
114
115