| 1 |
########################################################################### |
| 2 |
# RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface. |
| 3 |
# RXTX is a native interface to serial ports in java. |
| 4 |
# Copyright 1997-2007 by Trent Jarvi [email protected] and others who |
| 5 |
# actually wrote it. See individual source files for more information. |
| 6 |
# |
| 7 |
# A copy of the LGPL v 2.1 may be found at |
| 8 |
# http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is |
| 9 |
# here for your convenience. |
| 10 |
# |
| 11 |
# This library is free software; you can redistribute it and/or |
| 12 |
# modify it under the terms of the GNU Lesser General Public |
| 13 |
# License as published by the Free Software Foundation; either |
| 14 |
# version 2.1 of the License, or (at your option) any later version. |
| 15 |
# |
| 16 |
# This library is distributed in the hope that it will be useful, |
| 17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 |
# Lesser General Public License for more details. |
| 20 |
# |
| 21 |
# An executable that contains no derivative of any portion of RXTX, but |
| 22 |
# is designed to work with RXTX by being dynamically linked with it, |
| 23 |
# is considered a "work that uses the Library" subject to the terms and |
| 24 |
# conditions of the GNU Lesser General Public License. |
| 25 |
# |
| 26 |
# The following has been added to the RXTX License to remove |
| 27 |
# any confusion about linking to RXTX. We want to allow in part what |
| 28 |
# section 5, paragraph 2 of the LGPL does not permit in the special |
| 29 |
# case of linking over a controlled interface. The intent is to add a |
| 30 |
# Java Specification Request or standards body defined interface in the |
| 31 |
# future as another exception but one is not currently available. |
| 32 |
# |
| 33 |
# http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface |
| 34 |
# |
| 35 |
# As a special exception, the copyright holders of RXTX give you |
| 36 |
# permission to link RXTX with independent modules that communicate with |
| 37 |
# RXTX solely through the Sun Microsytems CommAPI interface version 2, |
| 38 |
# regardless of the license terms of these independent modules, and to copy |
| 39 |
# and distribute the resulting combined work under terms of your choice, |
| 40 |
# provided that every copy of the combined work is accompanied by a complete |
| 41 |
# copy of the source code of RXTX (the version of RXTX used to produce the |
| 42 |
# combined work), being distributed under the terms of the GNU Lesser General |
| 43 |
# Public License plus this exception. An independent module is a |
| 44 |
# module which is not derived from or based on RXTX. |
| 45 |
# |
| 46 |
# Note that people who make modified versions of RXTX are not obligated |
| 47 |
# to grant this special exception for their modified versions; it is |
| 48 |
# their choice whether to do so. The GNU Lesser General Public License |
| 49 |
# gives permission to release a modified version without this exception; this |
| 50 |
# exception also makes it possible to release a modified version which |
| 51 |
# carries forward this exception. |
| 52 |
# |
| 53 |
# You should have received a copy of the GNU Lesser General Public |
| 54 |
# License along with this library; if not, write to the Free |
| 55 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 56 |
# All trademarks belong to their respective owners. |
| 57 |
############################################################################ |
| 58 |
srcdir = @srcdir@ |
| 59 |
abs_srcdir=$(TOP)/@srcdir@ |
| 60 |
VPATH = @srcdir@ |
| 61 |
|
| 62 |
AUTOMAKE_OPTIONS = foreign |
| 63 |
INCLUDES= -I$(TOP) -I$(DEST) -I. $(JAVAINCLUDE) $(JAVANATINC) |
| 64 |
####################### vars for rxtx-1.4->1.5 transition |
| 65 |
JARTARGET=RXTXcomm.jar |
| 66 |
CLASSDIR=gnu.io |
| 67 |
CLASSTOP=gnu |
| 68 |
CLASSDEST=gnu/io |
| 69 |
####################### tools |
| 70 |
LIBTOOLC=$(GLIBTOOL) --mode=compile $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(VERBOSE_IOEXCEPTIONS) -c |
| 71 |
LIBTOOL_INST=$(GLIBTOOL) --mode=install $(INSTALL_PROGRAM) |
| 72 |
####################### dirs |
| 73 |
SPATH = $(abs_srcdir)/src |
| 74 |
DEST=$(target_triplet) |
| 75 |
####################### rules |
| 76 |
CLASSES = $(patsubst $(SPATH)/gnu/io/%.java,$(TOP)/$(CLASSDEST)/%.class,$(wildcard $(SPATH)/gnu/io/*.java)) |
| 77 |
javafiles = $(wildcard $(SPATH)/gnu/io/*.java) |
| 78 |
javahfiles = $(patsubst $(SPATH)/gnu/io/%.java,%,$(wildcard $(SPATH)/gnu/io/*.java)) |
| 79 |
|
| 80 |
####################### |
| 81 |
CLEANFILES = $(TOP)/*.class $(TOP)/$(CLASSDEST)/*.class $(TOP)/$(JARTARGET) |
| 82 |
|
| 83 |
# for SCO builds everything else is currently using lib%.la below |
| 84 |
# I'm thinking about taking libtool out completely. See also Mac OS X builds. |
| 85 |
$(target_triplet)/lib%.so: $(SPATH)/%Imp.@EXTENSION@ $(CLASSES) |
| 86 |
$(COMPILE) $(SPATH)/$*Imp.@EXTENSION@ -o $(TOP)/$(DEST)/$*Imp.o |
| 87 |
$(LINK) -G -o lib$*.so $(TOP)/$(DEST)/$*Imp.o |
| 88 |
|
| 89 |
# compile src/SerialImp.c and similar files into libraries. |
| 90 |
# LIBTOOL_FIX handles problems encountered on some OS's. See configure.in |
| 91 |
# If a LIBTOOL_FIX is added be sure to provide a trailing ';' in configure.in |
| 92 |
|
| 93 |
$(target_triplet)/librxtx%.@LIB_EXTENSION@: $(SPATH)/%Imp.c $(CLASSES) $(SPATH)/%Imp.h |
| 94 |
( \ |
| 95 |
$(LIBTOOL_FIX) \ |
| 96 |
cd $(DEST); \ |
| 97 |
$(LIBTOOLC) $(SPATH)/$*Imp.@EXTENSION@ -o \ |
| 98 |
$(TOP)/$(DEST)/$*Imp.@OBJECT_EXTENSION@; \ |
| 99 |
if [ "$*" = "Serial" ]; then \ |
| 100 |
$(LIBTOOLC) $(SPATH)/fuserImp.@EXTENSION@ -o \ |
| 101 |
$(TOP)/$(DEST)/fuserImp.@OBJECT_EXTENSION@; \ |
| 102 |
@LINK@ $(TOP)/$(DEST)/$*Imp.@OBJECT_EXTENSION@ \ |
| 103 |
$(TOP)/$(DEST)/fuserImp.@OBJECT_EXTENSION@; \ |
| 104 |
else \ |
| 105 |
@LINK@ $(TOP)/$(DEST)/$*Imp.@OBJECT_EXTENSION@; \ |
| 106 |
fi; \ |
| 107 |
) |
| 108 |
|
| 109 |
# compile src/RXTXPort.java and similar files into classes |
| 110 |
# then create the .jar file |
| 111 |
$(CLASSES): $(javafiles) $(TOP)/Makefile |
| 112 |
$(JAVAH_FIX) |
| 113 |
$(JAVAC) $(javafiles) |
| 114 |
$(JAVAH) `(for i in $(javahfiles);do \ |
| 115 |
if grep > /dev/null native.*\( $(SPATH)/gnu/io/$$i.java; then \ |
| 116 |
echo $(CLASSDIR).$$i; \ |
| 117 |
fi; \ |
| 118 |
done)` |
| 119 |
$(JAR) cf $(JARTARGET) $(CLASSTOP)/* |
| 120 |
|
| 121 |
# install librxtxSerial.so into the proper directory and copy $(JARTARGET) to its |
| 122 |
# proper location |
| 123 |
install: all |
| 124 |
@$(LIBTOOL_INST) \ |
| 125 |
`for i in $(TARGETLIB);do \ |
| 126 |
if [ -f $$i ];then \ |
| 127 |
echo $$i; \ |
| 128 |
fi; \ |
| 129 |
done` $(RXTX_PATH) |
| 130 |
$(INSTALL_PROGRAM) $(JARTARGET) $(JHOME)/ |
| 131 |
|
| 132 |
clean-generic: |
| 133 |
rm -rf $(DEST) $(TOP)/$(CLASSTOP) |
| 134 |
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) |
| 135 |
|
| 136 |
all: $(TARGETLIB) |
| 137 |
|
| 138 |
# create the javadoc files. |
| 139 |
docs: $(CLASSES) |
| 140 |
mkdir api |
| 141 |
cd api && $(JAVADOC) $(javafiles) |
| 142 |
|
| 143 |
################ WIN32 CrossCompiling from here down ####################### |
| 144 |
|
| 145 |
$(DEST)/rxtxSerial.dll: $(CLASSES) $(TOP)/Makefile |
| 146 |
gcc -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -b$(target_alias) -I $(TOP) -I $(DEST) -I . $(WINDOWS_JAVA_INCLUDE) -I $(SPATH) -Wall -c $(SPATH)/SerialImp.c -o $(DEST)/SerialImp.o |
| 147 |
gcc -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -b$(target_alias) -I $(TOP) -I $(DEST) -I . $(WINDOWS_JAVA_INCLUDE) -I $(SPATH) -Wall -c $(SPATH)/termios.c -o $(DEST)/termios.o |
| 148 |
gcc -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -b$(target_alias) -I $(TOP) -I $(DEST) -I . $(WINDOWS_JAVA_INCLUDE) -I $(SPATH) -Wall -c $(SPATH)/fixup.c -o $(DEST)/fixup.o |
| 149 |
gcc -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -b$(target_alias) -I $(TOP) -I $(DEST) -I . $(WINDOWS_JAVA_INCLUDE) -I $(SPATH) -Wall -c $(SPATH)/init.cc -o $(DEST)/init.o |
| 150 |
ld --base-file $(DEST)/Serial.base --dll -o $(DEST)/rxtxSerial.dll $(DEST)/termios.o $(DEST)/SerialImp.o $(DEST)/fixup.o $(DEST)/init.o -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll -e _dll_entry@12 --base-file $(DEST)/Serial.base |
| 151 |
echo EXPORTS >$(DEST)/Serial.def;for i in `nm $(DEST)/rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Serial.def |
| 152 |
dlltool -b$(DEST) --as=as --dllname $(DEST)/rxtxSerial.dll --def $(DEST)/Serial.def --base-file $(DEST)/Serial.base --output-exp $(DEST)/Serial.exp |
| 153 |
ld --base-file $(DEST)/Serial.base $(DEST)/Serial.exp -dll -o $(DEST)/rxtxSerial.dll $(DEST)/termios.o $(DEST)/SerialImp.o $(DEST)/fixup.o $(DEST)/init.o -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll -e _dll_entry@12 --base-file $(DEST)/Serial.base |
| 154 |
dlltool -b$(DEST) --as=as --dllname $(DEST)/rxtxSerial.dll --def $(DEST)/Serial.def --base-file $(DEST)/Serial.base --output-exp $(DEST)/Serial.exp |
| 155 |
ld $(DEST)/Serial.exp -dll -o $(DEST)/rxtxSerial.dll $(DEST)/termios.o $(DEST)/SerialImp.o $(DEST)/fixup.o $(DEST)/init.o -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll -e _dll_entry@12 --base-file $(DEST)/Serial.base |
| 156 |
|
| 157 |
$(DEST)/rxtxParallel.dll: $(CLASSES) $(TOP)/Makefile |
| 158 |
gcc -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -b$(target_alias) -I $(TOP) -I $(DEST) -I . $(WINDOWS_JAVA_INCLUDE) -I $(SPATH) -Wall -c $(SPATH)/ParallelImp.c -o $(DEST)/ParallelImp.o |
| 159 |
gcc -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -b$(target_alias) -I $(TOP) -I $(DEST) -I . $(WINDOWS_JAVA_INCLUDE) -I $(SPATH) -Wall -c $(SPATH)/termios.c -o $(DEST)/termios.o |
| 160 |
gcc -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -b$(target_alias) -I $(TOP) -I $(DEST) -I . $(WINDOWS_JAVA_INCLUDE) -I $(SPATH) -Wall -c $(SPATH)/fixup.c -o $(DEST)/fixup.o |
| 161 |
gcc -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -b$(target_alias) -I $(TOP) -I $(DEST) -I . $(WINDOWS_JAVA_INCLUDE) -I $(SPATH) -Wall -c $(SPATH)/init.cc -o $(DEST)/init.o |
| 162 |
ld --base-file $(DEST)/Parallel.base --dll -o $(DEST)/rxtxParallel.dll $(DEST)/termios.o $(DEST)/ParallelImp.o $(DEST)/fixup.o $(DEST)/init.o -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll -e _dll_entry@12 --base-file $(DEST)/Parallel.base |
| 163 |
echo EXPORTS >$(DEST)/Parallel.def;for i in `nm $(DEST)/rxtxParallel.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(DEST)/Parallel.def |
| 164 |
dlltool -b$(DEST) --as=as --dllname $(DEST)/rxtxParallel.dll --def $(DEST)/Parallel.def --base-file $(DEST)/Parallel.base --output-exp $(DEST)/Parallel.exp |
| 165 |
ld --base-file $(DEST)/Parallel.base $(DEST)/Parallel.exp -dll -o $(DEST)/rxtxParallel.dll $(DEST)/termios.o $(DEST)/ParallelImp.o $(DEST)/fixup.o $(DEST)/init.o -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll -e _dll_entry@12 --base-file $(DEST)/Parallel.base |
| 166 |
dlltool -b$(DEST) --as=as --dllname $(DEST)/rxtxParallel.dll --def $(DEST)/Parallel.def --base-file $(DEST)/Parallel.base --output-exp $(DEST)/Parallel.exp |
| 167 |
ld $(DEST)/Parallel.exp -dll -o $(DEST)/rxtxParallel.dll $(DEST)/termios.o $(DEST)/ParallelImp.o $(DEST)/fixup.o $(DEST)/init.o -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmingw32 -lmoldname -lcrtdll -e _dll_entry@12 --base-file $(DEST)/Parallel.base |
| 168 |
|