Debian Codegraph @

Makefile.mingw32

raw
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-2008 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 # This Makefile works on windows 98/NT with mingw32 in a DOS shell.
59 # Do not run in MSYS! Last tested on WinXP with MinGW-5.1.4
60 # (gcc-3.4.5, binutils-2.17.50, mingw32-make-3.81, w32api-3.12).
61 #
62 # SET PATH=c:\mingw\bin;c:\jdk142\bin;C:\WINDOWS\SYSTEM32
63 # mkdir build-mingw
64 # copy ..\Makefile.mingw32 build-mingw\Makefile
65 # cd build-mingw
66 # REM Edit Makefile settings to change user variables as needed
67 # mingw32-make SHELL=cmd
68 # mingw32-make SHELL=cmd install
69
70 ######################
71 # user defined variables
72 ######################
73
74 # path to the source code (directory with SerialImp.c) Unix style path
75 SRC=../src
76
77 # path to the jdk directory that has include, bin, lib, ... Unix style path
78 JDKHOME=D:\Apps\Java\j2sdk1.4.2_17
79
80 #path to mingw32
81 MINGHOME="D:\mingw"
82
83 # path to install RXTXcomm.jar DOS style path
84 COMMINSTALL="$(JDKHOME)\jre\lib\ext"
85
86 # path to install the shared libraries DOS style path
87 LIBINSTALL="$(JDKHOME)\jre\bin"
88
89 # path to the mingw32 libraries (directory with libmingw32.a) DOS style path
90 LIBDIR="$(MINGHOME)\lib"
91
92 ######################
93 # End of user defined variables
94 ######################
95
96
97 ######################
98 # Tools
99 ######################
100
101 AS=as
102 CC=gcc
103 LD=ld
104 DLLTOOL=dlltool
105 # this looks like a nice tool but I was not able to get symbols in the dll.
106 DLLWRAP=dllwrap
107
108 CLASSPATH=-classpath ".;C:\jdk13\lib\RXTXcomm.jar;c:\BlackBox.jar;$(JDKHOME)\lib\classes.zip;$(JDKHOME)\jre\lib\rt.jar"
109 JAVAH=javah $(CLASSPATH)
110 JAR=jar
111 JAVAC=$(JDKHOME)\bin\javac -source 1.2 -target 1.2 -g $(CLASSPATH)
112 #JAVAC=$(JDKHOME)\bin\javac -g $(CLASSPATH)
113
114 ######################
115 # Tool Flags
116 ######################
117
118 CFLAGS_CYGWIN= -O2 $(INCLUDE) -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall
119 CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D_JNI_IMPLEMENTATION_ -D __int64="long long" -mno-fp-ret-in-387 -Wall
120 #CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D_JNI_IMPLEMENTATION_ -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS
121 INCLUDE= -I c:\matlab6p5/extern/include/ -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE)
122 LIBS=-L . -L $(LIBDIR) -LC:/tmp/rxtx5/build -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmoldname -lcrtdll
123 # -lmex
124
125 # path to the java native interface headers (directory with jni.h)
126 JDKINCLUDE=$(JDKHOME)/include
127 MINGINCLUDE=$(MINGHOME)/include
128 JAVAFILES = $(wildcard $(SRC)/gnu/io/*.java)
129 CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc)
130 TARGETLIBS= rxtxSerial.dll rxtxParallel.dll
131 #TARGETLIBS= rxtxSerial.dll rxtxParallel.dll rxtxZystem.dll
132 DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o
133 PARALLELOBJECTS= ParallelImp.o termios.o init.o
134
135 all: $(TARGETLIBS) # rebuild rebuild will force everything to be built.
136
137 rebuild:
138 -rmdir /s /q gnu
139 -del /q RXTXcomm.jar rxtxSerial.* rxtxParallel.* *.o
140
141 # FIXME make 3.79.1 behaves really strage if we use %.o rules.
142
143 init.o: $(SRC)/init.cc
144 $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o
145
146 fixup.o: $(SRC)/fixup.c
147 $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o
148
149 #ZystemImp.o: config.h
150 # $(CC) $(CFLAGS_CYGWIN) -c $(SRC)/ZystemImp.c -o ZystemImp.o
151
152 SerialImp.o: $(SRC)/SerialImp.c $(SRC)/SerialImp.h config.h gnu_io_RXTXPort.h
153 $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o
154
155 fuserImp.o: $(SRC)/fuserImp.c config.h gnu_io_CommPortIdentifier.h
156 $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o
157
158 termios.o: $(SRC)/termios.c
159 $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o
160
161 ParallelImp.o: $(SRC)/ParallelImp.c $(SRC)/ParallelImp.h $(SRC)/win32termios.h config.h gnu_io_LPRPort.h
162 $(CC) $(CFLAGS) -c $(SRC)/$*.c -o ParallelImp.o
163
164 # This file is a pain in the rear to generate. If your looking at this you
165 # need to install cygwin.
166
167 rxtxZystem.dll: RXTXcomm.jar $(DLLOBJECTS) $(SRC)/ZystemImp.c #ZystemImp.o
168 gcc -c -DBUILDING_DLL=1 -D_DLL=1 -I. -Ic:/jdk13/include -Ic:/jdk13/include/win32 -Wall -O2 -D __int64="long long" -o ZystemImp.o $(SRC)/ZystemImp.c
169 dllwrap --verbose --no-default-excludes --export-all-symbols --output-exp Zystem.exp --output-def Zystem.def --add-stdcall-alias --driver-name gcc -o rxtxZystem.dll ZystemImp.o -Wl,-e,__cygwin_noncygwin_dll_entry@12 -s
170
171 rxtxSerial.dll: RXTXcomm.jar $(DLLOBJECTS)
172 gcc -mno-cygwin -shared -o $@ $(DLLOBJECTS) -lmingw32 -Wl,--kill-at
173
174 rxtxParallel.dll: $(PARALLELOBJECTS)
175 gcc -mno-cygwin -shared -o $@ $(PARALLELOBJECTS) -lmingw32 -Wl,--kill-at
176
177 gnu_io_RXTXPort.h gnu_io_CommPortIdentifier.h gnu_io_LPRPort.h gnu_io_RXTXVersion.h: RXTXcomm.jar
178 $(JAVAH) -jni gnu.io.RXTXPort gnu.io.CommPortIdentifier gnu.io.LPRPort gnu.io.RXTXVersion
179
180 RXTXcomm.jar: $(JAVAFILES)
181 $(JAVAC) -d . $(JAVAFILES)
182 $(JAR) -cf RXTXcomm.jar gnu
183
184 config.h: Makefile
185 echo "#define HAVE_FCNTL_H 1" > config.h
186 echo "#define HAVE_SIGNAL_H 1" >> config.h
187 echo "#define HAVE_SYS_FCNTL_H 1" >> config.h
188 echo "#define HAVE_SYS_FILE_H 1" >> config.h
189 echo "#undef HAVE_SYS_SIGNAL_H" >> config.h
190 echo "#undef HAVE_TERMIOS_H" >> config.h
191
192 install: all
193 xcopy /Y RXTXcomm.jar $(COMMINSTALL)
194 @REM xcopy RXTXcomm.jar "e:\matlab~1\java\jarext\commapi\win32"
195 xcopy /Y rxtx*.dll $(LIBINSTALL)
196 @REM xcopy $(TARGETLIBS) "e:\matlab~1\bin\win32"
197
198 uninstall:
199 del $(COMMINSTALL)\\\RXTXcomm.jar
200 del $(LIBINSTALL)\\\rxtx*.dll
201
202 clean:
203 -rmdir /s /q gnu
204 -del /Q *.o RXTXcomm.jar rxtxSerial.dll rxtxParallel.dll config.h gnu_io_*.h