-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
70 lines (51 loc) · 2.05 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
# exec-* targets execute commands of the target directly
# rest is executed in a container
#
# stable container produces binaries which are meant to be used in production
# nightly container is meant for development & testing (b/c of clippy)
#
# TODO: cache build container: run it and exec statements inside
# or figure out bind-mounted cargo cache
.PHONY=default compile build stable-environment nightly-environment stable-build nightly-build exec-stable-build exec-nightly-build test exec-test
DEPS=$(wildcard src/*.rs)
STABLE_BUILD_IMAGE="${USER}/pretty-git-prompt"
NIGHTLY_BUILD_IMAGE="${USER}/pretty-git-prompt:dev"
STABLE_CONTAINER_RUN=docker run --rm -v ${PWD}:/src:Z -ti $(STABLE_BUILD_IMAGE)
# breaks CI: -v ~/.cargo/registry/:/home/pretty/.cargo/registry/:Z
NIGHTLY_CONTAINER_RUN=docker run --rm -v ${PWD}:/src:Z -ti $(NIGHTLY_BUILD_IMAGE)
default: build
compile: nightly-build
build: stable-build
stable-environment:
docker build --tag $(STABLE_BUILD_IMAGE) .
nightly-environment:
docker build --tag $(NIGHTLY_BUILD_IMAGE) -f ./Dockerfile.dev .
stable-build: stable-environment
$(STABLE_CONTAINER_RUN) make exec-stable-build
nightly-build:
$(NIGHTLY_CONTAINER_RUN) make exec-nightly-build
exec-stable-build: target/release/pretty-git-prompt
exec-nightly-build: target/debug/pretty-git-prompt
target/release/pretty-git-prompt: $(DEPS)
LIBZ_SYS_STATIC=1 cargo build --release
target/debug/pretty-git-prompt: $(DEPS)
cargo build -vvvv
test:
$(NIGHTLY_CONTAINER_RUN) make exec-test
exec-test: target/debug/pretty-git-prompt
py.test-3 -vv tests
cargo test --verbose
$(shell cargo clippy || :)
# compile and inject into container
# open prompt with prepared git repo
zsh-demo:
$(NIGHTLY_CONTAINER_RUN) files/demo.py zsh
bash-demo:
$(NIGHTLY_CONTAINER_RUN) files/demo.py bash
shell:
$(NIGHTLY_CONTAINER_RUN) zsh -l
show-work:
egrep --color=yes -C 3 "(TODO|FIXME)" $(DEPS) Makefile Dockerfile
release:
cargo build --target ${TARGET} --release
cp -av target/${TARGET}/release/${PROJECT_NAME} "${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}"