Last active
November 10, 2015 21:43
-
-
Save guyhughes/0a5c7c383c0a70128d05 to your computer and use it in GitHub Desktop.
makefile for java with run target; now with javadoc
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
| RUN=NameSearchProgram |
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 := ./.class | |
| MK_SOURCEPATH := ./ | |
| MK_JAVADOCPATH := ./doc | |
| COMPILER := javac | |
| COMPILE_OPTIONS := -d $(MK_CLASSPATH) -classpath $(MK_CLASSPATH) | |
| RUN := | |
| classfiles = $(patsubst $(MK_SOURCEPATH)/%.java,$(MK_CLASSPATH)/%.class,$(MK_SOURCEPATH)/*.java) | |
| sourcefiles = $(MK_SOURCEPATH)/*.java | |
| .PHONY: total all clean doc | |
| total: clean all $(RUN) | |
| all: | |
| @mkdir -p $(MK_CLASSPATH) | |
| $(COMPILER) $(COMPILE_OPTIONS) $(sourcefiles) | |
| doc: | |
| @mkdir -p $(MK_JAVADOCPATH) | |
| javadoc $(sourcefiles) -d $(MK_JAVADOCPATH) | |
| xdg-open $(MK_JAVADOCPATH)/index.html | |
| $(MK_CLASSPATH)/%.class : $(MK_SOURCEPATH)/%.java | |
| @mkdir -p $(MK_CLASSPATH) | |
| $(COMPILER) $(COMPILE_OPTIONS) $? | |
| %: $(MK_CLASSPATH)/%.class | |
| java -classpath $(MK_CLASSPATH) $* | |
| clean: | |
| rm -f $(MK_CLASSPATH)/*.class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment