summaryrefslogtreecommitdiff
path: root/tools/msgenc/Makefile
diff options
context:
space:
mode:
authorRémi Calixte <remicalixte.rmc@gmail.com>2021-08-31 08:30:47 +0200
committerRémi Calixte <remicalixte.rmc@gmail.com>2021-08-31 08:30:47 +0200
commit12bafff5c0ca6bfdcca3553a0717c80f21e27182 (patch)
tree7c07954a140c879b8c71e33a71c603f27076ab56 /tools/msgenc/Makefile
parent4e4192cd7007d16cefe00facbc7b721353c94f60 (diff)
parent05ded46ab7f556956a2eee2411a8d2968b7e8ad6 (diff)
Merge branch 'master' into unk_02006D98
Diffstat (limited to 'tools/msgenc/Makefile')
-rw-r--r--tools/msgenc/Makefile33
1 files changed, 30 insertions, 3 deletions
diff --git a/tools/msgenc/Makefile b/tools/msgenc/Makefile
index 2fc4f3a9..b39d97cb 100644
--- a/tools/msgenc/Makefile
+++ b/tools/msgenc/Makefile
@@ -1,13 +1,40 @@
CXXFLAGS := -std=c++17 -O2 -Wall -Wno-switch
CFLAGS := -O2 -Wall -Wno-switch
+ifeq ($(DEBUG),)
+CXXFLAGS += -DNDEBUG
+endif
+
+DEPDIR := .deps
+DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.d
+
+define SRCS :=
+ msgenc.cpp
+ MessagesConverter.cpp
+ MessagesDecoder.cpp
+ MessagesEncoder.cpp
+endef
+
+OBJS := $(SRCS:%.cpp=%.o)
+
.PHONY: all clean
all: msgenc
@:
clean:
- $(RM) msgenc msgenc.exe
+ $(RM) -r msgenc msgenc.exe $(OBJS) $(DEPDIR)
+
+msgenc: $(OBJS)
+ $(CXX) $(LDFLAGS) -o $@ $^
+
+%.o: %.cpp
+%.o: %.cpp $(DEPDIR)/%.d | $(DEPDIR)
+ $(CXX) $(CXXFLAGS) $(DEPFLAGS) -c -o $@ $<
+
+$(DEPDIR): ; @mkdir -p $@
+
+DEPFILES := $(SRCS:%.cpp=$(DEPDIR)/%.d)
+$(DEPFILES):
-msgenc: msgenc.cpp
- $(CXX) $(CXXFLAGS) -o $@ $^
+include $(wildcard $(DEPFILES))