# This is a general-purpose makefile for building java code that links to # opencv libraries using javacv. # # Most configuration variables are set with ?= to allow environment variables # to override them. # # Basic usage: # # make CvDemo.class # `make -s java-cmd` CvDemo ARGS # # where ARGS are the command line arguments (if any) that you want to pass to # CvDemo. JAVA ?= java JAVAC ?= javac # directory containing javacv jars JCV_DIR ?= . ifneq ($(patsubst MINGW%,MINGW,$(shell uname)),MINGW) CLASSPATH ?= $(JCV_DIR)/javacpp.jar:$(JCV_DIR)/javacv.jar:. else CLASSPATH ?= $(JCV_DIR)\javacpp.jar;$(JCV_DIR)\javacv.jar;. endif %.class: %.java $(JAVAC) -classpath $(CLASSPATH) $< %.run: %.class $(JAVA) -classpath $(CLASSPATH) $(basename $@) # Build a java runtime command that still passes arguments to the java program # like this: # # `make -s java-cmd` CvDemo args java-cmd: echo "$(JAVA) -classpath $(CLASSPATH)" clean: $(RM) *.class