# ---- # The original author is Eugene Melekhov # Object Tools http://www.object-tools.com # Contributed to rxtx Wed Sep 8 2004 # Reportedly builds rxtxSerial.dll but rxtxParallel.dll is untested. # Accepted as is by taj@www.linux.org.uk # --- # This is the first quick and dirty attempt to compile rxtx for Windows # using Microsoft Visual C compiler. I've done this mostly to debug rxtx # with Microsoft debugger # # This makefile was made for MSVC 6.0. I'm afraid that debug info command # line switches like /Z7 -debugtype:CV -pdb:NONE won't work with # MSVC 7.0 or above. # Last tested successfully with Visual C++ Express 2008 (without the # LINKFLAGS just mentioned). # # The serial port library seems to be working, except the hangup while # writing to unplugged serial port. BTW the mingw32 library behavior # is the same. # # Parallel port library compiles, but I have not used it # # To build rxtx library execute commands like the following # mkdir build # copy Makefile.msvc build\Makefile # cd build # nmake # # To build only serial/parallel library use # nmake serial # or # nmake parallel # # If you wish to make the version with debug info then do something # like this # nmake serial DEBUG_INFO=1 # # 'nmake clean' will remove all object dll and other working files # # Please make sure that variable JAVA_HOME points to the place where # your Java SDK is located # JAVA_HOME = D:\Apps\Java\j2sdk1.4.2_17 COMMINSTALL="$(JAVA_HOME)\jre\lib\ext" LIBINSTALL="$(JAVA_HOME)\jre\bin" JUNIT_JAR=D:\WS\RSE.new\ws\org.junit\junit.jar JAVAC = $(JAVA_HOME)\bin\javac -source 1.2 -target 1.2 JAR = $(JAVA_HOME)\bin\jar JAVAH = $(JAVA_HOME)\bin\javah JAVA = $(JAVA_HOME)\bin\java SRC=..\src CFLAGS= -nologo -I$(JAVA_HOME)\include -I$(JAVA_HOME)\include\win32 -I$(SRC) -I. -DWIN32 LINK_FLAGS = -nologo -map -incremental:no !IFDEF DEBUG_INFO JAVAC = $(JAVAC) -g CFLAGS = -Z7 -Oi -Oy- $(CFLAGS) CFLAGS_DLL = $(CFLAGS_DLL) -GZ #LINK_FLAGS = $(LINK_FLAGS) -debug -debugtype:CV -pdb:NONE LINK_FLAGS = $(LINK_FLAGS) -debug DEBUG_INFO_FLAG = DEBUG_INFO^=1 !ELSE CFLAGS = $(CFLAGS) -Ox !ENDIF OBJS=init.obj SerialImp.obj termios.obj fuserImp.obj PARALLEL_OBJS= ParallelImp.obj termios.obj init.obj all: serial parallel serial: RXTXcomm.jar rxtxSerial.dll parallel: RXTXcomm.jar rxtxParallel.dll init.obj: config.h $(CC) $(CFLAGS) /TP -c $(SRC)\init.cc fixup.obj: config.h $(CC) $(CFLAGS) -c $(SRC)\fixup.c fuserImp.obj: config.h gnu_io_CommPortIdentifier.h $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c termios.obj: $(CC) $(CFLAGS) -c $(SRC)/termios.c SerialImp.obj: config.h gnu_io_RXTXPort.h $(CC) $(CFLAGS) -c $(SRC)\SerialImp.c ParallelImp.obj: config.h gnu_io_LPRPort.h $(CC) $(CFLAGS) -c $(SRC)\ParallelImp.c rxtxSerial.dll: $(OBJS) link -dll -out:$@ $** $(LINK_FLAGS) rxtxParallel.dll: $(PARALLEL_OBJS) link -dll -out:$@ $** $(LINK_FLAGS) gnu_io_RXTXPort.h gnu_io_CommPortIdentifier.h gnu_io_LPRPort.h gnu_io_RXTXVersion.h: RXTXcomm.jar $(JAVAH) -jni gnu.io.RXTXPort gnu.io.CommPortIdentifier gnu.io.LPRPort gnu.io.RXTXVersion RXTXcomm.jar: $(JAVAC) -d . ..\src\gnu\io\*.java $(JAR) -cf RXTXcomm.jar gnu config.h: Makefile echo #define HAVE_FCNTL_H >> config.h echo #define HAVE_SIGNAL_H >> config.h echo #undef HAVE_SYS_FCNTL_H >> config.h echo #undef HAVE_SYS_FILE_H >> config.h echo #undef HAVE_SYS_SIGNAL_H >> config.h echo #undef HAVE_TERMIOS_H >> config.h echo #undef HAVE_SYS_TIME_H >> config.h testcp\stamp: RXTXcomm.jar ..\tests\gnu\io\rxtx\tests\*.java -mkdir testcp $(JAVAC) -classpath RXTXcomm.jar;$(JUNIT_JAR) -d testcp ..\tests\gnu\io\rxtx\tests\*.java echo > testcp\stamp tests: all testcp\stamp $(JAVA) -classpath RXTXcomm.jar;testcp;$(JUNIT_JAR) gnu.io.rxtx.tests.RXTXTestSuite clean: -rmdir /s /q gnu -rmdir /s /q testcp -del *.obj *.h RXTXcomm.jar rxtxSerial.* rxtxParallel.* install: all @REM xcopy /Y RXTXcomm.jar $(COMMINSTALL) @REM xcopy RXTXcomm.jar "e:\matlab~1\java\jarext\commapi\win32" @REM xcopy /Y rxtx*.dll $(LIBINSTALL) @REM xcopy $(TARGETLIBS) "e:\matlab~1\bin\win32"