-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (35 loc) · 1.42 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
src = $(wildcard *.cpp)
src := $(filter-out inventory.cpp botterage-http.cpp, $(src))
obj = $(src:.cpp=.o)
dep = $(obj:.o=.d)
LDFLAGS=-L /usr/lib64 -L /usr/local/lib -L /usr/lib64/mysql -lsqlite3 \
-lcurl -lmysqlclient -lmysqlpp -lssl -lcrypto -pthread -ldl -Wl,--dynamic-list=dynlist
CXX = g++
CXXFLAGS = -Wall -include include/logging.hpp -std=c++17 -I include -I /usr/include/mysql -I /usr/include \
-I /usr/include/mysql++
.PHONY : all
all : botterage
botterage : $(obj)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
inventory : inventory.cpp include/inventory.hpp include/stringextensions.hpp \
stringextensions.o include/settings.hpp
g++ -std=c++17 $(INCFLAGS) -L /usr/lib64 -L /usr/local/lib \
-L /usr/lib64/mysql -lmysqlpp -lmysqlclient inventory.cpp \
stringextensions.o -o inventory
vars.tsv : $(src)
echo -e 'Variable\tDefault\tSecret?\tDescription' > vars.tsv
egrep -hIr --exclude-dir '.git' '^@var [^ ]+[* :]' | \
perl -ne 'if (m/@var ([^ *]+)( \((.*?)\))?(\*?): *(.*)$$/) {print "$$1\t$$3\t$$4\t$$5\n";}' >> vars.tsv
# add fcgi flags for compilation
botterage-http : LDFLAGS += -lfcgi++ -lfcgi -lcrypto
botterage-http : botterage-http.cpp stringextensions.o utils.o include/DBConnPool.hpp DBConnPool.o
g++ $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
-include $(dep)
%.d : %.cpp
@$(CXX) $(CXXFLAGS) $< -MM -MT $(@:.d=.o) >$@
.PHONY : install
install : botterage inventory
mv botterage /usr/local/bin/botterage
.PHONY : clean
clean :
-rm -f *.o