Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #######################################################################
- # General Makefile for compiling c++ programs
- # Author : Sharynne Azhar
- #######################################################################
- # Specify the lab number
- LAB_NUM=X
- # Specify the folder name pattern
- FOLDER_NAME := Azhar_Lab$(LAB_NUM)
- # Specify the name of the program to build
- PROG_NAME := lab$(LAB_NUM)
- # Specify the files needed for compilation
- SRC_FILES = $(filter-out ./test.txt, $(wildcard ./*))
- # TODO: Make more generic by loading files in dynamically
- # A generalized rule for compiling the executable object
- $(PROG_NAME): main.o
- g++ -Wall -g -std=c++11 main.o -o $(PROG_NAME)
- # TODO: Make more generic by loading files in dynamically
- # A generalized rule for compiling c++ source files
- main.o: main.cpp
- g++ -Wall -g -std=c++11 -c main.cpp
- # Target for testing the program with a series of inputs
- test:
- ./$(PROG_NAME) < test.txt
- # Target for cleaning the generated files
- clean:
- @rm -rf *.o $(PROG_NAME)
- echo clean done
- # Target for compressing the files into archive
- zip:
- make clean
- zip -r $(FOLDER_NAME).zip $(SRC_FILES)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement