Makefile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. PRIORITY_SOURCES=priorityqueue.cpp
  12. PRIORITY_HEADERS=$(PRIORITY_SOURCES:.cpp=.h)
  13. PRIORITY_DEV_OBJ=$(PRIORITY_SOURCES:.cpp=.o)
  14. PRIORITY_OPT_OBJ=$(PRIORITY_SOURCES:.cpp=.o3)
  15. .PHONY: all
  16. all: priority_cla $(CREATE_DATA_EXE) $(TEST_DATA_EXE)
  17. # Priority Queue
  18. .PHONY: $(PRIORITY_CLA)
  19. priority_cla: $(PRIORITY_DEV_OBJ) $(PRIORITY_OPT_OBJ)
  20. $(CREATE_DATA_EXE): %.exe: %.cxx $(JSON)
  21. $(CC) $(OPT) $< -o $@
  22. # priority queue objects(?)
  23. $(PRIORITY_DEV_OBJ): %.o: %.cpp %.h
  24. $(CC) $(DEV) -c $< -o $@
  25. $(PRIORITY_OPT_OBJ): %.o3: %.cpp %.h
  26. $(CC) $(OPT) -c $< -o $@
  27. # test code executable
  28. $(TEST_DATA_EXE): %.exe: %.cxx $(PRIORITY_OPT_OBJ)
  29. $(CC) $(OPT) $^ -o $@
  30. # Build
  31. .PHONY: clean
  32. clean:
  33. rm -f *.o
  34. rm -f *.o3
  35. rm -f *.exe
  36. rm -rf *.exe.dSYM
  37. .PHONY: update
  38. update:
  39. make clean
  40. make all