forked from arduino/RXTX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.msvc
150 lines (123 loc) · 4.48 KB
/
Makefile.msvc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# ----
# The original author is Eugene Melekhov <[email protected]>
# 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 [email protected]
# ---
# 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
#
# Expect JAVA_HOME to be set as an environment variable from the outside
#JAVA_HOME = D:\Apps\Java\j2sdk1.4.2_17
# Support spaces in directory name
JDKHOME="$(JAVA_HOME)"
COMMINSTALL=$(JDKHOME)\jre\lib\ext
LIBINSTALL=$(JDKHOME)\jre\bin
JUNIT_JAR=D:\Apps\junit3.8.2\junit.jar
# Expect javac to be in the PATH
#JAVAC = $(JDKHOME)\bin\javac -source 1.2 -target 1.2
#JAR = $(JDKHOME)\bin\jar
#JAVAH = $(JDKHOME)\bin\javah
#JAVA = $(JDKHOME)\bin\java
JAVAC = javac -source 1.2 -target 1.2
JAR = jar
JAVAH = javah
JAVA = java
SRC=..\src
CFLAGS= -nologo -MD -I$(JDKHOME)\include -I$(JDKHOME)\include\win32 -I$(SRC) -I. -DWIN32
LINK_FLAGS = -nologo -map -incremental:no -opt:REF
!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
CFLAGS = $(CFLAGS) -O1
!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: $(SRC)\fuserImp.c config.h gnu_io_CommPortIdentifier.h
$(CC) $(CFLAGS) -c $(SRC)\fuserImp.c
termios.obj: $(SRC)\termios.c $(SRC)\win32termios.h config.h
$(CC) $(CFLAGS) -c $(SRC)\termios.c
SerialImp.obj: $(SRC)\SerialImp.c $(SRC)\SerialImp.h $(SRC)\win32termios.h config.h gnu_io_RXTXPort.h
$(CC) $(CFLAGS) -c $(SRC)\SerialImp.c
ParallelImp.obj: $(SRC)\ParallelImp.c $(SRC)\ParallelImp.h $(SRC)\win32termios.h 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 #define HAVE_STDINT_H 1 >> 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"