X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=doc%2Fexamples%2Fjava-log4j%2FMakefile;h=9ef6b7963079c64f88628da0a7906d6e2dfa7c1a;hb=HEAD;hp=e174e3182d91a582c2a03ae5590d55a0737c2cea;hpb=501f6777610d7f8d855453c0083a10912d5fac4b;p=lttng-ust.git diff --git a/doc/examples/java-log4j/Makefile b/doc/examples/java-log4j/Makefile index e174e318..9ef6b796 100644 --- a/doc/examples/java-log4j/Makefile +++ b/doc/examples/java-log4j/Makefile @@ -1,14 +1,6 @@ +# SPDX-License-Identifier: LGPL-2.1-only # -# Copyright (C) 2014 - Christian Babeux -# -# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR -# IMPLIED. ANY USE IS AT YOUR OWN RISK. -# -# Permission is hereby granted to use or copy this program for any purpose, -# provided the above notices are retained on all copies. Permission to modify -# the code and to distribute modified code is granted, provided the above -# notices are retained, and a notice that the code was modified is included -# with the above copyright notice. +# Copyright (C) 2014 Christian Babeux # # This Makefile is not using automake so that users may see how to build a # program with tracepoint provider probes as stand-alone shared objects. @@ -16,30 +8,36 @@ # This makefile is purposefully kept simple to support GNU and BSD make. # -JFLAGS = -g +# Required JAR files for Log4j +JARFILE_LOG4J=lttng-ust-agent-log4j.jar +JARFILE_COMMON=lttng-ust-agent-common.jar -# Default JUL jar name. -JARFILE=liblttng-ust-agent.jar -LOG4J=/usr/share/java/log4j.jar +# If system classpath is empty, try to guess log4j location +ifeq "$(CLASSPATH)" "" + CLASSPATH=/usr/local/share/java/log4j.jar:/usr/share/java/log4j.jar +endif -# Check if the top level makefile overrides the JUL Jar file name. -ifneq "$(JAVA_JARFILE_OVERRIDE)" "" - JARFILE=$(JAVA_JARFILE_OVERRIDE) +# Check if the top level makefile overrides the Log4j Jar file's path. +ifeq "$(JAVA_CLASSPATH_OVERRIDE_LOG4J)" "" + LOG4J_CP = /usr/local/share/java/$(JARFILE_LOG4J):/usr/share/java/$(JARFILE_LOG4J) +else + LOG4J_CP = $(JAVA_CLASSPATH_OVERRIDE_LOG4J)/$(JARFILE_LOG4J) endif -# Check if the top level makefile overrides the JUL classpath. -ifeq "$(JAVA_CLASSPATH_OVERRIDE)" "" - CLASSPATH=/usr/local/share/java/$(JARFILE):/usr/share/java/$(JARFILE):$(LOG4J) +# Check if the top level makefile overrides the Common Jar file's path. +ifeq "$(JAVA_CLASSPATH_OVERRIDE_COMMON)" "" + COMMON_CP = /usr/local/share/java/$(JARFILE_COMMON):/usr/share/java/$(JARFILE_COMMON) else - CLASSPATH=$(JAVA_CLASSPATH_OVERRIDE)/$(JARFILE):$(LOG4J) + COMMON_CP = $(JAVA_CLASSPATH_OVERRIDE_COMMON)/$(JARFILE_COMMON) endif -JC = javac -cp "$(CLASSPATH):." +JFLAGS = -g +JC = javac -classpath "$(CLASSPATH):$(LOG4J_CP):$(COMMON_CP):." .SUFFIXES: .java .class .java.class: $(JC) $(JFLAGS) $*.java -CLASSES = Hello.java +CLASSES = HelloLog4j.java all: classes @@ -47,4 +45,4 @@ classes: $(CLASSES:.java=.class) .PHONY: clean clean: - $(RM) *.class + $(RM) $(CLASSES:.java=.class)