Makefile 1.08 KB
CFLAGS += -Isrc/include
LDFLAGS += -lpthread
TARGETS = bin/client bin/server bin/socket.conf

ifndef $(CXX)
	CXX = g++
endif
STRIP = strip
ifeq ($(DEBUG_BUILD),1)
	CFLAGS += -g
	STRIP =\#
endif	

.PHONY: all clean

bin/client: bin/client.o bin/Socket.o
	$(CXX) -o bin/client bin/client.o bin/Socket.o $(LDFLAGS) $(CFLAGS)
	$(STRIP) bin/client

bin/client.o: src/client.cpp
	$(CXX) -o bin/client.o -c src/client.cpp $(CFLAGS)

bin/server.o: src/server.cpp src/include/server.h
	$(CXX) -o bin/server.o -c src/server.cpp $(CFLAGS)

bin/main_server.o: src/main_server.cpp
	$(CXX) -o bin/main_server.o -c src/main_server.cpp $(CFLAGS)

bin/server: bin/server.o bin/Socket.o bin/main_server.o src/include/server.h 
	$(CXX) -o bin/server bin/server.o bin/Socket.o bin/main_server.o $(LDFLAGS) $(CFLAGS)
	$(STRIP) bin/server

bin/Socket.o: src/Socket.cpp src/include/Socket.h src/include/SocketException.h
	$(CXX) -o bin/Socket.o -c src/Socket.cpp $(CFLAGS)

bin/socket.conf:
	cp socket.conf bin/socket.conf

clean:
	rm -rf bin/*

docs:
	cd doc/doxygen;doxygen Doxyfile
	cd doc/latex; make	

all: $(TARGETS)