Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. #######################################################################
  2. # General Makefile for compiling c++ programs
  3. # Author : Sharynne Azhar
  4. #######################################################################
  5.  
  6. # Specify the lab number
  7. LAB_NUM=X
  8.  
  9. # Specify the folder name pattern
  10. FOLDER_NAME := Azhar_Lab$(LAB_NUM)
  11.  
  12. # Specify the name of the program to build
  13. PROG_NAME := lab$(LAB_NUM)
  14.  
  15. # Specify the files needed for compilation
  16. SRC_FILES = $(filter-out ./test.txt, $(wildcard ./*))
  17.  
  18. # TODO: Make more generic by loading files in dynamically
  19. # A generalized rule for compiling the executable object
  20. $(PROG_NAME): main.o
  21. g++ -Wall -g -std=c++11 main.o -o $(PROG_NAME)
  22.  
  23. # TODO: Make more generic by loading files in dynamically
  24. # A generalized rule for compiling c++ source files
  25. main.o: main.cpp
  26. g++ -Wall -g -std=c++11 -c main.cpp
  27.  
  28. # Target for testing the program with a series of inputs
  29. test:
  30. ./$(PROG_NAME) < test.txt
  31.  
  32. # Target for cleaning the generated files
  33. clean:
  34. @rm -rf *.o $(PROG_NAME)
  35. echo clean done
  36.  
  37. # Target for compressing the files into archive
  38. zip:
  39. make clean
  40. zip -r $(FOLDER_NAME).zip $(SRC_FILES)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement