# Calculate lists of filenames and so on and so forth for the project package := com/rle/monitor sources := $(wildcard $(package)/*.java) some_classes := $(patsubst %.java,%.class,$(sources)) all_classes := $(patsubst %.class,%*.class,$(some_classes)) images := $(wildcard images/*.png) class_path := ext/comm.sun.jar target := monitor.jar manifest := monitor.mf # Define the tools we'll be using JAVA := java JAVAC := javac JAR := jar # Add optimization and debugging flags here JFLAGS := # Default target all: $(target) # Build the jar file $(target): $(some_classes) $(images) $(manifest) $(JAR) cfm $(target) $(manifest) $(images) $(all_classes) # Compile java files %.class: %.java $(JAVAC) $(JFLAGS) -classpath .:$(class_path) $< # Remove rebuildable files clean: -rm -f $(target) $(all_classes) # Execute the program from the jar run: $(target) -$(JAVA) -classpath $(class_path) -jar $(target) # Declare phony targets .PHONY: all clean run