# Unix GNU makefile for Optimizer nonlinear examples
# Will build all Java library examples if no target is specified

# The following variables control behavior and must be set (for example
# on the command line or as an environment variable)
#   XPRESSDIR  The root of the Xpress installation

# Usage: make [all]       Compiles all examples
#        make NAME.class  Compiles NAME.java
#        make NAME.run    Runs example NAME
#        make all.run     Compile and run all examples.

.PHONY: all clean all.run

# Disable suffix rules
.SUFFIXES:
all: $(patsubst %.java,%.class,$(wildcard *.java))

# Set XPRESSDIR to the root of your xpressmp installation

%.class: %.java
	javac $(JAVAFLAGS) -classpath "$(XPRESSDIR)/lib/xprs.jar:." $*.java

clean:
	rm -f *.class

%.run: %.class
	java -classpath "$(XPRESSDIR)/lib/xprs.jar:." -Djava.library.path="$(XPRESSDIR)/lib" $*

all.run: $(patsubst %.java,%.run,$(wildcard *.java))