Skip to content

Commit

Permalink
Better Makefile
Browse files Browse the repository at this point in the history
Separated C++11 and pthread flags
Linking no longer yields unused pthread flag warning
  • Loading branch information
Arc676 committed Aug 22, 2017
1 parent e8f63e1 commit ae6cdf6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ TSRV=server
TCLI=client

CC=g++
FLAGS=-std=c++11 -pthread
FLAGS=-std=c++11
THREAD=-pthread

SRV=server.o msgthread.o msgthread_s.o acceptthread.o clienthandler.o
CLI=client.o msgthread.o msgthread_c.o
Expand All @@ -18,25 +19,25 @@ client: $(CLI)
$(CC) -o $(TCLI) $(CLI) $(FLAGS)

client.o: client.cpp
$(CC) -c client.cpp $(FLAGS)
$(CC) -c client.cpp $(FLAGS) $(THREAD)

server.o: server.cpp
$(CC) -c server.cpp $(FLAGS)
$(CC) -c server.cpp $(FLAGS) $(THREAD)

msgthread.o: msgthread.cpp
$(CC) -c msgthread.cpp $(FLAGS)
$(CC) -c msgthread.cpp $(FLAGS) $(THREAD)

msgthread_s.o: msgthread_s.cpp
$(CC) -c msgthread_s.cpp $(FLAGS)
$(CC) -c msgthread_s.cpp $(FLAGS) $(THREAD)

msgthread_c.o: msgthread_c.cpp
$(CC) -c msgthread_c.cpp $(FLAGS)
$(CC) -c msgthread_c.cpp $(FLAGS) $(THREAD)

acceptthread.o: acceptthread.cpp
$(CC) -c acceptthread.cpp $(FLAGS)
$(CC) -c acceptthread.cpp $(FLAGS) $(THREAD)

clienthandler.o: clienthandler.cpp
$(CC) -c clienthandler.cpp $(FLAGS)
$(CC) -c clienthandler.cpp $(FLAGS) $(THREAD)

clean:
rm -f *.o server client

0 comments on commit ae6cdf6

Please sign in to comment.