-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
118 lines (85 loc) · 3.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Set this variable if you need to.
WINDOWS_JDK_PATH := C:\\Program\ Files\\Java\\jdk1.6.0_02\\
LINUX_JDK_PATH := /usr/lib/j2se/1.4/
linux := false
macosx := false
cygwin := false
uname_s := $(shell uname -s)
ifeq ($(strip $(uname_s)),Darwin)
macosx := true
else
uname_o := $(shell uname -o)
endif
ifeq ($(strip $(uname_s)),Linux)
linux := true
endif
ifeq ($(strip $(uname_o)),Cygwin)
cygwin := true
endif
CFLAGS += -O0 -Wall -g -c
CFLAGS += -I.
#CFLAGS += -ISDL-1.2.8/include
#LDFLAGS += -LSDL-1.2.8/lib -lSDL -lSDLmain
CC := gcc
LD := gcc
ifeq ($(strip $(macosx)),true)
LDFLAGS += -framework Carbon -framework IOKit
JAVAC := javac
MANYMOUSEJNILIB := libManyMouse.jnilib
JNICFLAGS += -I/System/Library/Frameworks/JavaVM.framework/Headers
JNILDFLAGS += -bundle -framework JavaVM
endif
ifeq ($(strip $(linux)),true)
CFLAGS += -fPIC -I/usr/src/linux/include
LDFLAGS += -ldl
JDKPATH := $(LINUX_JDK_PATH)
JAVAC := $(JDKPATH)bin/javac
MANYMOUSEJNILIB := libManyMouse.so
JNICFLAGS += -I$(JDKPATH)include -I$(JDKPATH)include/linux
JNILDFLAGS += -shared -Wl,-soname,$(MANYMOUSEJNILIB)
endif
ifeq ($(strip $(cygwin)),true)
JDKPATH := $(WINDOWS_JDK_PATH)
JAVAC := $(JDKPATH)bin\\javac
MANYMOUSEJNILIB := ManyMouse.dll
JNICFLAGS += -I$(JDKPATH)include -I$(JDKPATH)include\\win32
JNILDFLAGS += -Wl,--add-stdcall-alias -shared
endif
BASEOBJS := linux_evdev.o macosx_hidutilities.o macosx_hidmanager.o windows_wminput.o x11_xinput2.o manymouse.o
.PHONY: clean all
all: detect_mice test_manymouse_stdio test_manymouse_sdl mmpong manymousepong
clean:
rm -rf *.o *.obj *.exe *.class $(MANYMOUSEJNILIB) example/*.o example/*.obj test_manymouse_stdio test_manymouse_sdl detect_mice mmpong manymousepong
%.o : %c
$(CC) $(CFLAGS) -o $@ $<
example/test_manymouse_sdl.o : example/test_manymouse_sdl.c
$(CC) $(CFLAGS) -o $@ $< `sdl-config --cflags`
example/mmpong.o : example/mmpong.c
$(CC) $(CFLAGS) -o $@ $< `sdl-config --cflags`
example/manymousepong.o : example/manymousepong.c
$(CC) $(CFLAGS) -o $@ $< `sdl-config --cflags`
detect_mice: $(BASEOBJS) example/detect_mice.o
$(LD) -o $@ $+ $(LDFLAGS)
test_manymouse_stdio: $(BASEOBJS) example/test_manymouse_stdio.o
$(LD) -o $@ $+ $(LDFLAGS)
test_manymouse_sdl: $(BASEOBJS) example/test_manymouse_sdl.o
$(LD) -o $@ $+ `sdl-config --libs` $(LDFLAGS)
mmpong: $(BASEOBJS) example/mmpong.o
$(LD) -o $@ $+ `sdl-config --libs` $(LDFLAGS)
manymousepong: $(BASEOBJS) example/manymousepong.o
$(LD) -o $@ $+ `sdl-config --libs` $(LDFLAGS)
# Java support ...
.PHONY: java
java: $(MANYMOUSEJNILIB) ManyMouse.class ManyMouseEvent.class TestManyMouse.class
ManyMouse.class: contrib/java/ManyMouse.java $(MANYMOUSEJNILIB)
$(JAVAC) -d . -classpath contrib/java $<
ManyMouseEvent.class: contrib/java/ManyMouseEvent.java ManyMouse.class
$(JAVAC) -d . -classpath contrib/java $<
TestManyMouse.class: contrib/java/TestManyMouse.java ManyMouse.class ManyMouseEvent.class
$(JAVAC) -d . $<
ManyMouseJava.o: contrib/java/ManyMouseJava.c
$(CC) $(CFLAGS) -o $@ $< $(JNICFLAGS)
$(MANYMOUSEJNILIB): $(BASEOBJS) ManyMouseJava.o
@mkdir -p $(dir $@)
$(LD) $(LDFLAGS) -o $@ $^ $(JNILDFLAGS)
# end of Makefile ...