]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tools/tinyos/java/serial/Makefile.am
Merge TinyOS 2.1.1 into master.
[tinyos-2.x.git] / tools / tinyos / java / serial / Makefile.am
index 2db55771746e7f0b1bb1db97071ad182678e325b..5b63d8b73c30972560ceeb2913d7ea5198ee49ce 100644 (file)
@@ -6,21 +6,41 @@ tinyoslibdir=$(libdir)/tinyos
 
 tinyoslib_PROGRAMS = @TOSCOMMLIB@
 
-EXTRA_PROGRAMS = libtoscomm.so toscomm.dll
+EXTRA_PROGRAMS = libtoscomm-32.so libtoscomm-64.so toscomm.dll libtoscomm.jnilib
 
-libtoscomm_so_SOURCES = \
+# Compiling libtoscomm.so with -O2 generates bad code with gcc 4.1.x on x86_64
+# (the -O1 code is slightly weird, but works at least ;-))
+SOFLAGS = -O1 -shared -fPIC "-I$(JDK)/include" "-I$(JDK)/include/linux"
+
+libtoscomm_32_so_SOURCES = \
   NativeSerialEnums.h \
   NativeSerial_linux.cpp \
   TOSComm_wrap.cxx
 
+libtoscomm_64_so_SOURCES = $(libtoscomm_32_so_SOURCES)
+
 toscomm_dll_SOURCES = \
   NativeSerialEnums.h \
   NativeSerial_win32.cpp \
   TOSComm_wrap.cxx
 
-libtoscomm.so: $(libtoscomm_so_SOURCES)
-       $(CXX) -m32 -O2 -shared -fPIC "-I$(JDK)/include" "-I$(JDK)/include/linux" \
-         -o $@ NativeSerial_linux.cpp
+libtoscomm_jnilib_SOURCES = \
+  NativeSerialEnums.h \
+  NativeSerial_darwin.cpp \
+  TOSComm_wrap.cxx
+
+libtoscomm.jnilib:  $(libtoscomm_jnilib_SOURCES)
+       $(CXX) -O2 -bundle "-I$(JDK)/Headers" \
+        -o $@ NativeSerial_darwin.cpp
+
+libtoscomm-32.so: $(libtoscomm_so_SOURCES)
+       $(CXX) -m32 $(SOFLAGS) -o $@ NativeSerial_linux.cpp || \
+       (echo 32-bit libtoscomm.so NOT GENERATED - DO NOT USE THIS RUN TO BUILD AN RPM; echo Press return to continue; read; rm -f $@)
+
+libtoscomm-64.so: $(libtoscomm_so_SOURCES)
+       @echo $(CXX) -m64 $(SOFLAGS) -o $@ NativeSerial_linux.cpp
+       @$(CXX) -m64 $(SOFLAGS) -o $@ NativeSerial_linux.cpp || \
+       (echo 64-bit libtoscomm.so NOT GENERATED - DO NOT USE THIS RUN TO BUILD AN RPM; echo Press return to continue; read; rm -f $@)
 
 toscomm.dll: $(toscomm_dll_SOURCES)
        $(CXX) -O2 -s -mno-cygwin -shared "-I$(JDK)/include" "-I$(JDK)/include/win32" -D_JNI_IMPLEMENTATION -Wl,--kill-at \