-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
35 lines (26 loc) · 774 Bytes
/
Makefile
File metadata and controls
35 lines (26 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
CXX = g++
CXXFLAGS = -g -Wall -Wextra -pedantic -std=c++17
# Add any additional source files here
SRCS = main.cpp
OBJS = $(SRCS:.cpp=.o)
# When submitting to Gradescope, submit all .cpp and .h files,
# the Makefile, as well as README.txt
FILES_TO_SUBMIT = $(shell ls *.cpp *.h Makefile README.txt 2> /dev/null)
# Rule for compiling .cpp to .o
%.o : %.cpp
$(CXX) $(CXXFLAGS) -c $*.cpp -o $*.o
# Executable target
csim : $(OBJS)
$(CXX) -o $@ $+
# Target to create a solution.zip file you can upload to Gradescope
.PHONY: solution.zip
solution.zip :
zip -9r $@ $(FILES_TO_SUBMIT)
# Generate header file dependencies
depend :
$(CXX) $(CXXFLAGS) -M $(SRCS) > depend.mak
depend.mak :
touch $@
clean :
-del /f csim.exe *.o 2>nul || rm -f csim *.o
include depend.mak