-
Notifications
You must be signed in to change notification settings - Fork 279
/
Makefile
98 lines (77 loc) · 2.7 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
92
93
94
95
96
97
98
SHELL ?= sh
PREFIX ?= /usr/local
CRAM_OPTS ?= -v
PROJECT ?= $(CURDIR)
BIN ?= ${PROJECT}/bin
SRC ?= ${PROJECT}/src
TESTS ?= ${PROJECT}/tests
TOOLS ?= ${PROJECT}/tools
ZSH_VERSION ?= zsh-5.3
CONTAINER_ROOT ?= /antigen
USE_CONTAINER ?= docker
CONTAINER_IMAGE ?= desyncr/zsh-docker-
TARGET ?= ${BIN}/antigen.zsh
SRC ?= ${SRC}
GLOB ?= ${SRC}/boot.zsh ${SRC}/antigen.zsh $(sort $(wildcard ${PWD}/src/helpers/*.zsh)) \
${SRC}/lib/*.zsh $(sort $(wildcard ${PWD}/src/commands/*.zsh)) \
${SRC}/_antigen
VERSION ?= develop
VERSION_FILE = ${PROJECT}/VERSION
BANNER_SEP =$(shell printf '%*s' 70 | tr ' ' '\#')
BANNER_TEXT =This file was autogenerated by \`make\`. Do not edit it directly!
BANNER =${BANNER_SEP}\n\# ${BANNER_TEXT}\n${BANNER_SEP}\n
define ised
sed $(1) $(2) > "$(2).1"
mv "$(2).1" "$(2)"
endef
.PHONY: itests tests install all
build:
@echo Building Antigen...
@printf "${BANNER}" > ${BIN}/antigen.zsh
@for src in ${GLOB}; do echo "----> $$src"; cat "$$src" >> ${TARGET}; done
@echo "${VERSION}" > ${VERSION_FILE}
@$(call ised,"s/{{ANTIGEN_VERSION}}/$$(cat ${VERSION_FILE})/",${TARGET})
@echo Done.
@ls -sh ${TARGET}
release:
git checkout develop
${MAKE} build tests
git checkout -b release/${VERSION}
# Update changelog
${EDITOR} CHANGELOG.md
# Build release commit
git add CHANGELOG.md ${VERSION_FILE} README.mkd ${TARGET}
git commit -S -m "Build release ${VERSION}"
publish:
git push origin release/${VERSION}
# Merge release branch into develop before deploying
deploy:
git checkout develop
git tag -m "Build release ${VERSION}" -s ${VERSION}
git archive --output=${VERSION}.tar.gz --prefix=antigen-$$(echo ${VERSION}|sed s/v//)/ ${VERSION}
zcat ${VERSION}.tar.gz | gpg --armor --detach-sign >${VERSION}.tar.gz.sign
# Verify signature
zcat ${VERSION}.tar.gz | gpg --verify ${VERSION}.tar.gz.sign -
# Push upstream
git push upstream ${VERSION}
.container:
ifeq (${USE_CONTAINER}, docker)
@docker run --rm --privileged=true -it -v ${PROJECT}:/antigen ${CONTAINER_IMAGE}${ZSH_VERSION} $(shell echo "${COMMAND}" | sed "s|${PROJECT}|${CONTAINER_ROOT}|g")
else ifeq (${USE_CONTAINER}, no)
${COMMAND}
endif
info:
@${MAKE} .container COMMAND="sh -c 'cat ${PROJECT}/VERSION; zsh --version; git --version; env'"
itests:
@${MAKE} tests CRAM_OPTS=-i
tests:
@${MAKE} .container COMMAND="sh -c 'ZDOTDIR=${TESTS} ANTIGEN=${PROJECT} cram ${CRAM_OPTS} --shell=zsh ${TESTS}'"
stats:
@${MAKE} .container COMMAND="${TOOLS}/stats --zsh zsh --antigen ${PROJECT}"
install:
mkdir -p ${PREFIX}/share && cp ${TARGET} ${PREFIX}/share/antigen.zsh
clean:
rm -f ${PREFIX}/share/antigen.zsh
install-deps:
sudo pip install cram=='0.6.*'
all: clean build install