Testing out the PPD42 Air Quality Sensor, with an MSP430 Launchpad and graphing the data with GNUplot.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

230 lines
9.2 KiB

5 years ago
  1. #-------------------------------------------------------------------------
  2. # rxtx is a native interface to serial ports in java.
  3. # Copyright 1997-2004 by Trent Jarvi taj@www.linux.org.uk.
  4. #
  5. # This library is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU Library General Public
  7. # License as published by the Free Software Foundation; either
  8. # version 2 of the License, or (at your option) any later version.
  9. #
  10. # This library is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # Library General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Library General Public
  16. # License along with this library; if not, write to the Free
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #-------------------------------------------------------------------------
  19. # This Makefile works on windows 98/NT with mingw32 in a DOS shell
  20. # One catch. We cant figure out how to generate .def files with default
  21. # DOS tools and mingw32. Install Cygwin if you are adding/removing/chaninging
  22. # C functions.
  23. # mingw build tools are used
  24. # PATH=c:\mingw\bin;c:\jdk118\bin;%PATH%
  25. # mingw32 version 1.0.1-20010726
  26. # jdk was 1.1.8
  27. # java.sun.com
  28. ######################
  29. # user defined variables
  30. ######################
  31. # path to the source code (directory with SerialImp.c) Unix style path
  32. SRC=../src
  33. # and the dos path
  34. DOSSRC=..\\\src
  35. # path to the jdk directory that has include, bin, lib, ... Unix style path
  36. JDKHOME=C:/jdk13
  37. #path to mingw32
  38. MINGHOME="D:/mingw"
  39. # path to install RXTXcomm.jar DOS style path
  40. COMMINSTALL="C:\jdk13\lib"
  41. # path to install the shared libraries DOS style path
  42. LIBINSTALL="C:\jdk13\bin"
  43. # path to the mingw32 libraries (directory with libmingw32.a) DOS style path
  44. LIBDIR="c:\cygwin\lib\mingw"
  45. ######################
  46. # End of user defined variables
  47. ######################
  48. ######################
  49. # Tools
  50. ######################
  51. AS=as
  52. CC=gcc
  53. LD=ld
  54. DLLTOOL=dlltool
  55. # this looks like a nice tool but I was not able to get symbols in the dll.
  56. DLLWRAP=dllwrap
  57. CLASSPATH=-classpath ".;C:\jdk13\lib\RXTXcomm.jar;c:\BlackBox.jar;c:\jdk13\lib\classes.zip"
  58. JAVAH=javah $(CLASSPATH)
  59. JAR=jar
  60. JAVAC=javac $(CLASSPATH)
  61. ######################
  62. # Tool Flags
  63. ######################
  64. CFLAGS_CYGWIN= -O2 $(INCLUDE) -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall
  65. CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall
  66. #CFLAGS= -O2 $(INCLUDE) -mno-cygwin -DWIN32 -D __int64="long long" -mno-fp-ret-in-387 -Wall -D TRENT_IS_HERE_DEBUGGING_ENUMERATION -DTRENT_IS_HERE_DEBUGGING_THREADS
  67. INCLUDE= -I c:\matlab6p5/extern/include/ -I . -I $(JDKINCLUDE) -I $(JDKINCLUDE)/win32 -I $(SRC) -I include -I $(MINGINCLUDE)
  68. JAVAHFLAGS= -jni -d include
  69. LIBS=-L . -L $(LIBDIR) -LC:/tmp/rxtx5/build -luser32 -lgdi32 -lcomdlg32 -lkernel32 -ladvapi32 -lmoldname -lcrtdll
  70. # -lmex
  71. # path to the java native interface headers (directory with jni.h)
  72. JDKINCLUDE=$(JDKHOME)/include
  73. MINGINCLUDE=$(MINGHOME)/include
  74. JAVAFILES = $(wildcard $(SRC)/*.java)
  75. CFILES=$(wildcard $(SRC)/*.c) $(wildcard $(SRC)/*.cc)
  76. TARGETLIBS= rxtxSerial.dll rxtxParallel.dll
  77. #TARGETLIBS= rxtxSerial.dll rxtxParallel.dll rxtxZystem.dll
  78. DLLOBJECTS= fixup.o SerialImp.o termios.o init.o fuserImp.o
  79. PARALLELOBJECTS= ParallelImp.o termios.o init.o
  80. all: $(TARGETLIBS) # rebuild rebuild will force everything to be built.
  81. rebuild:
  82. rm -rf gnu include RXTXcomm.jar Serial.* rxtxSerial.* * *.O.o *.O gnutimestamp
  83. include:
  84. mkdir include
  85. gnu:
  86. mkdir gnu
  87. mkdir gnu\\\io
  88. # yayaya We should have put the files in gnu.io to start with
  89. gnutimestamp: $(JAVAFILES) $(CFILES) include gnu
  90. xcopy /Y $(DOSSRC)\\*.* gnu\\io\\
  91. echo > gnutimestamp
  92. # FIXME make 3.79.1 behaves really strage if we use %.o rules.
  93. init.o:
  94. $(CC) $(CFLAGS) -c $(SRC)/init.cc -o init.o
  95. fixup.o:
  96. $(CC) $(CFLAGS) -c $(SRC)/$*.c -o fixup.o
  97. #ZystemImp.o: include/config.h
  98. # $(CC) $(CFLAGS_CYGWIN) -c $(SRC)/ZystemImp.c -o ZystemImp.o
  99. SerialImp.o: include/config.h
  100. $(CC) $(CFLAGS) -c $(SRC)/SerialImp.c -o SerialImp.o
  101. fuserImp.o:
  102. $(CC) $(CFLAGS) -c $(SRC)/fuserImp.c -o fuserImp.o
  103. termios.o:
  104. $(CC) $(CFLAGS) -c $(SRC)/$*.c -o termios.o
  105. ParallelImp.o: include/config.h
  106. $(CC) $(CFLAGS) -c $(SRC)/$*.c -o ParallelImp.o
  107. # This file is a pain in the rear to generate. If your looking at this you
  108. # need to install cygwin.
  109. #$(SRC)/Zystem.def: $(DLLOBJECTS) ZystemImp.o
  110. #$(LD) --base-file Zystem.base --dll -o rxtxZystem.dll $(DLLOBJECTS) ZystemImp.o _divdi3.o $(LIBS) -lcygwin -e _dll_entry@12
  111. #xcopy /Y $(DOSSRC)\\Zystem.def gnu\\io\\
  112. $(SRC)/Serial.def: $(DLLOBJECTS)
  113. $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) $(LIBS) -lmingw32 -e _dll_entry@12
  114. xcopy /Y $(DOSSRC)\\Serial.def gnu\\io\\
  115. # echo EXPORTS >$(SRC)/Serial.def;for i in `nm rxtxSerial.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Serial.def
  116. $(SRC)/Parallel.def: $(PARALLELOBJECTS)
  117. $(LD) --base-file Parallel.base --dll -o rxtxParallel.dll $(PARALLELOBJECTS) $(LIBS) -lmingw32 -e _dll_entry@12
  118. xcopy $(DOSSRC)\\Parallel.def gnu\\io\\
  119. # echo EXPORTS >$(SRC)/Parallel.def;for i in `nm rxtxParallel.dll | grep "T _Java"|cut -b 13-`;do echo -n $$i|sed s#@.*##;echo "="$$i;done >> $(SRC)/Parallel.def
  120. rxtxZystem.dll: RXTXcomm.jar $(DLLOBJECTS) #ZystemImp.o $(SRC)/Zystem.def
  121. 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
  122. 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
  123. #rxtxZystem.dll: RXTXcomm.jar $(DLLOBJECTS) ZystemImp.o $(SRC)/Zystem.def
  124. #$(LD) --base-file Zystem.base --dll -o rxtxZystem.dll $(DLLOBJECTS) \
  125. #ZystemImp.o _divdi3.o $(LIBS) -lcygwin -e _dll_entry@12
  126. #$(DLLTOOL) --as=$(AS) --dllname rxtxZystem.dll --def $(SRC)/Zystem.def \
  127. #--base-file Zystem.base --output-exp Zystem.exp
  128. #$(LD) --base-file Zystem.base Zystem.exp -dll -o rxtxZystem.dll \
  129. #$(DLLOBJECTS) ZystemImp.o _divdi3.o $(LIBS) -lcygwin -e _dll_entry@12
  130. #$(DLLTOOL) --as=$(AS) --dllname rxtxZystem.dll --def $(SRC)/Zystem.def \
  131. #--base-file Zystem.base --output-exp Zystem.exp
  132. #$(LD) --base-file Zystem.base Zystem.exp -dll -o rxtxZystem.dll \
  133. #$(DLLOBJECTS) ZystemImp.o _divdi3.o $(LIBS) -lcygwin -e _dll_entry@12
  134. rxtxSerial.dll: RXTXcomm.jar $(DLLOBJECTS) $(SRC)/Serial.def
  135. $(LD) --base-file Serial.base --dll -o rxtxSerial.dll $(DLLOBJECTS) \
  136. $(LIBS) -lmingw32 -e _dll_entry@12
  137. $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \
  138. --base-file Serial.base --output-exp Serial.exp
  139. $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \
  140. $(DLLOBJECTS) $(LIBS) -lmingw32 -e _dll_entry@12
  141. $(DLLTOOL) --as=$(AS) --dllname rxtxSerial.dll --def $(SRC)/Serial.def \
  142. --base-file Serial.base --output-exp Serial.exp
  143. $(LD) --base-file Serial.base Serial.exp -dll -o rxtxSerial.dll \
  144. $(DLLOBJECTS) $(LIBS) -lmingw32 -e _dll_entry@12
  145. #
  146. # This should replace the mess above if it worked.
  147. # nm shows no symbols in the dll produced. The old stuff above works ok.
  148. # $(DLLWRAP) --output-def $*.def --output-exp $*.exp \
  149. # --add-stdcall-alias --driver-name gcc -mwindows \
  150. # --target=i386-mingw32 -o $*.dll $(DLLOBJECTS) $(LIBS) -s
  151. # -mno-cygwin
  152. rxtxParallel.dll: $(PARALLELOBJECTS)
  153. $(LD) --base-file Parallel.base --dll -o rxtxParallel.dll $(PARALLELOBJECTS) \
  154. $(LIBS) -lmingw32 -e _dll_entry@12
  155. $(DLLTOOL) --as=$(AS) --dllname rxtxParallel.dll --def $(SRC)/Parallel.def \
  156. --base-file Parallel.base --output-exp Parallel.exp
  157. $(LD) --base-file Parallel.base Parallel.exp -dll -o rxtxParallel.dll \
  158. $(PARALLELOBJECTS) $(LIBS) -lmingw32 -e _dll_entry@12
  159. $(DLLTOOL) --as=$(AS) --dllname rxtxParallel.dll --def $(SRC)/Parallel.def \
  160. --base-file Parallel.base --output-exp Parallel.exp
  161. $(LD) --base-file Parallel.base Parallel.exp -dll -o rxtxParallel.dll \
  162. $(PARALLELOBJECTS) $(LIBS) -lmingw32 -e _dll_entry@12
  163. RXTXcomm.jar: gnutimestamp
  164. $(JAVAC) gnu\\io\\*.java
  165. $(JAR) -cf RXTXcomm.jar gnu\\io\\*.class
  166. $(JAVAH) $(JAVAHFLAGS) $(patsubst gnu/io/%.java,gnu.io.%,$(wildcard gnu/io/*.java))
  167. include/config.h: gnutimestamp
  168. echo "#define HAVE_FCNTL_H 1" > include\\\config.h
  169. echo "#define HAVE_SIGNAL_H 1" >> include\\\config.h
  170. echo "#define HAVE_SYS_FCNTL_H 1" >> include\\\config.h
  171. echo "#define HAVE_SYS_FILE_H 1" >> include\\\config.h
  172. echo "#undef HAVE_SYS_SIGNAL_H" >> include\\\config.h
  173. echo "#undef HAVE_TERMIOS_H" >> include\\\config.h
  174. install: all
  175. xcopy RXTXcomm.jar $(COMMINSTALL)
  176. xcopy RXTXcomm.jar "e:\matlab~1\java\jarext\commapi\win32"
  177. xcopy $(TARGETLIBS) $(LIBINSTALL)
  178. xcopy $(TARGETLIBS) "e:\matlab~1\bin\win32"
  179. uninstall:
  180. del $(COMMINSTALL)\\\RXTXcomm.jar
  181. del $(LIBINSTALL)\\\$(TARGETLIBS)
  182. clean:
  183. deltree gnu\\\io\\\*.*
  184. deltree include
  185. del Serial.* gnutimestamp *.o *.O RXTXcomm.jar rxtxSerial.*