This repository was archived by the owner on Jul 11, 2023. It is now read-only.
forked from oubiwann/lfest
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
77 lines (60 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
PROJECT = lfest
ROOT_DIR = $(shell pwd)
REPO = $(shell git config --get remote.origin.url)
LFE = _build/default/lib/lfe/bin/lfe
DOCS_DIR = $(ROOT_DIR)/docs
GUIDE_DIR = $(DOCS_DIR)/user-guide
GUIDE_BUILD_DIR = $(GUIDE_DIR)/build
DOCS_PROD_DIR = $(DOCS_DIR)/master
API_PROD_DIR = $(DOCS_PROD_DIR)/current/api
GUIDE_PROD_DIR = $(DOCS_PROD_DIR)/current/user-guide
DOCS_GIT_HACK = $(DOCS_DIR)/.git
LOCAL_DOCS_HOST = localhost
LOCAL_DOCS_PORT = 5099
compile:
rebar3 compile
check:
@DEBUG=1 rebar3 as test eunit
repl: compile
@$(LFE)
shell:
@rebar3 shell
clean:
@rebar3 clean
@rm -rf ebin/* _build/default/lib/$(PROJECT)
clean-all: clean
@rebar3 as dev lfe clean
$(DOCS_GIT_HACK):
@ln -s $(ROOT_DIR)/.git $(DOCS_DIR)
docs-setup:
@echo "\nInstalling and setting up dependencies ..."
@cd $(DOCS_DIR) && bundle install
docs-clean:
@echo "\nCleaning build directories ..."
@rm -rf $(GUIDE_BUILD_DIR) $(API_PROD_DIR) $(GUIDE_PROD_DIR)
docs-lodox:
@echo
@rebar3 lfe lodox
docs: clean compile docs-clean $(DOCS_GIT_HACK)
@echo "\nBuilding docs ...\n"
@make docs-lodox
devdocs: docs
@echo
@echo "Running docs server on http://$(LOCAL_DOCS_HOST):$(LOCAL_DOCS_PORT) ... (To quit, hit ^c twice)"
@echo
@erl -s inets -noshell -eval 'inets:start(httpd,[{server_name,"devdocs"},{document_root, "$(DOCS_PROD_DIR)"},{server_root, "$(DOCS_PROD_DIR)"},{port, $(LOCAL_DOCS_PORT)},{mime_types,[{"html","text/html"},{"htm","text/html"},{"js","text/javascript"},{"css","text/css"},{"gif","image/gif"},{"jpg","image/jpeg"},{"jpeg","image/jpeg"},{"png","image/png"}]}]).'
setup-temp-repo: $(DOCS_GIT_HACK)
@echo "\nSetting up temporary git repos for gh-pages ...\n"
@rm -rf $(DOCS_PROD_DIR)/.git $(DOCS_PROD_DIR)/*/.git
@cd $(DOCS_PROD_DIR) && git init
@cd $(DOCS_PROD_DIR) && git add * > /dev/null
@cd $(DOCS_PROD_DIR) && git commit -a -m "Generated content." > /dev/null
teardown-temp-repo:
@echo "\nTearing down temporary gh-pages repos ..."
@rm $(DOCS_DIR)/.git $(GUIDE_DIR)/Gemfile.lock
@rm -rf $(DOCS_PROD_DIR)/.git $(DOCS_PROD_DIR)/*/.git
publish-docs: docs setup-temp-repo
@echo "\nPublishing docs ...\n"
@cd $(DOCS_PROD_DIR) && git push -f $(REPO) master:gh-pages
@make teardown-temp-repo
.PHONY: docs