Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # MYRKEL002
- # 1/4/2017
- #
- # functions of this make file:
- #
- # compile source code form ./src/ as well as test classes from ./test/. -- make
- # remove all .class files from bin and test -- make clean
- # create java docs into docs folder -- make docs
- # run the project from the main class* -- make run.
- # run the tests in the test suite** class -- make junit
- # create test coverage report*** -- make jacoco
- #
- # * this must be added manually to this makefile
- # ** the tests are run from one test suite that exacutes all the unit test files. the name of this file must be manually added to this makefile
- # *** this is an advanced feature and requirs supporting liberaries.
- #
- # This make file does NOT support packages. Not completely true, javac is smart, so it will compile all dependacies
- # for all classes in the src directory, this may or may not include any packages. Use at your own risk.
- # locations
- SRC = ./src/
- BIN = ./bin/
- DOC = ./doc/
- TEST = ./test/
- COVERAGE = ./coverage/
- # project specific file names
- MAIN = Server
- TESTSUITE = TestSuite
- # java
- JAVAC=/usr/bin/javac
- JAVADOC=/usr/bin/javadoc
- JAVA=/usr/bin/java
- # flags
- JAVADOC_FLAGS=-d $(DOC)
- JAVAC_FLAGS=-d $(BIN) -cp $(SRC):$(BIN)
- JUNIT_FLAGS=-d $(BIN) -cp ./lib/junit-4.10.jar:$(SRC):$(TEST)
- JUNIT_RUN=-javaagent:lib/jacocoagent.jar -cp ./lib/junit-4.10.jar:./lib/hamcrest-core-1.3.jar:$(SRC):$(BIN) org.junit.runner.JUnitCore
- JAVA_RUN=-cp $(BIN) $(MAIN)
- JACOCO_FLAGS=-cp lib/org.jacoco.core-0.7.9.201702052155.jar:lib/org.jacoco.report-0.7.9.201702052155.jar:lib/asm-5.0.4.jar:lib/asm-commons-5.0.4.jar:lib/asm-tree-5.0.4.jar:lib/commons-cli-1.3.1.jar:lib
- REPORT_FLAGS=-t $(COVERAGE) --reporttype html .
- EMPTY =
- JAVA_FILES = $(subst $(SRC), $(EMPTY), $(wildcard $(SRC)*.java))
- CLASS_FILES = $(subst $(SRC), $(BIN), $(JAVA_FILES:.java=.class))
- TEST_JAVA_FILES = $(subst $(TEST), $(EMPTY), $(wildcard $(TEST)*.java))
- TEST_CLASS_FILES = $(subst $(TEST),$(BIN), $(TEST_JAVA_FILES:.java=.class))
- all : $(addprefix $(BIN),$(CLASS_FILES)) $(addprefix $(BIN),$(TEST_CLASS_FILES))
- clean:
- rm $(BIN)*.class
- docs:
- $(JAVADOC) $(JAVADOC_FLAGS) $(SRC)*.java
- run:
- $(JAVA) $(JAVA_RUN)
- junit:
- $(JAVA) $(JUNIT_RUN) $(TESTSUITE)
- jacoco:
- $(JAVA) $(JACOCO_FLAGS) Report $(REPORT_FLAGS)
- $(BIN)%.class : $(SRC)%.java
- $(JAVAC) $(JAVAC_FLAGS) $<
- $(BIN)%.class : $(TEST)%.java
- $(JAVAC) $(JUNIT_FLAGS) $<
Add Comment
Please, Sign In to add comment