Add a Log4j 2.x Java agent
[deliverable/lttng-ust.git] / doc / examples / java-log4j / Makefile
CommitLineData
501f6777
CB
1#
2# Copyright (C) 2014 - Christian Babeux <christian.babeux@efficios.com>
3#
4# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR
5# IMPLIED. ANY USE IS AT YOUR OWN RISK.
6#
7# Permission is hereby granted to use or copy this program for any purpose,
8# provided the above notices are retained on all copies. Permission to modify
9# the code and to distribute modified code is granted, provided the above
10# notices are retained, and a notice that the code was modified is included
11# with the above copyright notice.
12#
13# This Makefile is not using automake so that users may see how to build a
14# program with tracepoint provider probes as stand-alone shared objects.
15#
16# This makefile is purposefully kept simple to support GNU and BSD make.
17#
18
8e57e02f
AM
19# Required JAR files for Log4j
20JARFILE_LOG4J=lttng-ust-agent-log4j.jar
21JARFILE_COMMON=lttng-ust-agent-common.jar
4c7e1bd5
MJ
22
23# If system classpath is empty, try to guess log4j location
24ifeq "$(CLASSPATH)" ""
a1f17360 25 CLASSPATH=/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar
4c7e1bd5 26endif
501f6777 27
8e57e02f
AM
28# Check if the top level makefile overrides the Log4j Jar file's path.
29ifeq "$(JAVA_CLASSPATH_OVERRIDE_LOG4J)" ""
72e6e036 30 LOG4J_CP = /usr/local/share/java/$(JARFILE_LOG4J):/usr/share/java/$(JARFILE_LOG4J)
8e57e02f 31else
72e6e036 32 LOG4J_CP = $(JAVA_CLASSPATH_OVERRIDE_LOG4J)/$(JARFILE_LOG4J)
501f6777
CB
33endif
34
8e57e02f
AM
35# Check if the top level makefile overrides the Common Jar file's path.
36ifeq "$(JAVA_CLASSPATH_OVERRIDE_COMMON)" ""
72e6e036 37 COMMON_CP = /usr/local/share/java/$(JARFILE_COMMON):/usr/share/java/$(JARFILE_COMMON)
501f6777 38else
72e6e036 39 COMMON_CP = $(JAVA_CLASSPATH_OVERRIDE_COMMON)/$(JARFILE_COMMON)
501f6777
CB
40endif
41
8e57e02f 42JFLAGS = -g
72e6e036 43JC = javac -classpath "$(CLASSPATH):$(LOG4J_CP):$(COMMON_CP):."
501f6777
CB
44.SUFFIXES: .java .class
45.java.class:
46 $(JC) $(JFLAGS) $*.java
47
6e8e8cb8 48CLASSES = HelloLog4j.java
501f6777
CB
49
50all: classes
51
52classes: $(CLASSES:.java=.class)
53
54.PHONY: clean
55clean:
6e8e8cb8 56 $(RM) $(CLASSES:.java=.class)
This page took 0.040075 seconds and 5 git commands to generate.