-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (57 loc) · 1.75 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
ifeq ($(shell uname -s),Darwin)
CONFIG_DARWIN=y
else ifeq ($(OS),Windows_NT)
CONFIG_WINDOWS=y
else
CONFIG_LINUX=y
endif
LIBRARY_PREFIX=lib
ifdef CONFIG_DARWIN
LOADABLE_EXTENSION=dylib
endif
ifdef CONFIG_LINUX
LOADABLE_EXTENSION=so
endif
ifdef CONFIG_WINDOWS
LOADABLE_EXTENSION=dll
LIBRARY_PREFIX=
endif
prefix=dist
TARGET_LOADABLE=$(prefix)/debug/parquet0.$(LOADABLE_EXTENSION)
TARGET_STATIC=$(prefix)/debug/parquet0.a
TARGET_LOADABLE_RELEASE=$(prefix)/release/parquet0.$(LOADABLE_EXTENSION)
TARGET_STATIC_RELEASE=$(prefix)/release/parquet0.a
ifdef target
CARGO_TARGET=--target=$(target)
BUILT_LOCATION=target/$(target)/debug/$(LIBRARY_PREFIX)sqlite_parquet.$(LOADABLE_EXTENSION)
else
CARGO_TARGET=
BUILT_LOCATION=target/debug/$(LIBRARY_PREFIX)sqlite_parquet.$(LOADABLE_EXTENSION)
endif
$(prefix):
mkdir -p $(prefix)/debug
mkdir -p $(prefix)/release
$(TARGET_LOADABLE): $(prefix) $(shell find . -type f -name '*.rs')
cargo build $(CARGO_TARGET)
cp $(BUILT_LOCATION) $@
$(TARGET_STATIC): $(prefix) $(shell find . -type f -name '*.rs')
cargo build
cp target/debug/$(LIBRARY_PREFIX)sqlite_parquet.a $@
$(TARGET_LOADABLE_RELEASE): $(prefix) $(shell find . -type f -name '*.rs')
cargo build --release
cp target/release/$(LIBRARY_PREFIX)sqlite_parquet.$(LOADABLE_EXTENSION) $@
$(TARGET_STATIC_RELEASE): $(prefix) $(shell find . -type f -name '*.rs')
cargo build
cp target/debug/$(LIBRARY_PREFIX)sqlite_parquet.a $@
sqlite-parquet.h: cbindgen.toml
rustup run nightly cbindgen --config $< -o $@
release: $(TARGET_LOADABLE_RELEASE) $(TARGET_STATIC_RELEASE)
loadable: $(TARGET_LOADABLE)
loadable-release: $(TARGET_LOADABLE_RELEASE)
static: $(TARGET_STATIC)
clean:
rm dist/*
cargo clean
test:
python3 tests/test-loadable.py
.PHONY: clean test loadable static