From bb8529a526bc6373b305193c026e14893cd6f7fc Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 28 Jul 2007 05:10:10 +0000 Subject: [PATCH] Mostly automated "make java" for Cygwin users. --- Makefile | 43 +++++++++++++++++++++++++++++++++++++------ README | 7 ++++++- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index c8cc55b..a1497fa 100644 --- a/Makefile +++ b/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. @@ -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 @@ -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) @@ -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 ... diff --git a/README b/README index aa5d3df..8c4e1a0 100644 --- a/README +++ b/README @@ -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