Created
April 17, 2016 04:06
-
-
Save monzee/d5d191deb1efbf184f7b83d33c6cb944 to your computer and use it in GitHub Desktop.
A really simple makefile for single-file java programs. Put this in the same directory as the java file and run the program using `:!make main=%` in vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path := $(dir $(main)) | |
prefix := $(basename $(main)) | |
class_name := $(notdir $(prefix)) | |
COMPILE := javac | |
EXEC := java -cp .:$(path):$(cp) | |
.PHONY: run | |
run: $(prefix).class | |
$(EXEC) $(class_name) | |
%.class: %.java | |
$(COMPILE) $< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can also specify a classpath with
cp=/path/to/lib:/path/to/more/libs