[project @ 2000-05-26 10:14:33 by sewardj]
[ghc-hetmet.git] / ghc / interpreter / Makefile-DietHEP
1
2 # --------------------------------------------------------------------------- #
3 # $Id: Makefile-DietHEP,v 1.2 2000/05/26 10:14:34 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 YACC = bison -y
37 %.c: %.y
38         -$(YACC) $<
39         mv y.tab.c $@
40         rm -f input.o
41
42 HS_SRCS =
43
44 Y_SRCS = parser.y
45 C_SRCS = link.c type.c static.c storage.c derive.c input.c compiler.c subst.c \
46      translate.c codegen.c lift.c free.c stgSubst.c output.c   \
47      hugs.c dynamic.c stg.c sainteger.c object.c interface.c
48
49 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 -DDIET_HEP -DBUILDING_DLL
50
51 GHC_LIBS_NEEDED = $(GHC_RUNTIME_DIR)/libHSrts.a \
52                   $(GHC_RUNTIME_DIR)/gmp/libgmp.a
53
54 all :: parser.c $(GHC_LIBS_NEEDED) nHandle$(DYN_EXT) dh_demo.exe
55
56 dhtarfile: DietHEP.dll
57         rm -f DietHEP.h
58         ln -s ../includes/DietHEP.h .
59         tar cvf dhtarfile.tar --dereference DietHEP.h DietHEP.dll DietHEP_dll.a \
60                 Dh_Demo.hs dh_demo.c dh_demo.exe \
61                 lib library nHandle.dll Makefile-DietHEP
62         rm -f DietHEP.h
63         bzip2 -v dhtarfile.tar
64
65 dh_demo.exe: DietHEP.dll dh_demo.c
66         gcc -Wall -g -o dh_demo.exe dh_demo.c -L./ -lDietHEP
67
68 ### EXTREMELY hacky
69 DietHEP.dll: $(C_OBJS) $(GHC_LIBS_NEEDED)
70         dllwrap -o DietHEP.dll --def DietHEP.def --implib libDietHEP.a \
71                 $(OBJS) $(GHC_LIBS_NEEDED)
72
73 foobar:
74         rm -f ../rts/libHSrts.a  ../rts/libHSrts_u.a
75         rm -f ../rts/StgCRun.o ../rts/StgCRun.u_o
76         make all
77
78 nHandle$(DYN_EXT): nHandle.c
79 ifeq "$(DYN_EXT)" ".dll"
80         gcc -mno-cygwin -O -Wall -o nHandle.o -c nHandle.c
81         dllwrap -mno-cygwin --target=i386-mingw32 -o nHandle.dll \
82                 -def nHandle.def nHandle.o
83 else
84         gcc -O -Wall -shared -fPIC -o nHandle.so nHandle.c
85 endif
86
87 $(GHC_RUNTIME_DIR)/libHSrts.a:
88         (cd $(GHC_RUNTIME_DIR) ; make clean ; make EXTRA_CC_OPTS=-I$(GHC_INTERPRETER_DIR))
89
90 cleanish:
91         /bin/rm *.o
92 rtsclean:
93         (cd $(GHC_RUNTIME_DIR) ; make clean)
94
95 binaries:
96         tar cvzf stghugs.tar.gz hugs$(exeext) nHandle$(DYN_EXT) lib/*lhs lib/Prelude.hs
97
98 snapshot:
99         /bin/rm -f snapshot.tar
100         tar cvf snapshot.tar Makefile *.[chy] \
101              ../rts/Assembler.c ../rts/Evaluator.c ../rts/Disassembler.c \
102              ../rts/ForeignCall.c ../rts/Printer.c ../rts/QueueTemplate.h \
103              ../includes/options.h ../includes/Assembler.h nHandle.c \
104              ../includes/Assembler.h ../rts/Bytecodes.h ../includes/ClosureMacros.h \
105              lib/*.hs runnofib runallnofib
106
107
108 # --------------------------------------------------------------------- #
109 # Testing                                                               #
110 # --------------------------------------------------------------------- #
111
112 check :: all
113         ./test/runtests test/static/*.hs
114         ./test/runtests test/typechecker/*.hs
115         ./test/runtests test/runtime/*.hs
116         ./test/runtests test/std/*.hs
117         ./test/runtests test/exts/*.hs
118
119 checkrun: all
120         ./test/runtests test/runtime/*.hs
121         ./test/runtests test/std/*.hs
122         ./test/runtests test/exts/*.hs
123
124 # --------------------------------------------------------------------- #
125 # Cleanery & misc                                                       #
126 # --------------------------------------------------------------------- #
127
128 CLEAN_FILES += hugs nHandle.dll DietHEP.dll
129 CLEAN_FILES += $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/*.o
130 CLEAN_FILES += parser.c
131
132 INSTALL_LIBEXECS = hugs
133
134 depend :: parser.c $(LOOPS) $(SRCS_UGNHS)
135
136
137 include $(TOP)/mk/target.mk