Skip to content

Instantly share code, notes, and snippets.

@greduan
Last active April 7, 2018 19:29
Show Gist options
  • Save greduan/07aea83e984096c38ecbf4b1d78f5440 to your computer and use it in GitHub Desktop.
Save greduan/07aea83e984096c38ecbf4b1d78f5440 to your computer and use it in GitHub Desktop.
Java Makefile
class_d=bin
lib_d=lib
source_d=src
JAVAC=javac
JFLAGS=-g -d $(class_d) -sourcepath $(source_d) -Xlint:all
s_app=$(shell find $(source_d) -name '*.java')
c_app=$(patsubst $(source_d)/%.java, $(class_d)/%.class, $(s_app))
.PHONY: default all classes clean
default: classes
classes: $(c_app) $(class_d)
$(class_d)/%.class: $(source_d)/%.java
@echo "$@"
$(JAVAC) $(JFLAGS) $<
all: classes
clean:
rm -rf $(class_d)/*
#!/bin/sh
java -classpath bin/ HelloWorld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment