-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure
executable file
·67 lines (49 loc) · 1.76 KB
/
configure
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
#!/bin/bash
# -*- mode:makefile -*-
output=Makefile
>${output}
# Get flags from mysql_config:
echo "MYSQL_COMPILE_FLAGS = $(mysql_config --cflags)" >> ${output}
echo "MYSQL_LINK_FLAGS = $(mysql_config --libs)" >> ${output}
(cat << 'EOF'
COMPILE_FLAGS=-fPIC -std=c++11 -Wall -Werror -Weffc++ -pedantic -ggdb -D _DEBUG
CXXFLAGS=$(MYSQL_COMPILE_FLAGS) $(COMPILE_FLAGS)
LINK_FLAGS=$(MYSQL_LINK_FLAGS)
CXX = g++
ifndef PREFIX
PREFIX := /usr/local
endif
all: libmysqlcb.so.0.1 test xmlify sqldrill
# Omit linking mysql library to prove that libmysqlcb is sufficient without it.
test: test.cpp libmysqlcb.so.0.1
$(CXX) $(CXXFLAGS) -L. -o test test.cpp -Wl,-R -Wl,. -lmysqlcb
xmlify: xmlify.cpp libmysqlcb.so.0.1
$(CXX) $(CXXFLAGS) -L. -o xmlify xmlify.cpp -Wl,-R -Wl,. -lmysqlcb
sqldrill: sqldrill.cpp libmysqlcb.so.0.1
$(CXX) $(CXXFLAGS) -L. -o sqldrill sqldrill.cpp ${LINK_FLAGS} -Wl,-R -Wl,. -lmysqlcb
libmysqlcb.so.0.1 : mysqlcb.o binder.o
$(CXX) -shared -o libmysqlcb.so.0.1 mysqlcb.o binder.o ${LINK_FLAGS}
ln -sf libmysqlcb.so.0.1 libmysqlcb.so
mysqlcb.o : mysqlcb.cpp mysqlcb.hpp mysqlcb_binder.hpp
$(CXX) $(CXXFLAGS) -c -o mysqlcb.o mysqlcb.cpp
binder.o : binder.cpp mysqlcb_binder.hpp
$(CXX) $(CXXFLAGS) -c -o binder.o binder.cpp
install:
install -d $(PREFIX)/lib
install -m 644 libmysqlcb.so* $(PREFIX)/lib
install -d $(PREFIX)/bin
install -m 777 xmlify $(PREFIX)/bin
install -d $(PREFIX)/include
install -m 644 mysqlcb_binder.hpp $(PREFIX)/include
install -m 644 mysqlcb.hpp $(PREFIX)/include
ldconfig $(PREFIX)
uninstall:
rm -f $(PREFIX)/lib/libmysqlcb.so
rm -f $(PREFIX)/lib/libmysqlcb.so.0.1
rm -f $(PREFIX)/bin/xmlify
rm -f $(PREFIX)/include/mysqlcb.hpp
rm -f $(PREFIX)/include/mysqlcb_binder.hpp
clean:
rm -f *.o libmysqlcb.so* test
EOF
) >> ${output}