aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile29
-rw-r--r--src/libgamma_AdjustmentMethod.c26
-rw-r--r--src/libgamma_CRTC.c37
-rw-r--r--src/libgamma_GammaRamps.c33
-rw-r--r--src/libgamma_LibgammaException.c26
-rw-r--r--src/libgamma_Partition.c24
-rw-r--r--src/libgamma_Ramp.c33
-rw-r--r--src/libgamma_Site.c24
8 files changed, 228 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index c8c4397..b6eb10a 100644
--- a/Makefile
+++ b/Makefile
@@ -52,7 +52,7 @@ endif
# Platform dependent flags
ifeq ($(PLATFORM),w32)
SHARED = -mdll
-LDSO = -Wl,-soname,jlibgamma.$(SO).$(LIB_MAJOR)
+LDSO = -Wl,-soname,libgamma-java.$(SO).$(LIB_MAJOR)
PIC =
else
ifeq ($(PLATFORM),osx)
@@ -61,7 +61,7 @@ LDSO =
PIC = -fPIC
else
SHARED = -shared
-LDSO = -Wl,-soname,jlibgamma.$(SO).$(LIB_MAJOR)
+LDSO = -Wl,-soname,libgamma-java.$(SO).$(LIB_MAJOR)
PIC = -fPIC
endif
endif
@@ -82,7 +82,10 @@ JAVA_WARN = -Xlint:all
# Addition flags to use when compiling C code with JNI support
-JNI_FLAGS=-I$(JAVA_HOME)/include
+CC_JNI_FLAGS = -I$(JAVA_HOME)/include
+
+# Addition flags to use when linking natvie objets with JNI support
+LD_JNI_FLAGS =
# Flags to use when compiling C code
CC_FLAGS = -std=$(STD) $(C_OPTIMISE) $(CFLAGS) $(PIC) $(CPPFLAGS) $(WARN)
@@ -108,7 +111,10 @@ JAVA_H = AdjustmentMethod CRTC GammaRamps LibgammaException Partition Ramp Site
all: lib
.PHONY: lib
-lib: jar headers
+lib: jar so
+
+.PHONY: so
+so: bin/libgamma-java.$(SO).$(LIB_VERSION) bin/libgamma-java.$(SO).$(LIB_MAJOR) bin/libgamma-java.$(SO)
.PHONY: jar
jar: bin/jlibgamma.jar
@@ -133,6 +139,21 @@ obj/libgamma_%.h: obj/libgamma/%.class
$(JAVAH) -classpath obj -jni -d obj \
$$(echo "$<" | sed -e 's:^obj/::' -e 's:.class$$::' | sed -e 's:/:.:g')
+obj/libgamma_%.o: src/libgamma_%.c obj/libgamma_%.h
+ $(CC) $(CC_FLAGS) $(CC_JNI_FLAGS) -iquote"obj" -c -o $@ $<
+
+bin/libgamma-java.$(SO).$(LIB_VERSION): $(foreach O,$(JAVA_H),obj/libgamma_$(O).o)
+ @mkdir -p bin
+ $(CC) $(LD_FLAGS) $(LD_JNI_FLAGS) $(SHARED) $(LDSO) -o $@ $<
+
+bin/libgamma-java.$(SO).$(LIB_MAJOR):
+ @mkdir -p bin
+ ln -sf libgamma-java.$(SO).$(LIB_VERSION) $@
+
+bin/libgamma-java.$(SO):
+ @mkdir -p bin
+ ln -sf libgamma-java.$(SO).$(LIB_VERSION) $@
+
.PHONY: clean
clean:
diff --git a/src/libgamma_AdjustmentMethod.c b/src/libgamma_AdjustmentMethod.c
new file mode 100644
index 0000000..dc247a9
--- /dev/null
+++ b/src/libgamma_AdjustmentMethod.c
@@ -0,0 +1,26 @@
+/**
+ * jlibgamma -- Display server abstraction layer for gamma ramp and Java
+ * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "libgamma_AdjustmentMethod.h"
+
+
+jintArray Java_libgamma_AdjustmentMethod_libgamma_1list_1methods(JNIEnv *, jclass, jint);
+jint Java_libgamma_AdjustmentMethod_libgamma_1is_1method_1available(JNIEnv *, jclass, jint);
+jlong Java_libgamma_AdjustmentMethod_libgamma_1method_1capabilities(JNIEnv *, jclass, jint);
+jstring Java_libgamma_AdjustmentMethod_libgamma_1method_1default_1site(JNIEnv *, jclass, jint);
+jstring Java_libgamma_AdjustmentMethod_libgamma_1method_1default_1site_1variable(JNIEnv *, jclass, jint);
+
diff --git a/src/libgamma_CRTC.c b/src/libgamma_CRTC.c
new file mode 100644
index 0000000..1abf189
--- /dev/null
+++ b/src/libgamma_CRTC.c
@@ -0,0 +1,37 @@
+/**
+ * jlibgamma -- Display server abstraction layer for gamma ramp and Java
+ * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "libgamma_CRTC.h"
+
+
+jlongArray Java_libgamma_CRTC_libgamma_1crtc_1create(JNIEnv *, jclass, jlong, jint);
+void Java_libgamma_CRTC_libgamma_1crtc_1free(JNIEnv *, jclass, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1restore(JNIEnv *, jclass, jlong);
+jobjectArray Java_libgamma_CRTC_libgamma_1get_1crtc_1information(JNIEnv *, jclass, jlong, jint);
+jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps8(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps8(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps16(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps16(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps32(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps32(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1ramps64(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1ramps64(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1rampsf(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1rampsf(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1get_1gamma_1rampsd(JNIEnv *, jclass, jlong, jlong);
+jint Java_libgamma_CRTC_libgamma_1crtc_1set_1gamma_1rampsd(JNIEnv *, jclass, jlong, jlong);
+
diff --git a/src/libgamma_GammaRamps.c b/src/libgamma_GammaRamps.c
new file mode 100644
index 0000000..cae50fa
--- /dev/null
+++ b/src/libgamma_GammaRamps.c
@@ -0,0 +1,33 @@
+/**
+ * jlibgamma -- Display server abstraction layer for gamma ramp and Java
+ * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "libgamma_GammaRamps.h"
+
+
+jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1create(JNIEnv *, jclass, jint, jint, jint);
+jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1create(JNIEnv *, jclass, jint, jint, jint);
+jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1create(JNIEnv *, jclass, jint, jint, jint);
+jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1create(JNIEnv *, jclass, jint, jint, jint);
+jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1create(JNIEnv *, jclass, jint, jint, jint);
+jlongArray Java_libgamma_GammaRamps_libgamma_1gamma_1rampsd_1create(JNIEnv *, jclass, jint, jint, jint);
+void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps8_1free(JNIEnv *, jclass, jlong);
+void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps16_1free(JNIEnv *, jclass, jlong);
+void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps32_1free(JNIEnv *, jclass, jlong);
+void Java_libgamma_GammaRamps_libgamma_1gamma_1ramps64_1free(JNIEnv *, jclass, jlong);
+void Java_libgamma_GammaRamps_libgamma_1gamma_1rampsf_1free(JNIEnv *, jclass, jlong);
+void Java_libgamma_GammaRamps_libgamma_1gamma_1rampsd_1free(JNIEnv *, jclass, jlong);
+
diff --git a/src/libgamma_LibgammaException.c b/src/libgamma_LibgammaException.c
new file mode 100644
index 0000000..a0d6f33
--- /dev/null
+++ b/src/libgamma_LibgammaException.c
@@ -0,0 +1,26 @@
+/**
+ * jlibgamma -- Display server abstraction layer for gamma ramp and Java
+ * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "libgamma_LibgammaException.h"
+
+
+jstring Java_libgamma_LibgammaException_name_1of_1error(JNIEnv *, jclass, jint);
+jint Java_libgamma_LibgammaException_value_1of_1error(JNIEnv *, jclass, jstring);
+jint Java_libgamma_LibgammaException_libgamma_1group_1gid(JNIEnv *, jclass);
+jstring Java_libgamma_LibgammaException_libgamma_1group_1name(JNIEnv *, jclass);
+jstring Java_libgamma_LibgammaException_strerror(JNIEnv *, jclass, jint);
+
diff --git a/src/libgamma_Partition.c b/src/libgamma_Partition.c
new file mode 100644
index 0000000..2228240
--- /dev/null
+++ b/src/libgamma_Partition.c
@@ -0,0 +1,24 @@
+/**
+ * jlibgamma -- Display server abstraction layer for gamma ramp and Java
+ * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "libgamma_Partition.h"
+
+
+jlongArray Java_libgamma_Partition_libgamma_1partition_1create(JNIEnv *, jclass, jlong, jint);
+void Java_libgamma_Partition_libgamma_1partition_1free(JNIEnv *, jclass, jlong);
+jint Java_libgamma_Partition_libgamma_1partition_1restore(JNIEnv *, jclass, jlong);
+
diff --git a/src/libgamma_Ramp.c b/src/libgamma_Ramp.c
new file mode 100644
index 0000000..f81470f
--- /dev/null
+++ b/src/libgamma_Ramp.c
@@ -0,0 +1,33 @@
+/**
+ * jlibgamma -- Display server abstraction layer for gamma ramp and Java
+ * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "libgamma_Ramp.h"
+
+
+jshort Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1get(JNIEnv *, jclass, jlong, jint);
+jint Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1get(JNIEnv *, jclass, jlong, jint);
+jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1get(JNIEnv *, jclass, jlong, jint);
+jlong Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1get(JNIEnv *, jclass, jlong, jint);
+jfloat Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1get(JNIEnv *, jclass, jlong, jint);
+jdouble Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1get(JNIEnv *, jclass, jlong, jint);
+void Java_libgamma_Ramp_libgamma_1gamma_1ramps8_1set(JNIEnv *, jclass, jlong, jint, jshort);
+void Java_libgamma_Ramp_libgamma_1gamma_1ramps16_1set(JNIEnv *, jclass, jlong, jint, jint);
+void Java_libgamma_Ramp_libgamma_1gamma_1ramps32_1set(JNIEnv *, jclass, jlong, jint, jlong);
+void Java_libgamma_Ramp_libgamma_1gamma_1ramps64_1set(JNIEnv *, jclass, jlong, jint, jlong);
+void Java_libgamma_Ramp_libgamma_1gamma_1rampsf_1set(JNIEnv *, jclass, jlong, jint, jfloat);
+void Java_libgamma_Ramp_libgamma_1gamma_1rampsd_1set(JNIEnv *, jclass, jlong, jint, jdouble);
+
diff --git a/src/libgamma_Site.c b/src/libgamma_Site.c
new file mode 100644
index 0000000..da7fdd2
--- /dev/null
+++ b/src/libgamma_Site.c
@@ -0,0 +1,24 @@
+/**
+ * jlibgamma -- Display server abstraction layer for gamma ramp and Java
+ * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#include "libgamma_Site.h"
+
+
+jlongArray Java_libgamma_Site_libgamma_1site_1create(JNIEnv *, jclass, jint, jstring);
+void Java_libgamma_Site_libgamma_1site_1free(JNIEnv *, jclass, jlong);
+jint Java_libgamma_Site_libgamma_1site_1restore(JNIEnv *, jclass, jlong);
+