| View previous topic :: View next topic |
| Author |
Message |
HowardZ
Joined: 27 Oct 2009 Posts: 5
|
Posted: Wed Oct 28, 2009 2:19 pm Post subject: Trying to build RXTXSerial.dll from the open source |
|
|
Hello everyone,
I am trying to rebuild the RXTXComm.jar, RXTXSerial.dll, and RXTXParallel.dll from the GNU open source code.
For those interested, SUN dropped all support for COM port I/O in java, and the RXTX project has been filling in the need. It works on Windows, Linux, and Mac.
I am trying to build it on Windows Vista using the excellent Netbeans development environment.
The source comes with procedures to rebuild it using MinGW and MinGW's make. Using this makefile, I have made a Netbeans makefile - it only works when clicking to Build-All. If I click to compile just one .c file, it has difficulties.
The most perplexing part is the $(LINK.cc) which would not work, so I commented it out and put in its place the MinGW's make statement that came with the open source code.
It would be nice to use Msys make since this is the only one that supposedly works properly with Netbeans.
Anyway, what I have does work when clicking on build-all icon. It is surprising that the Netbeans generated RXTXComm.jar and RXTXSeriall.dll are larger file sizes than those generated with the open source MinGW procedures. Even more perplexing is the RXTXParallel.dll file is considerably smaller file size. I have tested that my RXTXComm.jar and RXTXSerial.dll works ok on my vista system. I don't even have a parallel port on my vista laptop, so that one I have not tested.
I made two Netbeans projects, one for making the RXTXComm.jar file - this works well except that the jar file is larger.l The second Netbeans project is to make the two dll files. This second project is the more difficult to set up one. I have minGW and Msys installed.
Find below the makefile in Netbeans - any suggestions for improvements will be appreciated. I do not really understand the makefile and gcc options as these came from the open source code provided MinGW makefile.
| Code: |
## -*- Makefile -*-
##
## User: Howard
## Time: Oct 27, 2009 1:48:39 PM
## Makefile created by Sun Studio.
##
## This file is generated automatically.
##
#### Compiler and tool definitions shared by all build targets #####
CC = gcc
CCC = g++
CXX = g++
BASICOPTS = -g
CFLAGS = $(BASICOPTS)
CCFLAGS = $(BASICOPTS) $(CFLAGS)
CXXFLAGS = $(BASICOPTS) $(CFLAGS)
CCADMIN =
JDKHOME=C:/jdk1.6.0_16
MINGHOME="C:/minGW"
SRC=./
MINGINCLUDE=$(MINGHOME)/include
JDKINCLUDE=$(JDKHOME)/include
JAVAH=$(JDKHOME)/bin/javah
CLASSPATH=-classpath ".;../RXTXComm/dist/RXTXComm.jar;../RXTXComm/build/classes/;$(JDKHOME)/lib/classes.zip;$(JDKHOME)/jre/lib/rt.jar"
JAVACLASSES=../RXTXComm/build/classes/gnu/io/
INCLUDE= -I ./ -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE)
CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D_JNI_IMPLEMENTATION_ -D __int64="long long" -mno-fp-ret-in-387 -Wall
# Define the target directories.
TARGETDIR_rxtxSerial.dll=dist
TARGETDIR_rxtxParallell.dll=dist
all: $(TARGETDIR_rxtxSerial.dll)/rxtxSerial.dll $(TARGETDIR_rxtxParallell.dll)/rxtxParallell.dll
## Target: rxtxSerial.dll
CFLAGS_rxtxSerial.dll =
CCFLAGS_rxtxSerial.dll =
OBJS_rxtxSerial.dll = \
$(TARGETDIR_rxtxSerial.dll)/fixup.o \
$(TARGETDIR_rxtxSerial.dll)/SerialImp.o \
$(TARGETDIR_rxtxSerial.dll)/termios.o \
$(TARGETDIR_rxtxSerial.dll)/init.o \
$(TARGETDIR_rxtxSerial.dll)/fuserImp.o
# Link or archive
$(TARGETDIR_rxtxSerial.dll)/rxtxSerial.dll: $(TARGETDIR_rxtxSerial.dll) $(OBJS_rxtxSerial.dll) $(DEPLIBS_rxtxSerial.dll)
#$(LINK.cc) $(CCFLAGS_rxtxSerial.dll) $(CPPFLAGS_rxtxSerial.dll) -o $@ $(OBJS_rxtxSerial.dll) $(SHAREDLIB_FLAGS_rxtxSerial.dll) $(LDLIBS_rxtxSerial.dll)
gcc -mno-cygwin -shared -o $@ $(OBJS_rxtxSerial.dll) -lmingw32 -Wl,--kill-at
# Compile source files into .o files
$(TARGETDIR_rxtxSerial.dll)/fixup.o: $(TARGETDIR_rxtxSerial.dll) fixup.c
$(COMPILE.c) $(CFLAGS_rxtxSerial.dll) $(CPPFLAGS_rxtxSerial.dll) -o $@ fixup.c
$(TARGETDIR_rxtxSerial.dll)/SerialImp.o: $(TARGETDIR_rxtxSerial.dll) SerialImp.c win32termios.h config.h gnu_io_RXTXPort.h
$(COMPILE.c) $(CFLAGS_rxtxSerial.dll) $(CPPFLAGS_rxtxSerial.dll) -o $@ SerialImp.c
$(TARGETDIR_rxtxSerial.dll)/termios.o: $(TARGETDIR_rxtxSerial.dll) termios.c config.h
$(COMPILE.c) $(CFLAGS_rxtxSerial.dll) $(CPPFLAGS_rxtxSerial.dll) -o $@ termios.c
$(TARGETDIR_rxtxSerial.dll)/init.o: $(TARGETDIR_rxtxSerial.dll) init.cc
$(COMPILE.cc) $(CCFLAGS_rxtxSerial.dll) $(CPPFLAGS_rxtxSerial.dll) -o $@ init.cc
$(TARGETDIR_rxtxSerial.dll)/fuserImp.o: $(TARGETDIR_rxtxSerial.dll) fuserImp.c config.h gnu_io_CommPortIdentifier.h
$(COMPILE.c) $(CCFLAGS_rxtxSerial.dll) $(CPPFLAGS_rxtxSerial.dll) -o $@ fuserImp.c
## Target: rxtxParallell.dll
CFLAGS_rxtxParallell.dll =
CCFLAGS_rxtxParallell.dll =
OBJS_rxtxParallell.dll = \
$(TARGETDIR_rxtxParallell.dll)/ParallelImp.o \
$(TARGETDIR_rxtxParallell.dll)/termios.o \
$(TARGETDIR_rxtxParallell.dll)/init.o
# Link or archive
$(TARGETDIR_rxtxParallell.dll)/rxtxParallell.dll: $(TARGETDIR_rxtxParallell.dll) $(OBJS_rxtxParallell.dll) $(DEPLIBS_rxtxParallell.dll)
#$(LINK.cc) $(CCFLAGS_rxtxParallell.dll) $(CPPFLAGS_rxtxParallell.dll) -o $@ $(OBJS_rxtxParallell.dll) $(SHAREDLIB_FLAGS_rxtxParallell.dll) $(LDLIBS_rxtxParallell.dll)
gcc -mno-cygwin -shared -o $@ $(OBJS_rxtxParallel.dll) -lmingw32 -Wl,--kill-at
# Compile source files into .o files
$(TARGETDIR_rxtxParallell.dll)/ParallelImp.o: $(TARGETDIR_rxtxParallell.dll) ParallelImp.c ParallelImp.h win32termios.h config.h gnu_io_LPRPort.h
$(COMPILE.c) $(CFLAGS_rxtxParallell.dll) $(CPPFLAGS_rxtxParallell.dll) -o $@ ParallelImp.c
$(TARGETDIR_rxtxParallell.dll)/termios.o: $(TARGETDIR_rxtxParallell.dll) termios.c config.h
$(COMPILE.c) $(CFLAGS_rxtxParallell.dll) $(CPPFLAGS_rxtxParallell.dll) -o $@ termios.c
$(TARGETDIR_rxtxParallell.dll)/init.o: $(TARGETDIR_rxtxParallell.dll) init.cc
$(COMPILE.cc) $(CCFLAGS_rxtxParallell.dll) $(CPPFLAGS_rxtxParallell.dll) -o $@ init.cc
config.h: Makefile
echo "#define HAVE_FCNTL_H 1" > config.h
echo "#define HAVE_SIGNAL_H 1" >> config.h
echo "#define HAVE_SYS_FCNTL_H 1" >> config.h
echo "#define HAVE_SYS_FILE_H 1" >> config.h
echo "#undef HAVE_SYS_SIGNAL_H" >> config.h
echo "#undef HAVE_TERMIOS_H" >> config.h
gnu_io_RXTXPort.h: $(JAVACLASSES)RXTXPort.class
pwd
$(JAVAH) $(CLASSPATH) -jni gnu.io.RXTXPort
gnu_io_CommPortIdentifier.h: $(JAVACLASSES)CommPortIdentifier.class
$(JAVAH) $(CLASSPATH) -jni gnu.io.CommPortIdentifier
gnu_io_LPRPort.h: $(JAVACLASSES)LPRPort.class
$(JAVAH) $(CLASSPATH) -jni gnu.io.LPRPort
gnu_io_RXTXVersion.h: $(JAVACLASSES)RXTXVersion.class
$(JAVAH) $(CLASSPATH) -jni gnu.io.RXTXVersion
#### Clean target deletes all generated files ####
clean:
rm -f \
$(TARGETDIR_rxtxSerial.dll)/rxtxSerial.dll \
$(TARGETDIR_rxtxSerial.dll)/fixup.o \
$(TARGETDIR_rxtxSerial.dll)/SerialImp.o \
$(TARGETDIR_rxtxSerial.dll)/termios.o \
$(TARGETDIR_rxtxSerial.dll)/init.o \
$(TARGETDIR_rxtxParallell.dll)/rxtxParallell.dll \
$(TARGETDIR_rxtxParallell.dll)/ParallelImp.o \
$(TARGETDIR_rxtxParallell.dll)/termios.o \
$(TARGETDIR_rxtxParallell.dll)/init.o
$(CCADMIN)
rm -f -r $(TARGETDIR_rxtxParallell.dll)
rm -f -r $(TARGETDIR_rxtxSerial.dll)
rm -f gnu_io_*.*
rm -f config.h
sleep 5
# Create the target directory (if needed)
$(TARGETDIR_rxtxParallell.dll):
mkdir -p $(TARGETDIR_rxtxParallell.dll)
$(TARGETDIR_rxtxSerial.dll):
mkdir -p $(TARGETDIR_rxtxSerial.dll)
# Enable dependency checking
.KEEP_STATE:
.KEEP_STATE_FILE:.make.state.GNU-x86-Windows
|
BTW, the JDK is installed off the C:\ so that there will be no blanks in the directory name. There seems to be problems when it is in the C:\Program Files directory.
My goal is to be able to seamlessly use Netbeans for this project. _________________ Howard |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|
|