| 1 |
# ---- |
| 2 |
# The original author is Eugene Melekhov <[email protected]> |
| 3 |
# Object Tools http://www.object-tools.com |
| 4 |
# Contributed to rxtx Wed Sep 8 2004 |
| 5 |
# Reportedly builds rxtxSerial.dll but rxtxParallel.dll is untested. |
| 6 |
# Accepted as is by [email protected] |
| 7 |
# --- |
| 8 |
# This is the first quick and dirty attempt to compile rxtx for Windows |
| 9 |
# using Microsoft Visual C compiler. I've done this mostly to debug rxtx |
| 10 |
# with Microsoft debugger |
| 11 |
# |
| 12 |
# This makefile was made for MSVC 6.0. I'm afraid that debug info command |
| 13 |
# line switches like /Z7 -debugtype:CV -pdb:NONE won't work with |
| 14 |
# MSVC 7.0 or above. |
| 15 |
# Last tested successfully with Visual C++ Express 2008 (without the |
| 16 |
# LINKFLAGS just mentioned). |
| 17 |
# |
| 18 |
# The serial port library seems to be working, except the hangup while |
| 19 |
# writing to unplugged serial port. BTW the mingw32 library behavior |
| 20 |
# is the same. |
| 21 |
# |
| 22 |
# Parallel port library compiles, but I have not used it |
| 23 |
# |
| 24 |
# To build rxtx library execute commands like the following |
| 25 |
# mkdir build |
| 26 |
# copy Makefile.msvc build\Makefile |
| 27 |
# cd build |
| 28 |
# nmake |
| 29 |
# |
| 30 |
# To build only serial/parallel library use |
| 31 |
# nmake serial |
| 32 |
# or |
| 33 |
# nmake parallel |
| 34 |
# |
| 35 |
# If you wish to make the version with debug info then do something |
| 36 |
# like this |
| 37 |
# nmake serial DEBUG_INFO=1 |
| 38 |
# |
| 39 |
# 'nmake clean' will remove all object dll and other working files |
| 40 |
# |
| 41 |
# Please make sure that variable JAVA_HOME points to the place where |
| 42 |
# your Java SDK is located |
| 43 |
# |
| 44 |
|
| 45 |
JAVA_HOME = D:\Apps\Java\j2sdk1.4.2_17 |
| 46 |
COMMINSTALL="$(JAVA_HOME)\jre\lib\ext" |
| 47 |
LIBINSTALL="$(JAVA_HOME)\jre\bin" |
| 48 |
JUNIT_JAR=D:\WS\RSE.new\ws\org.junit\junit.jar |
| 49 |
|
| 50 |
JAVAC = $(JAVA_HOME)\bin\javac -source 1.2 -target 1.2 |
| 51 |
JAR = $(JAVA_HOME)\bin\jar |
| 52 |
JAVAH = $(JAVA_HOME)\bin\javah |
| 53 |
JAVA = $(JAVA_HOME)\bin\java |
| 54 |
|
| 55 |
SRC=..\src |
| 56 |
CFLAGS= -nologo -I$(JAVA_HOME)\include -I$(JAVA_HOME)\include\win32 -I$(SRC) -I. -DWIN32 |
| 57 |
LINK_FLAGS = -nologo -map -incremental:no |
| 58 |
|
| 59 |
!IFDEF DEBUG_INFO |
| 60 |
JAVAC = $(JAVAC) -g |
| 61 |
CFLAGS = -Z7 -Oi -Oy- $(CFLAGS) |
| 62 |
CFLAGS_DLL = $(CFLAGS_DLL) -GZ |
| 63 |
#LINK_FLAGS = $(LINK_FLAGS) -debug -debugtype:CV -pdb:NONE |
| 64 |
LINK_FLAGS = $(LINK_FLAGS) -debug |
| 65 |
DEBUG_INFO_FLAG = DEBUG_INFO^=1 |
| 66 |
!ELSE |
| 67 |
CFLAGS = $(CFLAGS) -Ox |
| 68 |
!ENDIF |
| 69 |
|
| 70 |
OBJS=init.obj SerialImp.obj termios.obj fuserImp.obj |
| 71 |
PARALLEL_OBJS= ParallelImp.obj termios.obj init.obj |
| 72 |
|
| 73 |
|
| 74 |
all: serial parallel |
| 75 |
|
| 76 |
serial: RXTXcomm.jar rxtxSerial.dll |
| 77 |
|
| 78 |
parallel: RXTXcomm.jar rxtxParallel.dll |
| 79 |
|
| 80 |
init.obj: config.h |
| 81 |
$(CC) $(CFLAGS) /TP -c $(SRC)\init.cc |
| 82 |
|
| 83 |
fixup.obj: config.h |
| 84 |
$(CC) $(CFLAGS) -c $(SRC)\fixup.c |
| 85 |
|
| 86 |
fuserImp.obj: config.h gnu_io_CommPortIdentifier.h |
| 87 |
$(CC) $(CFLAGS) -c $(SRC)/fuserImp.c |
| 88 |
|
| 89 |
termios.obj: |
| 90 |
$(CC) $(CFLAGS) -c $(SRC)/termios.c |
| 91 |
SerialImp.obj: config.h gnu_io_RXTXPort.h |
| 92 |
$(CC) $(CFLAGS) -c $(SRC)\SerialImp.c |
| 93 |
|
| 94 |
ParallelImp.obj: config.h gnu_io_LPRPort.h |
| 95 |
$(CC) $(CFLAGS) -c $(SRC)\ParallelImp.c |
| 96 |
|
| 97 |
rxtxSerial.dll: $(OBJS) |
| 98 |
link -dll -out:$@ $** $(LINK_FLAGS) |
| 99 |
|
| 100 |
rxtxParallel.dll: $(PARALLEL_OBJS) |
| 101 |
link -dll -out:$@ $** $(LINK_FLAGS) |
| 102 |
|
| 103 |
|
| 104 |
gnu_io_RXTXPort.h gnu_io_CommPortIdentifier.h gnu_io_LPRPort.h gnu_io_RXTXVersion.h: RXTXcomm.jar |
| 105 |
$(JAVAH) -jni gnu.io.RXTXPort gnu.io.CommPortIdentifier gnu.io.LPRPort gnu.io.RXTXVersion |
| 106 |
|
| 107 |
RXTXcomm.jar: |
| 108 |
$(JAVAC) -d . ..\src\gnu\io\*.java |
| 109 |
$(JAR) -cf RXTXcomm.jar gnu |
| 110 |
|
| 111 |
config.h: Makefile |
| 112 |
echo #define HAVE_FCNTL_H >> config.h |
| 113 |
echo #define HAVE_SIGNAL_H >> config.h |
| 114 |
echo #undef HAVE_SYS_FCNTL_H >> config.h |
| 115 |
echo #undef HAVE_SYS_FILE_H >> config.h |
| 116 |
echo #undef HAVE_SYS_SIGNAL_H >> config.h |
| 117 |
echo #undef HAVE_TERMIOS_H >> config.h |
| 118 |
echo #undef HAVE_SYS_TIME_H >> config.h |
| 119 |
|
| 120 |
testcp\stamp: RXTXcomm.jar ..\tests\gnu\io\rxtx\tests\*.java |
| 121 |
-mkdir testcp |
| 122 |
$(JAVAC) -classpath RXTXcomm.jar;$(JUNIT_JAR) -d testcp ..\tests\gnu\io\rxtx\tests\*.java |
| 123 |
echo > testcp\stamp |
| 124 |
|
| 125 |
tests: all testcp\stamp |
| 126 |
$(JAVA) -classpath RXTXcomm.jar;testcp;$(JUNIT_JAR) gnu.io.rxtx.tests.RXTXTestSuite |
| 127 |
|
| 128 |
clean: |
| 129 |
-rmdir /s /q gnu |
| 130 |
-rmdir /s /q testcp |
| 131 |
-del *.obj *.h RXTXcomm.jar rxtxSerial.* rxtxParallel.* |
| 132 |
|
| 133 |
install: all |
| 134 |
@REM xcopy /Y RXTXcomm.jar $(COMMINSTALL) |
| 135 |
@REM xcopy RXTXcomm.jar "e:\matlab~1\java\jarext\commapi\win32" |
| 136 |
@REM xcopy /Y rxtx*.dll $(LIBINSTALL) |
| 137 |
@REM xcopy $(TARGETLIBS) "e:\matlab~1\bin\win32" |