Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Mostly automated "make java" for Cygwin users.
  • Loading branch information
icculus committed Jul 28, 2007
1 parent 70369ff commit bb8529a
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 7 deletions.
43 changes: 37 additions & 6 deletions Makefile
@@ -1,14 +1,21 @@
# Set this variable if you need to.
WINDOWS_JDK_PATH := C:\\Program\ Files\\Java\\jdk1.6.0_02\\

linux := false
macosx := false
cygwin := false

os := $(shell uname -s)
ifeq ($(strip $(os)),Darwin)
uname_s := $(shell uname -s)
uname_o := $(shell uname -o)
ifeq ($(strip $(uname_s)),Darwin)
macosx := true
endif
ifeq ($(strip $(os)),Linux)
ifeq ($(strip $(uname_s)),Linux)
linux := true
endif
ifeq ($(strip $(uname_o)),Cygwin)
cygwin := true
endif

CFLAGS += -O0 -Wall -g -c
CFLAGS += -I.
Expand All @@ -26,10 +33,22 @@ else
LDFLAGS += -ldl
endif

JAVAC := javac

ifeq ($(strip $(linux)),true)
CFLAGS += -I/usr/src/linux/include
endif

ifeq ($(strip $(cygwin)),true)
CFLAGS += -mno-cygwin
LDFLAGS += -mno-cygwin
MANYMOUSEJNILIB := ManyMouse.dll
JDKPATH := $(WINDOWS_JDK_PATH)
JAVAC := $(JDKPATH)bin\\javac
endif



BASEOBJS := linux_evdev.o macosx_hidmanager.o windows_wminput.o x11_xinput.o manymouse.o

.PHONY: clean all
Expand Down Expand Up @@ -73,13 +92,13 @@ manymousepong: $(BASEOBJS) example/manymousepong.o
java: $(MANYMOUSEJNILIB) ManyMouse.class ManyMouseEvent.class TestManyMouse.class

ManyMouse.class: contrib/java/ManyMouse.java $(MANYMOUSEJNILIB)
javac -d . -classpath contrib/java $<
$(JAVAC) -d . -classpath contrib/java $<

ManyMouseEvent.class: contrib/java/ManyMouseEvent.java ManyMouse.class
javac -d . -classpath contrib/java $<
$(JAVAC) -d . -classpath contrib/java $<

TestManyMouse.class: contrib/java/TestManyMouse.java ManyMouse.class ManyMouseEvent.class
javac -d . $<
$(JAVAC) -d . $<


ifeq ($(strip $(macosx)),true)
Expand All @@ -92,5 +111,17 @@ $(MANYMOUSEJNILIB): $(BASEOBJS) ManyMouseJava.o

endif


ifeq ($(strip $(cygwin)),true)
ManyMouseJava.o: contrib/java/ManyMouseJava.c
$(CC) $(CFLAGS) -o $@ $< -I$(JDKPATH)include -I$(JDKPATH)include\\win32

$(MANYMOUSEJNILIB): $(BASEOBJS) ManyMouseJava.o
@mkdir -p $(dir $@)
$(LD) $(LDFLAGS) -o $@ $^ -Wl,--add-stdcall-alias -shared

endif


# end of Makefile ...

7 changes: 6 additions & 1 deletion README
Expand Up @@ -67,8 +67,13 @@ Java bindings:

Thanks to Brian Ballsun-Stanton for kicking this into gear.

Mac OS X and Cygwin can run "make java" to build the bindings and run
"java TestManyMouse" to make sure they worked. Cygwin users may need to
adjust the WINDOWS_JDK_PATH line at the top of the Makefile to match their
JDK installation.

Some notes:

Some general ManyMouse usage notes:
- If a mouse is disconnected, it will not return future events, even if you
plug it right back in. You will be alerted of disconnects programmatically
through the MANYMOUSE_EVENT_DISCONNECT event, which will be the last
Expand Down

0 comments on commit bb8529a

Please sign in to comment.