forked from Josko/aura-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
100 lines (82 loc) · 2.03 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
SHELL = /bin/sh
SYSTEM = $(shell uname)
ARCH = $(shell uname -m)
INSTALL_DIR = /usr
ifndef CC
CC = gcc
endif
ifndef CXX
CXX = g++
endif
CCFLAGS = -fno-builtin
CXXFLAGS = -std=c++14 -pipe -Wall -Wextra -fno-builtin -fno-rtti
DFLAGS =
OFLAGS = -O3 -flto
LFLAGS = -L. -L/usr/local/lib/ -Lbncsutil/src/bncsutil/ -lstorm -lbncsutil -lgmp -lbz2 -lz
ifeq ($(ARCH),x86_64)
CCFLAGS += -m64
CXXFLAGS += -m64
endif
ifeq ($(SYSTEM),Darwin)
INSTALL_DIR = /usr/local
CXXFLAGS += -stdlib=libc++
CC = clang
CXX = clang++
DFLAGS += -D__APPLE__
else
LFLAGS += -lrt
endif
ifeq ($(SYSTEM),FreeBSD)
DFLAGS += -D__FREEBSD__
endif
ifeq ($(SYSTEM),SunOS)
DFLAGS += -D__SOLARIS__
LFLAGS += -lresolv -lsocket -lnsl
endif
CCFLAGS += $(OFLAGS) -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION -I.
CXXFLAGS += $(OFLAGS) $(DFLAGS) -I. -Ibncsutil/src/ -IStormLib/src/
OBJS = src/bncsutilinterface.o \
src/bnet.o \
src/bnetprotocol.o \
src/config.o \
src/crc32.o \
src/csvparser.o \
src/game.o \
src/gameplayer.o \
src/gameprotocol.o \
src/gameslot.o \
src/gpsprotocol.o \
src/aura.o \
src/auradb.o \
src/map.o \
src/sha1.o \
src/socket.o \
src/stats.o \
src/irc.o \
src/fileutil.o
COBJS = src/sqlite3.o
PROG = aura++
all: $(OBJS) $(COBJS) $(PROG)
@echo "Used CFLAGS: $(CXXFLAGS)"
$(PROG): $(OBJS) $(COBJS)
@$(CXX) -o aura++ $(OBJS) $(COBJS) $(CXXFLAGS) $(LFLAGS)
@echo "[BIN] $@ created."
@strip "$(PROG)"
@echo "[BIN] Stripping the binary."
clean:
@rm -f $(OBJS) $(COBJS) $(PROG)
@echo "Binary and object files cleaned."
install:
@install -d "$(DESTDIR)$(INSTALL_DIR)/bin"
@install $(PROG) "$(DESTDIR)$(INSTALL_DIR)/bin/$(PROG)"
@echo "Binary $(PROG) installed to $(DESTDIR)$(INSTALL_DIR)/bin"
$(OBJS): %.o: %.cpp
@$(CXX) -o $@ $(CXXFLAGS) -c $<
@echo "[$(CXX)] $@"
$(COBJS): %.o: %.c
@$(CC) -o $@ $(CCFLAGS) -c $<
@echo "[$(CC)] $@"
clang-tidy:
@for file in $(OBJS); do \
clang-tidy "src/$$(basename $$file .o).cpp" -fix -checks=* -header-filter=src/* -- $(CXXFLAGS) $(DFLAGS); \
done;