Skip to content

Commit dc83612

Browse files
authored
Split make rules for independent Lua/Python build and install (#20)
1 parent 6a2e930 commit dc83612

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

Makefile

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,49 @@
22

33
PROFILE ?= release
44

5+
.PHONY: default
6+
default: install-lua
7+
8+
.PHONY: install
9+
install: install-lua
10+
511
.PHONY: all
6-
all: all-rust links
12+
all: install-all
13+
14+
.PHONY: install-all
15+
install-all: install-lua install-python
716

817
.PHONY: all-rust
9-
all-rust: lua_lib python_lib
18+
all-rust: lib-lua lib-python
1019

20+
RUST_SOURCES = Cargo.lock src/lib.rs
1121
CARGO_FLAGS = $(and $(PROFILE:debug=),--$(PROFILE))
1222

13-
.PHONY: lua_lib
14-
lua_lib: target-lua/$(PROFILE)/libvim_commonmark.so
23+
.PHONY: lib-lua
24+
lib-lua: target-lua/$(PROFILE)/libvim_commonmark.so
1525

16-
RUST_SOURCES = Cargo.lock $(wildcard src/*.rs)
17-
18-
target-lua/$(PROFILE)/libvim_commonmark.so: $(RUST_SOURCES)
26+
target-lua/$(PROFILE)/libvim_commonmark.so: $(RUST_SOURCES) src/lua.rs
1927
export LUA_INC=/usr/include/luajit-2.0/
2028
export LUA_LIB=/usr/lib LUA_LIB_NAME=luajit-5.1
2129
export LUA_LINK=dynamic
2230
cargo build --no-default-features --features lua --target-dir target-lua $(CARGO_FLAGS)
2331

24-
.PHONY: python_lib
25-
python_lib: target-python/$(PROFILE)/libvim_commonmark.so
32+
.PHONY: lib-python
33+
lib-python: target-python/$(PROFILE)/libvim_commonmark.so
2634

27-
target-python/$(PROFILE)/libvim_commonmark.so: $(RUST_SOURCES)
35+
target-python/$(PROFILE)/libvim_commonmark.so: $(RUST_SOURCES) src/python.rs
2836
cargo build --no-default-features --features python --target-dir target-python $(CARGO_FLAGS)
2937

30-
.PHONY: links
31-
links: lua/libvim_commonmark.so python3/libvim_commonmark.so
38+
.PHONY: install-lua
39+
install-lua: lua/libvim_commonmark.so
3240

3341
lua/libvim_commonmark.so: target-lua/$(PROFILE)/libvim_commonmark.so
3442
mkdir -p $(@D)
3543
ln -sf ../$< $@
3644

45+
.PHONY: install-python
46+
install-python: python3/libvim_commonmark.so
47+
3748
python3/libvim_commonmark.so: target-python/$(PROFILE)/libvim_commonmark.so
3849
mkdir -p $(@D)
3950
ln -sf ../$< $@
@@ -47,4 +58,3 @@ test-rust:
4758
export LUA_LIB=/usr/lib LUA_LIB_NAME=luajit-5.1
4859
export LUA_LINK=dynamic
4960
cargo test --no-default-features --features lua --target-dir target-lua $(CARGO_FLAGS)
50-

0 commit comments

Comments
 (0)