This repository has been archived by the owner on May 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·65 lines (49 loc) · 1.7 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
54
55
56
57
58
59
60
61
62
63
64
65
SRCDIR := src
BINDIR := bin
INCLUDES := -Iinclude/
OBJDIR := .build
TESTDIR := $(BINDIR)/tests
CC := g++
#gcc -xc++ -lstdc++ -shared-libgcc
CFLAGS := -Wall -Wextra -g -m32 -fno-stack-protector -z execstack -pthread -std=gnu++11 $(INCLUDES)
LFLAGS := -lm
SRC := \
$(wildcard src/services/authorization/*.cpp) \
$(wildcard src/services/authentication/*.cpp) \
$(wildcard src/services/commands/*.cpp) \
$(wildcard src/configuration/*.cpp) \
$(wildcard src/commands/*.cpp) \
$(wildcard src/network/*.cpp) \
$(wildcard src/helpers/*.cpp) \
$(wildcard src/files/*.cpp) \
$(wildcard src/user/*.cpp) \
$(wildcard src/grass.cpp) \
$(wildcard src/Exception.cpp) \
$(wildcard tests/*.cpp)
OBJECTS := $(SRC:%.cpp=$(OBJDIR)/%.o)
all: build $(BINDIR)/server $(BINDIR)/client $(TESTDIR)
tests: refresh $(TESTDIR)
$(OBJDIR)/%.o: %.cpp
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $<
$(BINDIR)/server: $(OBJECTS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(LFLAGS) $(INCLUDES) -o $(BINDIR)/server $(SRCDIR)/Server.cpp $(OBJECTS)
$(BINDIR)/client: $(OBJECTS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(LFLAGS) $(INCLUDES) -o $(BINDIR)/client $(SRCDIR)/ClientLauncher.cpp $(OBJECTS)
$(TESTDIR): $(OBJECTS)
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(LFLAGS) $(INCLUDES) -o $(BINDIR)/tests $(SRCDIR)/tests.cpp $(OBJECTS)
.PHONY: all build clean debug release refresh tests
build:
@mkdir -p $(BINDIR)
@mkdir -p $(OBJDIR)
debug: CFLAGS += -DDEBUG -g
debug: all
release: CFLAGS += -O2
release: all
clean:
-@rm -rvf $(OBJDIR)/*
-@rm -rvf $(BINDIR)/*
refresh: clean all