-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (37 loc) · 1.29 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
CC = gcc
CXX = g++
UNAME = $(shell uname)
CFLAGS = $(shell pkg-config --libs sqlite3) $(shell pkg-config --cflags sqlite3) -fPIC
ARCH = $(shell getconf LONG_BIT)
DUMPMACHINE = $(shell $(CC) -dumpmachine -m$(ARCH))
CXXFLAGS = $(CFLAGS) -lsqlite-crypto-vfs -Llib/$(DUMPMACHINE)
SRC_ROOT = src
SQLITE_CRYPTO_VFS_SOURCE = $(SRC_ROOT)/aes.c $(SRC_ROOT)/sqlite-crypto-vfs.c
ifeq ($(UNAME), Linux)
LIB_PREFIX = lib
LIB_SUFFIX = .so
else ifeq ($(UNAME), Darwin)
LIB_PREFIX = lib
LIB_SUFFIX = .dylib
endif
default: build
clean:
rm -Rf lib
rm -Rf bin
build: sqlite-crypto-vfs
mkdir-lib:
mkdir -p lib/$(DUMPMACHINE)
sqlite-crypto-vfs-arch64: mkdir-lib
$(CC) $(CFLAGS) -shared -m64 -o lib/$(DUMPMACHINE)/$(LIB_PREFIX)sqlite-crypto-vfs$(LIB_SUFFIX) $(SQLITE_CRYPTO_VFS_SOURCE)
sqlite-crypto-vfs-arch32: mkdir-lib
$(CC) $(CFLAGS) -shared -m32 -o lib/$(DUMPMACHINE)/$(LIB_PREFIX)sqlite-crypto-vfs$(LIB_SUFFIX) $(SQLITE_CRYPTO_VFS_SOURCE)
sqlite-crypto-vfs: sqlite-crypto-vfs-arch$(ARCH)
@echo "*** BUILD SUCCESSFUL ***"
test-build: sqlite-crypto-vfs mkdir-bin
$(CXX) $(CXXFLAGS) -o bin/test $(SRC_ROOT)/test.cpp
test: test-build
LD_LIBRARY_PATH=./lib/$(DUMPMACHINE) bin/test
mkdir-bin:
mkdir -p bin
decrypt-build: mkdir-bin
$(CXX) -o bin/sqlite-crypto-decrypt $(SRC_ROOT)/aes.c $(SRC_ROOT)/sqlite-crypto-decrypt.cpp