File: Makefile.msvc

package info (click to toggle)
rxtx 2.2pre2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 6,208 kB
  • ctags: 3,614
  • sloc: ansic: 14,345; sh: 10,742; java: 7,605; cpp: 2,717; makefile: 141
file content (137 lines) | stat: -rw-r--r-- 4,278 bytes parent folder | download | duplicates (4)
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
# ----
# The original author is  Eugene Melekhov <eugene_melekhov@mail.ru>
#  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:\Apps\junit3.8.2\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: $(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 #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"