# adaption of the following two lines is necessary
JDK_HOME = d:\programs\sun\j2sdk1_4_0_01
LIBPATH = D:\programs\MinGW\lib

INCLUDES = -I. -I$(JDK_HOME)\include -I$(JDK_HOME)\include\win32


SRC_DIR = ../jvmpi4ddj_c_sources

all: jvmpi4ddj.dll

jvmpi4ddj.dll: 
	gcc -c -x c++ $(SRC_DIR)/jvmpi4ddj.cc $(INCLUDES)
	gcc -c $(SRC_DIR)/init.cc
	
	echo EXPORTS > jvmpi4ddj.def
	
	#create def file for win32, not sure wether this is necessary
	nm jvmpi4ddj.o init.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> jvmpi4ddj.def
	ld --add-stdcall-alias --base-file jvmpi4ddj.base --dll -o jvmpi4ddj.dll jvmpi4ddj.o init.o $(LIBPATH)/libcrtdll.a -e _dll_entry@12
	dlltool --as=as --dllname jvmpi4ddj.dll --def jvmpi4ddj.def --base-file jvmpi4ddj.base --output-exp jvmpi4ddj.exp
	

clean:
	rm jvmpi4ddj.dll
	rm jvmpi4ddj.o
	rm jvmpi4ddj.base
	rm jvmpi4ddj.def
