Skip to content

Commit 66607fb

Browse files
committed
Added makefile
1 parent 180678b commit 66607fb

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

Assignments/Assignment2/Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Makefile variables for the compiler and compiler flags
2+
# To use Makefile variables later in the Makefile: $()
3+
#
4+
# -g adds debugging information to the executable file
5+
# -Wall turns on most, but not all, compiler warnings
6+
#
7+
CC = gcc
8+
CFLAGS = -g -Wall
9+
LIBS = -pthread
10+
# typing 'make' will invoke the first target entry in the file
11+
# (in this case the default target entry)
12+
# you can name this target entry anything, but "default" or "all"
13+
# are the most commonly used names by convention
14+
default: server
15+
16+
server: webserver.o hashtable.o helper.o
17+
$(CC) $(CFLAGS) $(LIBS) -o server webserver.o hashtable.o helper.o
18+
19+
helper.o: helper.c helper.h
20+
$(CC) $(CFLAGS) -c helper.c
21+
22+
hashtable.o: hashtable.c hashtable.h helper.c helper.h
23+
$(CC) $(CFLAGS) -c hashtable.c
24+
25+
webserver.o: webserver.c webserver.h helper.c helper.h hashtable.c hashtable.h
26+
$(CC) $(CFLAGS) -c webserver.c
27+
28+
# To start over from scratch, type 'make clean'. This
29+
# removes the executable file, as well as old .o object
30+
# files and *~ backup files:
31+
#
32+
clean:
33+
$(RM) server *.o *~

Assignments/Assignment2/webserver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ int main(){
244244
int numReady = 0;
245245
int connfd = -1;
246246
struct msgqbuf msg;
247-
int cliLen = sizeof(clientAddr);
247+
socklen_t cliLen = sizeof(clientAddr);
248248

249249
while(true){
250250
numReady = Epoll_wait(epfd, readyList,/* maxevents = */ 20,/* timeout = */ -1);

0 commit comments

Comments
 (0)