Guest User

Untitled

a guest
Mar 17th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. # MYRKEL002
  2. # 1/4/2017
  3. #
  4. # functions of this make file:
  5. #
  6. # compile source code form ./src/ as well as test classes from ./test/. -- make
  7. # remove all .class files from bin and test -- make clean
  8. # create java docs into docs folder -- make docs
  9. # run the project from the main class* -- make run.
  10. # run the tests in the test suite** class -- make junit
  11. # create test coverage report*** -- make jacoco
  12. #
  13. # * this must be added manually to this makefile
  14. # ** 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
  15. # *** this is an advanced feature and requirs supporting liberaries.
  16. #
  17. # This make file does NOT support packages. Not completely true, javac is smart, so it will compile all dependacies
  18. # for all classes in the src directory, this may or may not include any packages. Use at your own risk.
  19.  
  20. # locations
  21. SRC = ./src/
  22. BIN = ./bin/
  23. DOC = ./doc/
  24. TEST = ./test/
  25. COVERAGE = ./coverage/
  26.  
  27. # project specific file names
  28. MAIN = Server
  29. TESTSUITE = TestSuite
  30.  
  31. # java
  32. JAVAC=/usr/bin/javac
  33. JAVADOC=/usr/bin/javadoc
  34. JAVA=/usr/bin/java
  35.  
  36. # flags
  37. JAVADOC_FLAGS=-d $(DOC)
  38. JAVAC_FLAGS=-d $(BIN) -cp $(SRC):$(BIN)
  39. JUNIT_FLAGS=-d $(BIN) -cp ./lib/junit-4.10.jar:$(SRC):$(TEST)
  40. JUNIT_RUN=-javaagent:lib/jacocoagent.jar -cp ./lib/junit-4.10.jar:./lib/hamcrest-core-1.3.jar:$(SRC):$(BIN) org.junit.runner.JUnitCore
  41. JAVA_RUN=-cp $(BIN) $(MAIN)
  42. 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
  43. REPORT_FLAGS=-t $(COVERAGE) --reporttype html .
  44.  
  45. EMPTY =
  46.  
  47. JAVA_FILES = $(subst $(SRC), $(EMPTY), $(wildcard $(SRC)*.java))
  48. CLASS_FILES = $(subst $(SRC), $(BIN), $(JAVA_FILES:.java=.class))
  49. TEST_JAVA_FILES = $(subst $(TEST), $(EMPTY), $(wildcard $(TEST)*.java))
  50. TEST_CLASS_FILES = $(subst $(TEST),$(BIN), $(TEST_JAVA_FILES:.java=.class))
  51.  
  52. all : $(addprefix $(BIN),$(CLASS_FILES)) $(addprefix $(BIN),$(TEST_CLASS_FILES))
  53.  
  54. clean:
  55. rm $(BIN)*.class
  56.  
  57. docs:
  58. $(JAVADOC) $(JAVADOC_FLAGS) $(SRC)*.java
  59.  
  60. run:
  61. $(JAVA) $(JAVA_RUN)
  62.  
  63. junit:
  64. $(JAVA) $(JUNIT_RUN) $(TESTSUITE)
  65.  
  66. jacoco:
  67. $(JAVA) $(JACOCO_FLAGS) Report $(REPORT_FLAGS)
  68.  
  69. $(BIN)%.class : $(SRC)%.java
  70. $(JAVAC) $(JAVAC_FLAGS) $<
  71.  
  72. $(BIN)%.class : $(TEST)%.java
  73. $(JAVAC) $(JUNIT_FLAGS) $<
Add Comment
Please, Sign In to add comment