8 JAVA_CFLAGS=-I/usr/lib/jvm/java-6-openjdk/include
10 OS_CFLAGS=-DLINUX -DPOSIX_TTY $(JAVA_CFLAGS)
18 /usr/bin/install -c $(LIBNAME) $(DESTDIR)/usr/lib/altos/$(LIBNAME)
28 -DDARWIN -DPOSIX_TTY -arch i386 -arch x86_64 \
29 --sysroot=/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 \
30 -iwithsysroot /System/Library/Frameworks/JavaVM.framework/Headers \
31 -iwithsysroot /System/Library/Frameworks/IOKit.framework/Headers \
32 -iwithsysroot /System/Library/Frameworks/CoreFoundation.framework/Headers
35 -framework IOKit -framework CoreFoundation
37 LIBNAME=libaltos.dylib
45 ifneq (,$(findstring MINGW,$(OS)))
49 OS_CFLAGS = -DWINDOWS -mconsole
51 OS_LDFLAGS = -lgdi32 -luser32 -lcfgmgr32 -lsetupapi -lole32 \
52 -ladvapi32 -lcomctl32 -mconsole -Wl,--add-stdcall-alias
60 .SUFFIXES: .java .class
62 CLASSPATH=".:jnitest/*:libaltosJNI:/usr/share/java/*"
64 SWIG_DIR=swig_bindings/java
65 SWIG_FILE=$(SWIG_DIR)/libaltos.swig
66 SWIG_WRAP=$(SWIG_DIR)/libaltos_wrap.c
69 JNI_FILE=$(JNI_DIR)/libaltosJNI.java
70 JNI_SRCS=$(JNI_FILE) \
71 $(JNI_DIR)/SWIGTYPE_p_altos_file.java \
72 $(JNI_DIR)/SWIGTYPE_p_altos_list.java \
73 $(JNI_DIR)/altos_device.java \
74 $(JNI_DIR)/libaltos.java
79 CLASSFILES = $(JAVAFILES:%.java=%.class)
81 JAVAFLAGS=-Xlint:unchecked
83 CJNITEST=cjnitest$(EXEEXT)
85 all: $(LIBNAME) $(CJNITEST) $(CLASSFILES)
88 javac -encoding UTF8 -classpath "$(CLASSPATH)" $(JAVAFLAGS) $*.java
90 CFLAGS=$(OS_CFLAGS) -O0 -g -I.
95 SRCS = libaltos.c $(SWIG_WRAP)
96 OBJS = $(SRCS:%.c=%.o)
99 $(CJNITEST): cjnitest.o $(OBJS)
100 cc -o $@ $(CFLAGS) cjnitest.o $(OBJS) $(LIBS)
103 gcc -shared $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
106 rm -f $(CLASSFILES) $(OBJS) $(LIBNAME) $(CJNITEST) cjnitest.o
107 rm -rf swig_bindings libaltosJNI
109 $(JNI_FILE): libaltos.i0 $(HEADERS)
112 sed 's;//%;%;' libaltos.i0 $(HEADERS) > $(SWIG_FILE)
113 swig -java -package libaltosJNI $(SWIG_FILE)
114 cp swig_bindings/java/*.java libaltosJNI
116 $(SWIG_WRAP): $(JNI_FILE)