-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
91 lines (72 loc) · 2.18 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
79
80
81
82
83
84
85
86
87
88
89
90
91
REBAR3 = PATH=$(shell pwd):$(PATH) rebar3
RELX = PATH=$(shell pwd):$(PATH) relx
RELX_REPO = https://github.com/erlware/relx.git
RELX_DIR = relx-repo
RELX_BUILD_PATH = $(RELX_DIR)/_build/default
LFEX_ORG = https://github.com/lfex
OLP_BUILD_PATHS = _build/*
LFE_BUILD_DIR = _build/default/lib/lfe
OLP_REL = _build/default/rel/olp
OLP_BIN = $(OLP_REL)/bin
DOCKER_DIR = priv/docker
DOCKER_TAG_NAME = lfex/olp
DOCKER_TAG_VERSION = latest
DOCKER_TAG = $(DOCKER_TAG_NAME):$(DOCKER_TAG_VERSION)
PATCHES_DIR = $(shell pwd)/priv/patches
LFE_BANNER_PATCH = $(PATCHES_DIR)/olp-banner.patch
PATCH_BANNER = $(PATCHES_DIR)/olp-banner.applied-patch
all: sources build $(PATCH_BANNER)
$(REBAR3) release
tarball: $(PATCH_BANNER)
$(REBAR3) tar
build:
$(REBAR3) compile
$(PATCH_BANNER):
cd $(LFE_BUILD_DIR) && \
patch -p1 < $(LFE_BANNER_PATCH) && \
$(REBAR3) compile
touch $(PATCH_BANNER)
clean:
rebar3 clean
cd lfe && make clean
rm -rf $(OLP_BUILD_PATHS)/rel rebar.lock
clean-all: clean docker-clean
rm -rf _build $(PATCH_BANNER)
sources:
git submodule init
git submodule update
update-lfe:
cd lfe && git checkout master && git pull && cd - && git add lfe
update-libs:
for LIB in `find lib -mindepth 1 -maxdepth 1`; \
do \
cd $$LIB && git checkout master && git pull && cd - && git add $$LIB; \
done
update-sources: update-lfe update-libs
git commit lfe lib .gitmodules -m "Updated sources."
add-lib:
git submodule add $(LFEX_ORG)/$(OLP_LIB) lib/$(OLP_LIB)
git commit lib/$(OLP_LIB) .gitmodules -m "Added $(OLP_LIB) library to OLP."
setup-rebar3:
wget https://s3.amazonaws.com/rebar3/rebar3
chmod +x rebar3
setup-relx:
git clone $(RELX_REPO) $(RELX_DIR)
cd $(RELX_DIR) && $(REBAR3) update && $(REBAR3) escriptize
mv $(RELX_BUILD_PATH)/bin/relx .
rm -rf $(RELX_DIR)
travis-build: setup-rebar3 setup-relx all
docker-build: all
mkdir -p $(DOCKER_DIR)/tmp
cp -r $(OLP_REL) $(DOCKER_DIR)/tmp
docker build -t $(DOCKER_TAG) $(DOCKER_DIR)
rm -rf $(DOCKER_DIR)/tmp
docker-run:
docker run -i -t $(DOCKER_TAG)
docker-run-bash:
docker run -i -t $(DOCKER_TAG) bash
docker-publish:
docker push $(DOCKER_TAG)
docker-clean:
@-docker rm `docker ps -a -q`
@-docker rmi `docker images -q --filter 'dangling=true'`