[project @ 2000-05-12 15:59:37 by sewardj]
[ghc-hetmet.git] / ghc / interpreter / Makefile-DietHEP
1
2 # --------------------------------------------------------------------------- #
3 # $Id: Makefile-DietHEP,v 1.1 2000/05/12 15:59:37 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 -DDIET_HEP
42
43 GHC_LIBS_NEEDED = $(GHC_RUNTIME_DIR)/libHSrts.a \
44                   $(GHC_RUNTIME_DIR)/gmp/libgmp.a
45
46 all :: parser.c $(GHC_LIBS_NEEDED) nHandle$(DYN_EXT) dh_demo.exe
47
48 dh_demo.exe: DietHEP.dll
49         gcc -Wall -g -o dh_demo.exe dh_demo.c DietHEP_dll.a
50
51 ### EXTREMELY hacky
52 DietHEP.a: $(C_OBJS)
53         rm -f DietHEP.o
54         ld -r -o DietHEP.o $^ $(GHC_LIBS_NEEDED)
55         rm -f DietHEP.a
56         ar clq DietHEP.a DietHEP.o
57         rm -f DietHEP.o
58
59 foobar:
60         rm -f ../rts/libHSrts.a  ../rts/libHSrts_u.a
61         rm -f ../rts/StgCRun.o ../rts/StgCRun.u_o
62         make all
63
64 nHandle$(DYN_EXT): nHandle.c
65 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
66         gcc -mno-cygwin -O -Wall -o nHandle.o -c nHandle.c
67         dllwrap -mno-cygwin --target=i386-mingw32 -o nHandle.dll \
68                 -def nHandle.def nHandle.o
69 else
70         gcc -O -Wall -shared -fPIC -o nHandle.so nHandle.c
71 endif
72
73 $(GHC_RUNTIME_DIR)/libHSrts.a:
74         (cd $(GHC_RUNTIME_DIR) ; make clean ; make EXTRA_CC_OPTS=-I$(GHC_INTERPRETER_DIR))
75
76 cleanish:
77         /bin/rm *.o
78 rtsclean:
79         (cd $(GHC_RUNTIME_DIR) ; make clean)
80
81 binaries:
82         tar cvzf stghugs.tar.gz hugs$(exeext) nHandle$(DYN_EXT) lib/*lhs lib/Prelude.hs
83
84 snapshot:
85         /bin/rm -f snapshot.tar
86         tar cvf snapshot.tar Makefile *.[chy] \
87              ../rts/Assembler.c ../rts/Evaluator.c ../rts/Disassembler.c \
88              ../rts/ForeignCall.c ../rts/Printer.c ../rts/QueueTemplate.h \
89              ../includes/options.h ../includes/Assembler.h nHandle.c \
90              ../includes/Assembler.h ../rts/Bytecodes.h ../includes/ClosureMacros.h \
91              lib/*.hs runnofib runallnofib
92
93
94 # --------------------------------------------------------------------- #
95 # Testing                                                               #
96 # --------------------------------------------------------------------- #
97
98 check :: all
99         ./test/runtests test/static/*.hs
100         ./test/runtests test/typechecker/*.hs
101         ./test/runtests test/runtime/*.hs
102         ./test/runtests test/std/*.hs
103         ./test/runtests test/exts/*.hs
104
105 checkrun: all
106         ./test/runtests test/runtime/*.hs
107         ./test/runtests test/std/*.hs
108         ./test/runtests test/exts/*.hs
109
110 # --------------------------------------------------------------------- #
111 # Cleanery & misc                                                       #
112 # --------------------------------------------------------------------- #
113
114 CLEAN_FILES += hugs nHandle.dll
115 CLEAN_FILES += $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/*.o
116 CLEAN_FILES += parser.c
117
118 INSTALL_LIBEXECS = hugs
119
120 depend :: parser.c $(LOOPS) $(SRCS_UGNHS)
121
122
123 include $(TOP)/mk/target.mk
124
125
126 include Makefile.DLLs