forked from daggerml/cfn-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (57 loc) · 2.27 KB
/
Makefile
File metadata and controls
74 lines (57 loc) · 2.27 KB
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
SHELL = /bin/bash -o pipefail
VERSION = $(shell node version.js)
BRANCH = $(shell git symbolic-ref -q HEAD |grep ^refs/heads/ |cut -d/ -f3-)
DIRTY = $(shell git status --porcelain)
TAG_EXISTS = $(shell git ls-remote --tags |awk '{print $$2}' |grep ^refs/tags/ |cut -d/ -f3- |grep $(VERSION))
OBJS = index.js $(shell find lib/ -name '*.coffee' |sed 's@coffee$$@js@')
MAN1S = $(shell find man/ -name '*.tpl1' |sed 's@tpl1$$@1@')
MAN7S = $(shell find man/ -name '*.tpl7' |sed 's@tpl7$$@7@')
HTMLS = $(shell find man/ -name '*.tpl?' |sed 's@tpl.$$@html@')
YEAR = $(shell date +%Y)
.PHONY: all clean distclean compile docs test push
all: compile docs test
compile: $(OBJS)
docs: README.md $(MAN1S) $(MAN7S) $(HTMLS)
mkdir -p man/man1 man/man7
find man/ -maxdepth 1 -name '*.1' -exec cp -f {} man/man1 \;
find man/ -maxdepth 1 -name '*.7' -exec cp -f {} man/man7 \;
test:
npm test
clean:
rm -f $(OBJS)
distclean: clean
rm -f $(MAN1S) $(MAN7S) $(HTMLS)
find man -mindepth 2 -type f -exec rm -f {} \;
push: all
[ -n "$(VERSION)" ]
[ -z "$(DIRTY)" ]
[ -z "$(TAG_EXISTS)" ]
[ master = "$(BRANCH)" ]
git tag $(VERSION)
git push
git push --tags
# print variables (eg. make print-SHELL)
print-%:
@echo '$($*)'
%.js: %.coffee
npm run coffee -- --map --compile $<
%.md: %.tpl package-lock.json
VERSION=$(VERSION) YEAR=$(YEAR) envsubst '$${VERSION} $${YEAR}' < $< > $@
%.md: %.tpl1 package-lock.json
VERSION=$(VERSION) YEAR=$(YEAR) envsubst '$${VERSION} $${YEAR}' < $< > $@
%.md: %.tpl7 package-lock.json
VERSION=$(VERSION) YEAR=$(YEAR) envsubst '$${VERSION} $${YEAR}' < $< > $@
%.1: %.md package-lock.json
docker run --rm -v $(PWD):/app -w /app msoap/ruby-ronn \
ronn -r --pipe --manual 'CloudFormation Tools' \
--organization 'CloudFormation Tools $(VERSION)' $< > $@
%.7: %.md package-lock.json
docker run --rm -v $(PWD):/app -w /app msoap/ruby-ronn \
ronn -r --pipe --manual 'CloudFormation Tools' \
--organization 'CloudFormation Tools $(VERSION)' $< > $@
%.html: %.md man/cfn-tool.css package-lock.json
docker run --rm -v $(PWD):/app -w /app msoap/ruby-ronn \
ronn -5 --pipe --manual 'CloudFormation Tools' --style=/app/man/cfn-tool.css \
--organization 'CloudFormation Tools $(VERSION)' $< > $@
package-lock.json: package.json
npm install