-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (34 loc) · 1.28 KB
/
Makefile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
PROGRAMS = calcTest calcInteractive calcServer
CC = gcc
CFLAGS = -g -Wall -Wextra -pedantic -std=gnu11
CXX = g++
CXXFLAGS = -D__USE_POSIX -g -Wall -Wextra -pedantic -std=gnu++11
.PHONY : solution.zip clean
%.o : %.c
$(CC) $(CFLAGS) -c $<
%.o : %.cpp
$(CXX) $(CXXFLAGS) -c $<
all : $(PROGRAMS)
# Use this target to create solution.zip that you can submit to Gradescope
.PHONY: solution.zip
solution.zip :
zip -9r solution.zip *.c *.cpp *.h Makefile README.txt
calcTest : calcTest.o calc.o tctest.o
$(CXX) -o $@ calcTest.o calc.o tctest.o
calcInteractive : calcInteractive.o calc.o csapp.o
$(CXX) -o $@ calcInteractive.o calc.o csapp.o -lpthread
calcServer : calcServer.o calc.o csapp.o
$(CXX) -o $@ calcServer.o calc.o csapp.o -lpthread
# Targets for .o files with correct dependencies.
# Note that no commands are needed because of the pattern rules above.
# This one is appropriate if you used C++ for the calculator implementation
calc.o : calc.cpp calc.h
# This one is appropriate if you used C for the calculator implementation
#calc.o : calc.c calc.h
calcTest.o : calcTest.c tctest.h
tctest.o : tctest.c tctest.h
calcInteractive.o : calcInteractive.c calc.h csapp.h
csapp.o : csapp.c csapp.h
calcServer.o : calcServer.c calc.h csapp.h
clean :
rm -f *.o $(PROGRAMS) solution.zip