Makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. CC=g++
  2. DEV=-Wall -g -std=c++14
  3. OPT=-O3 -std=c++14
  4. # explanatioin for compiler options
  5. # https://web.stanford.edu/class/cs193d/handouts/make.pdf
  6. JSON=json.hpp
  7. CREATE_DATA_SRC=createsortingdata.cxx createheapoperationdata.cxx
  8. CREATE_DATA_EXE=$(CREATE_DATA_SRC:.cxx=.exe)
  9. TEST_DATA_SRC=testCode.cxx
  10. TEST_DATA_EXE=$(TEST_DATA_SRC:.cxx=.exe)
  11. HEAP_DATA_SRC=heapsort.cxx
  12. HEAP_DATA_EXE=$(HEAP_DATA_SRC:.cxx=.exe)
  13. PRIORITY_SOURCES=priorityqueue.cpp
  14. PRIORITY_HEADERS=$(PRIORITY_SOURCES:.cpp=.h)
  15. PRIORITY_DEV_OBJ=$(PRIORITY_SOURCES:.cpp=.o)
  16. PRIORITY_OPT_OBJ=$(PRIORITY_SOURCES:.cpp=.o3)
  17. .PHONY: all
  18. all: priority_cla $(CREATE_DATA_EXE) $(TEST_DATA_EXE) $(HEAP_DATA_EXE)
  19. # Priority Queue
  20. .PHONY: $(PRIORITY_CLA)
  21. priority_cla: $(PRIORITY_DEV_OBJ) $(PRIORITY_OPT_OBJ)
  22. $(CREATE_DATA_EXE): %.exe: %.cxx $(JSON)
  23. $(CC) $(OPT) $< -o $@
  24. # priority queue objects(?)
  25. $(PRIORITY_DEV_OBJ): %.o: %.cpp %.h
  26. $(CC) $(DEV) -c $< -o $@
  27. $(PRIORITY_OPT_OBJ): %.o3: %.cpp %.h
  28. $(CC) $(OPT) -c $< -o $@
  29. # test code executable
  30. $(TEST_DATA_EXE): %.exe: %.cxx $(PRIORITY_OPT_OBJ)
  31. $(CC) $(OPT) $^ -o $@
  32. # test code executable
  33. $(HEAP_DATA_EXE): %.exe: %.cxx $(PRIORITY_OPT_OBJ)
  34. $(CC) $(OPT) $^ -o $@
  35. # Build
  36. .PHONY: clean
  37. clean:
  38. rm -f *.o
  39. rm -f *.o3
  40. rm -f *.exe
  41. rm -rf *.exe.dSYM
  42. .PHONY: update
  43. update:
  44. make clean
  45. make all