summaryrefslogtreecommitdiff
path: root/ao-tools/libaltos/Makefile
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2010-08-17 18:19:43 -0700
committerKeith Packard <keithp@keithp.com>2010-08-17 18:19:43 -0700
commitd14c96663a1027164fa30ed89b53f5a9d3fdb82b (patch)
tree65c0d7ba56fa0fd1b42cc70892e6fb3f81954627 /ao-tools/libaltos/Makefile
parent294d9c7db21eaf1e71504dbcca5040371abcce55 (diff)
libaltos: integrate Windows support.
This adds Windows support for discovery and I/O. The API to the library is mostly unchanged, except that it now exports product and vendor USB IDs as Win7 doesn't expose the product name anywhere that we've been able to find, so we'll be updating the firmware to use unique idProduct values for each product. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/libaltos/Makefile')
-rw-r--r--ao-tools/libaltos/Makefile53
1 files changed, 43 insertions, 10 deletions
diff --git a/ao-tools/libaltos/Makefile b/ao-tools/libaltos/Makefile
index fa5127eb..a251e54e 100644
--- a/ao-tools/libaltos/Makefile
+++ b/ao-tools/libaltos/Makefile
@@ -1,27 +1,56 @@
OS:=$(shell uname)
+#
+# Linux
+#
ifeq ($(OS),Linux)
JAVA_CFLAGS=-I/usr/lib/jvm/java-6-openjdk/include
OS_CFLAGS=-DLINUX -DPOSIX_TTY $(JAVA_CFLAGS)
-LIBEXT=so
+OS_LDFLAGS=
+
+LIBNAME=libaltos.so
+EXEEXT=
endif
+#
+# Darwin (Mac OS X)
+#
ifeq ($(OS),Darwin)
-DARWIN_CFLAGS=\
+OS_CFLAGS=\
+ -DDARWIN -DPOSIX_TTY -arch i386 -arch x86_64 \
--sysroot=/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 \
-iwithsysroot /System/Library/Frameworks/JavaVM.framework/Headers \
-iwithsysroot /System/Library/Frameworks/IOKit.framework/Headers \
-iwithsysroot /System/Library/Frameworks/CoreFoundation.framework/Headers
-DARWIN_LIBS=\
+
+OS_LDFLAGS =\
-framework IOKit -framework CoreFoundation
-OS_CFLAGS = $(DARWIN_CFLAGS) -DDARWIN -DPOSIX_TTY -arch i386 -arch x86_64
-LIBEXT=dylib
+LIBNAME=libaltos.dylib
+EXEEXT=
+
+endif
+
+#
+# Windows
+#
+ifneq (,$(findstring MINGW,$(OS)))
+
+CC=gcc
+
+OS_CFLAGS = -DWINDOWS -mconsole
+
+OS_LDFLAGS = -lgdi32 -luser32 -lcfgmgr32 -lsetupapi -lole32 \
+ -ladvapi32 -lcomctl32 -mconsole -Wl,--add-stdcall-alias
+
+LIBNAME=altos.dll
+
+EXEEXT=.exe
endif
@@ -48,26 +77,30 @@ CLASSFILES = $(JAVAFILES:%.java=%.class)
JAVAFLAGS=-Xlint:unchecked
-all: libaltos.$(LIBEXT) cjnitest $(CLASSFILES)
+CJNITEST=cjnitest$(EXEEXT)
+
+all: $(LIBNAME) $(CJNITEST) $(CLASSFILES)
.java.class:
javac -encoding UTF8 -classpath "$(CLASSPATH)" $(JAVAFLAGS) $*.java
CFLAGS=$(OS_CFLAGS) -O0 -g -I.
+LDFLAGS=$(OS_LDFLAGS)
+
HEADERS=libaltos.h
SRCS = libaltos.c $(SWIG_WRAP)
OBJS = $(SRCS:%.c=%.o)
LIBS = $(DARWIN_LIBS)
-cjnitest: cjnitest.o $(OBJS)
+$(CJNITEST): cjnitest.o $(OBJS)
cc -o $@ $(CFLAGS) cjnitest.o $(OBJS) $(LIBS)
-libaltos.$(LIBEXT): $(OBJS)
- gcc -shared $(CFLAGS) -o $@ $(OBJS) $(LIBS)
+$(LIBNAME): $(OBJS)
+ gcc -shared $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
clean:
- rm -f $(CLASSFILES) $(OBJS) libaltos.$(LIBEXT) cjnitest cjnitest.o
+ rm -f $(CLASSFILES) $(OBJS) $(LIBNAME) $(CJNITEST) cjnitest.o
rm -rf swig_bindings libaltosJNI
$(JNI_FILE): libaltos.i0 $(HEADERS)