-
Notifications
You must be signed in to change notification settings - Fork 474
/
Makefile.javaplugin
47 lines (34 loc) · 1.36 KB
/
Makefile.javaplugin
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
#
# Makefile fragment to build and install the java plugin
######################################################################
# Java
ifeq ($(JCVALID),yes)
JAVA_BUILD=build-plugins-java
JAVA_INSTALL=install-plugins-java
JAVA_PLUGINS=plugins/node.d.java/*
endif
BUILD_DIR ?= build
JAVA_SRCDIR := plugins/javalib
JAVA_DSTDIR := $(BUILD_DIR)/plugins/javalib
JAVA_FILES := $(wildcard plugins/javalib/org/munin/plugin/jmx/*.java)
JAVA_CLASSES := $(patsubst %.java,%.class,$(JAVA_FILES))
JC := javac
JFLAGS = -g -sourcepath $(JAVA_SRCDIR) -d $(JAVA_DSTDIR)
INSTALL ?= install
.PHONY: build-plugins-java
build-plugins-java: $(JAVA_DSTDIR)/munin-jmx-plugins.jar
$(JAVA_DSTDIR)/munin-jmx-plugins.jar: $(JAVA_DSTDIR)/org/munin/plugin/jmx
jar cf $@ -C $(JAVA_DSTDIR) org/munin/plugin/jmx
$(JAVA_DSTDIR)/org/munin/plugin/jmx: $(JAVA_FILES)
mkdir -p $(JAVA_DSTDIR)
$(JC) $(JFLAGS) $^
install-plugins-java: $(JAVA_DSTDIR)/munin-jmx-plugins.jar
mkdir -p $(JAVALIBDIR)
$(INSTALL) -m 0644 $(JAVA_DSTDIR)/munin-jmx-plugins.jar $(JAVALIBDIR)/
mkdir -p $(LIBDIR)/plugins
for p in $(BUILD_DIR)/plugins/node.d.java/*; do \
if test -f "$$p" ; then \
echo Installing $$p; \
$(INSTALL) -m 0755 $$p $(LIBDIR)/plugins/; \
fi \
done