-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
48 lines (34 loc) · 1.18 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
.PHONY: all clean
CXX=g++
SDIR=GhostServer
ODIR=obj
SRCS=$(SDIR)/main.cpp $(SDIR)/mainwindow.cpp $(SDIR)/networkmanager.cpp $(SDIR)/mainwindow_qt.cpp $(SDIR)/networkmanager_qt.cpp
OBJS=$(patsubst $(SDIR)/%.cpp, $(ODIR)/%.o, $(SRCS))
ODIR_CLI=obj_cli
SRCS_CLI=$(SDIR)/main_cli.cpp $(SDIR)/networkmanager.cpp
OBJS_CLI=$(patsubst $(SDIR)/%.cpp, $(ODIR_CLI)/%.o, $(SRCS_CLI))
DEPS=$(OBJS:%.o=%.d)
CXXFLAGS=-std=c++17 -fPIC -DGHOST_GUI
CXXFLAGS_CLI=-std=c++17 -fPIC
LDFLAGS=-lpthread
LDFLAGS_CLI=-lpthread
include config.mk
all: ghost_server ghost_server_cli
clean:
rm -rf $(ODIR) $(ODIR_CLI) ghost_server ghost_server_cli
rm -rf $(SDIR)/ui_mainwindow.h $(SDIR)/mainwindow_qt.cpp $(SDIR)/networkmanager_qt.cpp
-include $(DEPS)
ghost_server: $(SDIR)/ui_mainwindow.h $(OBJS)
$(CXX) $(OBJS) $(LDFLAGS) -o $@
ghost_server_cli: $(OBJS_CLI)
$(CXX) $(OBJS_CLI) $(LDFLAGS_CLI) -o $@
$(ODIR)/%.o: $(SDIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -MMD -c $< -o $@
$(ODIR_CLI)/%.o: $(SDIR)/%.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS_CLI) -MMD -c $< -o $@
$(SDIR)/ui_mainwindow.h: $(SDIR)/mainwindow.ui
uic $< >$@
$(SDIR)/%_qt.cpp: $(SDIR)/%.h
cd $(SDIR); moc $(notdir $<) -o $(notdir $@) -DGHOST_GUI