blob: 9dccbd283ffee38c58f955a57705f566990a4c62 (
about) (
plain)
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
|
include Makefile.config
MARIADB_SRC = mariadb-connector-c-v_2.3.7/
LIBMARIADB = $(MARIADB_SRC)/build/libmariadb/libmariadbclient.a
XML2_SRC = libxml2-2.9.10/
LIBXML2 = $(XML2_SRC)/.libs/libxml2.a
CC = $(TARGET)-gcc
OBJECTS = string_buf.o restore.o hashtable.o
all : __executable
$(OBJECTS) : Makefile.config Makefile
ifeq ($(TARGET),x86_64-linux-gnu)
SUFFIX =
STATIC_LIBS =
LINKFLAGS = -shared -lxml2 -lmariadbclient
CFLAGS = -fPIC -I /usr/include/libxml2/
else
SUFFIX = .exe
STATIC_LIBS = $(LIBMARIADB) $(LIBXML2)
LINKFLAGS = -static -L $(dir $(LIBMARIADB)) -L $(dir $(LIBXML2)) \
-lxml2 -lmariadbclient -lkernel32 -lws2_32
CFLAGS = -I $(XML2_SRC)/include/ -I $(MARIADB_SRC)/include/
$(OBJECTS) : $(LIBMARIADB) $(LIBXML2)
endif
EXECUTABLE = restore$(SUFFIX)
__executable : $(EXECUTABLE)
$(EXECUTABLE) : $(OBJECTS)
$(TARGET)-gcc $^ $(LINKFLAGS) -o $@
$(LIBXML2) : Makefile.config
-cd $(XML2_SRC) && make distclean 2> /dev/null
cd $(XML2_SRC) && ./configure \
--host=$(TARGET) \
--without-iconv \
--with-zlib \
--without-python \
--without-http \
--without-ftp \
--without-lzma
cd $(XML2_SRC) && make -j$$((`nproc` + 1))
$(LIBMARIADB) : Makefile.config
rm -rf $(MARIADB_SRC)/build/
cd $(MARIADB_SRC) && cmake -B build/ \
-D CMAKE_TOOLCHAIN_FILE=./mingw_cross_toolchain.cmake \
-D WITH_EXTERNAL_ZLIB=ON \
-D GNU_HOST=$(TARGET)
cd $(MARIADB_SRC)build/ && make -j$$((`nproc` + 1)) mariadbclient
clean :
-cd $(XML2_SRC) && make distclean 2> /dev/null
rm -rf $(MARIADB_SRC)/build/
rm -rf *.o restore restore.exe
.PHONY : clean all __executable
|