-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (28 loc) · 891 Bytes
/
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
PROGNAME = LinuxTcpDaemon
CLIENTNAME = ClientTcp
CXX = g++
CPPFLAGS = -std=c++14 -Wall -pedantic -pthread
CODEDIR = src/server
BUILDDIR = build
SRCFILES = $(wildcard ${CODEDIR}/*.cpp)
OBJECTS = $(patsubst ${CODEDIR}%.cpp, ${BUILDDIR}%.o, $(SRCFILES))
# $@ - target; $< - first prereq; $^ - all prereq
all: buildDir $(BUILDDIR)/$(PROGNAME) $(BUILDDIR)/$(CLIENTNAME)
buildDir:
mkdir -p $(BUILDDIR)
# client
$(BUILDDIR)/$(CLIENTNAME) : $(BUILDDIR)/client.o
$(CXX) $(CPPFLAGS) -o $@ $^
$(info Linked objects to Client ELF.)
$(BUILDDIR)/client.o : src/client/client.cpp
$(CXX) $(CPPFLAGS) -c $< -o $@
# server
$(BUILDDIR)/$(PROGNAME) : $(OBJECTS)
$(CXX) $(CPPFLAGS) -o $@ $^
$(info Linked objects to Server ELF.)
$(BUILDDIR)/%.o: $(CODEDIR)/%.cpp
$(CXX) $(CPPFLAGS) -c $< -o $@
format:
find src/ -iname *.hpp -o -iname *.cpp | xargs clang-format -i
clean:
rm -rf $(BUILDDIR)