File: Makefile.javaplugin

package info (click to toggle)
munin 2.999.14-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 10,036 kB
  • sloc: perl: 31,052; sh: 12,473; java: 1,924; python: 852; makefile: 336; ruby: 232; awk: 169; xml: 45; sql: 11
file content (47 lines) | stat: -rw-r--r-- 1,394 bytes parent folder | download
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