Basic #ifdeffery to make StgHugs compile out of the box on cygwin.
# ----------------------------------------------------------------------------- #
-# $Id: Makefile,v 1.11 1999/10/15 11:02:09 sewardj Exp $ #
+# $Id: Makefile,v 1.12 1999/10/29 11:41:04 sewardj Exp $ #
# ----------------------------------------------------------------------------- #
TOP = ../..
# interpreter and relevant .a/.so files #
# --------------------------------------------------------------------- #
+ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
+DYN_EXT=.dll
+else
+DYN_EXT=.so
+endif
+
YACC = bison -y
%.c: %.y
-$(YACC) $<
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 \
- ../rts/StgCRun.o nHandle.so
- $(CC) -o $@ -rdynamic $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) -lbfd -liberty -ldl -lm
+ ../rts/StgCRun.o
+ $(CC) -o $@ $(CC_OPTS) $^ $(GHC_LIBS_NEEDED) -lbfd -liberty -lm
+
-nHandle.so: nHandle.c
- gcc -O -fPIC -shared -o nHandle.so nHandle.c
+nHandle.$(DYN_EXT): nHandle.c
+ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
+ gcc -O -Wall -o nHandle.o -c nHandle.c
+ dllwrap -o nHandle.dll 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 EXTRA_CC_OPTS=-I$(GHC_DIR)/interpreter)
# 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
* included in the distribution.
*
* $RCSfile: connect.h,v $
- * $Revision: 1.13 $
- * $Date: 1999/10/26 17:27:41 $
+ * $Revision: 1.14 $
+ * $Date: 1999/10/29 11:41:04 $
* ------------------------------------------------------------------------*/
/* --------------------------------------------------------------------------
extern Inst addRecShowInst Args((Class,Ext));
extern Inst addRecEqInst Args((Class,Ext));
#endif
+extern List typeVarsIn Args((Cell,List,List,List));
extern List oclose Args((List,List));
extern List zonkTyvarsIn Args((Type,List));
extern Type zonkTyvar Args((Int));
* Hugs version 1.4, December 1997
*
* $RCSfile: interface.c,v $
- * $Revision: 1.5 $
- * $Date: 1999/07/06 15:24:38 $
+ * $Revision: 1.6 $
+ * $Date: 1999/10/29 11:41:04 $
* ------------------------------------------------------------------------*/
/* ToDo:
#include "connect.h"
#include "errors.h"
#include "link.h"
-#include "Assembler.h" /* for wrapping GHC objects */
+#include "Assembler.h" /* for wrapping GHC objects */
#include "dynamic.h"
#define DEBUG_IFACE
fprintf(stderr,"\n");
assert(0);
}
- assert(0); /* NOTREACHED */
+ assert(0);
+ return NIL; /* NOTREACHED */
}
Text m = qmodOf(type);
Text v = qtextOf(type);
Module mod = findModule(m);
-printf ( "lookup qualident " ); print(type,100); printf("\n");
+ //printf ( "lookup qualident " ); print(type,100); printf("\n");
if (isNull(mod)) {
ERRMSG(line)
"Undefined module in qualified name \"%s\"",
fprintf(stderr,"\n");
assert(0);
}
- assert(0); /* NOTREACHED */
+ assert(0);
+ return NIL; /* NOTREACHED */
}
static List local ifTyvarsIn(type)
Type type; {
- List vs = typeVarsIn(type,NIL,NIL);
+ List vs = typeVarsIn(type,NIL,NIL,NIL);
List vs2 = vs;
for (; nonNull(vs2); vs2=tl(vs2)) {
Cell v = hd(vs2);
* ELF specifics
* ------------------------------------------------------------------------*/
+#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS)
+
#include <elf.h>
static char* local findElfSection ( void* objImage, Elf32_Word sh_type )
}
}
+#endif /* defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS) */
+
/* --------------------------------------------------------------------------
* Arch-independent interface to the runtime linker
static Bool local validateOImage ( void* img, Int size, Bool verb )
{
+#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS)
return
validateOImage_elf ( img, size, verb );
+#else
+ internal("validateOImage: not implemented on this platform");
+#endif
}
static Void local resolveReferencesInObjectModule ( Module m, Bool verb )
{
+#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS)
resolveReferencesInObjectModule_elf ( m, verb );
+#else
+ internal("resolveReferencesInObjectModule: not implemented on this platform");
+#endif
}
static Void local readSyms ( Module m )
{
+#if defined(linux_TARGET_OS) || defined(solaris2_TARGET_OS)
readSyms_elf ( m );
+#else
+ internal("readSyms: not implemented on this platform");
+#endif
}
return (int)getenv ( (const char *)p );
}
-extern int prog_argc;
-extern char** prog_argv;
-int nh_argc ( void )
-{
- return prog_argc;
-}
-
-int nh_argvb ( int argno, int offset )
-{
- return (int)(prog_argv[argno][offset]);
-}
* included in the distribution.
*
* $RCSfile: static.c,v $
- * $Revision: 1.13 $
- * $Date: 1999/10/26 17:27:45 $
+ * $Revision: 1.14 $
+ * $Date: 1999/10/29 11:41:05 $
* ------------------------------------------------------------------------*/
#include "prelude.h"
static Name local memberName Args((Class,Text));
static List local numInsert Args((Int,Cell,List));
- List local typeVarsIn Args((Cell,List,List,List));
static List local maybeAppendVar Args((Cell,List));
static Type local checkSigType Args((Int,String,Cell,Type));
* Copyright (c) 1994-1999.
*
* $RCSfile: universal_call_c.S,v $
- * $Revision: 1.7 $
- * $Date: 1999/10/27 15:29:37 $
+ * $Revision: 1.8 $
+ * $Date: 1999/10/29 11:41:12 $
* ------------------------------------------------------------------------*/
#include "config.h"
}
}
#endif
-
+
+#if LEADING_UNDERSCORE
+#define ADD_UNDERSCORE(sss) _##sss
+#else
+#define ADD_UNDERSCORE(sss) sss
+#endif
+
#if i386_TARGET_ARCH
/*
* *and* assumes that I myself was called using ccall.
*/
-.globl universal_call_c_x86_ccall
-universal_call_c_x86_ccall:
+.globl ADD_UNDERSCORE(universal_call_c_x86_ccall)
+ADD_UNDERSCORE(universal_call_c_x86_ccall):
pushl %ebp
movl %esp,%ebp
pushl %edi
# stdcall convention, *but* assumes that I myself was called
# using ccall.
-.globl universal_call_c_x86_stdcall
-universal_call_c_x86_stdcall:
+.globl ADD_UNDERSCORE(universal_call_c_x86_stdcall)
+ADD_UNDERSCORE(universal_call_c_x86_stdcall):
pushl %ebp
movl %esp,%ebp
pushl %edi