Last active
November 30, 2015 00:50
-
-
Save guyhughes/40383029a49a78d9bc86 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # _ | |
| # (_)____ _ _ __ ____ _ | |
| # / // __ `/| | / // __ `/ | |
| # / // /_/ / | |/ // /_/ / | |
| # __/ / \__,_/ |___/ \__,_/ | |
| # /___/ | |
| # __ ____ _ __ | |
| # ____ ___ ____ _ / /__ ___ / __/(_)/ /___ | |
| # / __ `__ \ / __ `// //_// _ \ / /_ / // // _ \ | |
| # / / / / / // /_/ // ,< / __// __// // // __/ | |
| # /_/ /_/ /_/ \__,_//_/|_| \___//_/ /_//_/ \___/ | |
| # by Guy Hughes | |
| MK_CLASSPATH := ./out | |
| MK_SOURCEPATH := src | |
| MK_JAVADOCPATH := ./doc | |
| COMPILER := javac | |
| COMPILE_OPTIONS := -d $(MK_CLASSPATH) -classpath $(MK_CLASSPATH) | |
| DEBUG_OPTIONS := -Xlint:unchecked | |
| RUN := com.guyhughes.Tester | |
| # http://stackoverflow.com/a/12959764/3337659 | |
| rwildcard=$(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)) | |
| sourcefiles = $(call rwildcard,$(MK_SOURCEPATH),*.java) | |
| classfiles = $(patsubst %.java,$(MK_CLASSPATH)/%.class,$(sourcefiles)) | |
| runtargets = $(subst /,.,$(patsubst $(MK_SOURCEPATH)/%,%,$(patsubst $(MK_CLASSPATH)/%,%,$(classfiles:.class=)))) | |
| .PHONY: total all clean doc debug targets default | |
| default: total | |
| total: clean all $(RUN) | |
| all: | |
| @mkdir -p $(MK_CLASSPATH) | |
| $(COMPILER) $(COMPILE_OPTIONS) $(sourcefiles) | |
| debug: | |
| @mkdir -p $(MK_CLASSPATH) | |
| $(COMPILER) $(COMPILE_OPTIONS) $(DEBUG_OPTIONS) $(sourcefiles) | |
| doc: | |
| @mkdir -p $(MK_JAVADOCPATH) | |
| javadoc $(sourcefiles) -d $(MK_JAVADOCPATH) | |
| xdg-open $(MK_JAVADOCPATH)/index.html | |
| $(runtargets): all | |
| java -classpath $(MK_CLASSPATH) $@ | |
| targets: | |
| @echo $(runtargets) | |
| clean: | |
| rm -rf $(MK_JAVADOCPATH) | |
| rm -f $(classfiles) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment