[project @ 1999-11-01 02:41:04 by andy]
[ghc-hetmet.git] / ghc / interpreter / Makefile
index b6452f2..ec98ba6 100644 (file)
@@ -1,6 +1,6 @@
 
 # ----------------------------------------------------------------------------- #
-# $Id: Makefile,v 1.7 1999/04/27 10:06:47 sewardj Exp $                         #
+# $Id: Makefile,v 1.15 1999/11/01 02:41:04 andy Exp $                        #
 # ----------------------------------------------------------------------------- #
 
 TOP = ../..
@@ -13,47 +13,61 @@ RTS_DIR = $(TOP)/ghc/rts
 # interpreter and relevant .a/.so files                                 #
 # --------------------------------------------------------------------- #
 
+ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
+DYN_EXT=.dll
+LIB_DL=
+else
+DYN_EXT=.so
+LIB_DL=-ldl
+endif
+
 YACC = bison -y
 %.c: %.y
        -$(YACC) $<
        mv y.tab.c $@
-
+       rm -f input.o
 
 HS_SRCS =
 
 Y_SRCS = parser.y
 C_SRCS = link.c type.c static.c storage.c derive.c input.c compiler.c subst.c \
      translate.c codegen.c lift.c free.c stgSubst.c optimise.c output.c   \
-     hugs.c dynamic.c stg.c sainteger.c
+     hugs.c dynamic.c stg.c sainteger.c interface.c
 
-SRC_CC_OPTS = -O2 -g -I$(GHC_DIR)/interpreter -I$(GHC_DIR)/includes -I$(GHC_DIR)/rts -D__HUGS__ -DCOMPILING_RTS -Wall -Wstrict-prototypes -Wno-unused
+SRC_CC_OPTS = -g -O -I$(GHC_DIR)/interpreter -I$(GHC_DIR)/includes -I$(GHC_DIR)/rts -D__HUGS__ -DCOMPILING_RTS -Wall -Wstrict-prototypes -Wno-unused -DDEBUG -DDEBUG_EXTRA -Winline
 
 GHC_LIBS_NEEDED = $(TOP)/ghc/rts/libHSrts.a
 
-all :: parser.c $(GHC_LIBS_NEEDED) nHandle.so hugs
+all :: parser.c $(GHC_LIBS_NEEDED) nHandle.$(DYN_EXT) hugs
 
 ### EXTREMELY hacky
 hugs: $(C_OBJS) ../rts/Sanity.o ../rts/Assembler.o ../rts/Disassembler.o \
       ../rts/Evaluator.o ../rts/ForeignCall.o ../rts/GC.o ../rts/Printer.o \
-      nHandle.so
-       $(CC) -o $@ -rdynamic $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) -lbfd -liberty -ldl -lm
-
-nHandle.so:
-       gcc -O -fPIC -shared -o nHandle.so nHandle.c
+      ../rts/StgCRun.o
+       $(CC) -o $@ $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) -lbfd -liberty $(LIB_DL) -lm
+
+nHandle.$(DYN_EXT): nHandle.c
+ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
+       gcc -mno-cygwin -O -Wall -o nHandle.o -c nHandle.c
+       dllwrap -mno-cygwin --target=i386-mingw32 -o nHandle.dll \
+                -def nHandle.def nHandle.o
+else
+       gcc -O -Wall -shared -fPIC -o nHandle.so nHandle.c
+endif
 
 $(TOP)/ghc/rts/libHSrts.a:
-       (cd $(TOP)/ghc/rts ; make clean ; make)
+       (cd $(TOP)/ghc/rts ; make clean ; make EXTRA_CC_OPTS=-I$(GHC_DIR)/interpreter)
 
 cleanish:
        /bin/rm *.o
 
 snapshot:
        /bin/rm -f snapshot.tar
-       tar cvf snapshot.tar Makefile *.[chy] *-ORIG-* \
+       tar cvf snapshot.tar Makefile *.[chy] \
              ../rts/Assembler.c ../rts/Evaluator.c ../rts/Disassembler.c \
              ../rts/ForeignCall.c ../rts/Printer.c ../rts/QueueTemplate.h \
              ../includes/options.h ../includes/Assembler.h nHandle.c \
-             ../includes/Assembler.h ../rts/Bytecodes.h \
+             ../includes/Assembler.h ../rts/Bytecodes.h ../includes/ClosureMacros.h \
              lib/*.hs runnofib runallnofib
 
 
@@ -77,7 +91,7 @@ checkrun: all
 # Cleanery & misc                                                       #
 # --------------------------------------------------------------------- #
 
-CLEAN_FILES += hugs nHandle.so
+CLEAN_FILES += hugs nHandle.dll
 CLEAN_FILES += $(TOP)/ghc/rts/libHSrts.a $(TOP)/ghc/rts/*.o
 CLEAN_FILES += parser.c
 
@@ -88,4 +102,21 @@ depend :: $(LOOPS) $(SRCS_UGNHS)
 
 include $(TOP)/mk/target.mk
 
-
+HUGSCPP = ../utils/hscpp/hscpp -D__HUGS__ -DUSE_REPORT_PRELUDE
+
+libs:
+       $(HUGSCPP) ../lib/std/List.lhs > lib/List.lhs
+       $(HUGSCPP) ../lib/std/Ix.lhs > lib/Ix.lhs
+       $(HUGSCPP) ../lib/std/Complex.lhs > lib/Complex.lhs
+       $(HUGSCPP) ../lib/std/Char.lhs > lib/Char.lhs
+       $(HUGSCPP) ../lib/std/Ratio.lhs > lib/Ratio.lhs
+       $(HUGSCPP) ../lib/std/Random.lhs > lib/Random.lhs
+       $(HUGSCPP) ../lib/std/Array.lhs > lib/Array.lhs
+       $(HUGSCPP) ../lib/std/Maybe.lhs > lib/Maybe.lhs
+       $(HUGSCPP) ../lib/std/Monad.lhs > lib/Monad.lhs
+       $(HUGSCPP) ../lib/std/Numeric.lhs > lib/Numeric.lhs
+       $(HUGSCPP) ../lib/std/Directory.lhs > lib/Directory.lhs
+       $(HUGSCPP) ../lib/std/System.lhs > lib/System.lhs
+       $(HUGSCPP) ../lib/std/Locale.lhs > lib/Locale.lhs
+       $(HUGSCPP) ../lib/std/CPUTime.lhs > lib/CPUTime.lhs
+       $(HUGSCPP) ../lib/std/IO.lhs > lib/IO.lhs