-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
163 lines (134 loc) · 4.03 KB
/
Copy pathMakefile
File metadata and controls
163 lines (134 loc) · 4.03 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# MAKEFILE
#
# @author Nicola Asuni <info@tecnick.com>
# @link https://github.com/tecnickcom/variantkey
# ------------------------------------------------------------------------------
SHELL=/bin/bash
.SHELLFLAGS=-o pipefail -c
# Project owner
OWNER=Tecnick.com
# Project vendor
VENDOR=tecnickcom
# Lowercase VENDOR name for Docker
LCVENDOR=$(shell echo "${VENDOR}" | tr '[:upper:]' '[:lower:]')
# CVS path (path to the parent dir containing the project)
CVSPATH=github.com/${VENDOR}
# Project name
PROJECT=variantkey
# Project version
VERSION=$(shell cat VERSION)
# Project release number (packaging build number)
RELEASE=$(shell cat RELEASE)
# Current directory
CURRENTDIR=$(CURDIR)/
# Target directory
TARGETDIR=target
# Docker command
ifeq ($(DOCKER),)
DOCKER=docker
endif
# --- MAKE TARGETS ---
.PHONY: help
help:
@echo ""
@echo "$(PROJECT) Makefile."
@echo "The following commands are available:"
@echo ""
@awk '/^## /{desc=substr($$0,4)} /^\.PHONY:/{if(NF>1) {target=$$2; if(desc) printf " make %-15s: %s\n",target,desc; desc=""}}' Makefile
@echo ""
all: c go javascript python python-class r
## Build and test the C version
.PHONY: c
c:
cd c && make all
## Import the binsearch header, tests and test data from the upstream repository
.PHONY: binsearch
binsearch:
cd c && make binsearch
## Build and test the GO version
.PHONY: go
go:
cd go && make all
## Build and test the Javascript version
.PHONY: javascript
javascript:
cd javascript && make all
## Build and test the Python version
.PHONY: python
python:
cd python && make all
## Build and test the Python wrapper class
.PHONY: python-class
python-class:
cd python-class && make all
## Build and test the R version
.PHONY: r
r:
cd r && make all
## Run the unit tests of every language version
.PHONY: test
test:
# NOTE: the python, python-class and r versions need their environment to be
# provisioned first ("make venv" / renv::restore), which is what the
# per-language "all" targets do. Use "make all" for a cold checkout.
cd c && make test
cd go && make test
cd javascript && make test
cd python && make test
cd python-class && make test
cd r && make test
## Remove any build artifact
.PHONY: clean
clean:
rm -rf target
cd c && make clean
cd go && make clean
cd javascript && make clean
cd python && make clean
cd python-class && make clean
cd r && make clean
## Build everything inside a Docker container
.PHONY: dbuild
dbuild: dockerdev
@mkdir -p "$(TARGETDIR)"
@rm -rf "$(TARGETDIR)/"*
@echo 0 > "$(TARGETDIR)/make.exit"
CVSPATH=$(CVSPATH) VENDOR=$(LCVENDOR) PROJECT=$(PROJECT) MAKETARGET='$(MAKETARGET)' "$(CURRENTDIR)dockerbuild.sh"
@exit `cat $(TARGETDIR)/make.exit`
## Build a base development Docker image
.PHONY: dockerdev
dockerdev:
$(DOCKER) build --pull --tag "${LCVENDOR}/dev_${PROJECT}" --file ./resources/docker/Dockerfile.dev ./resources/docker/
## Publish Documentation in GitHub (requires writing permissions)
.PHONY: pubdocs
pubdocs:
rm -rf ./target/DOCS
rm -rf ./target/gh-pages
mkdir -p ./target/DOCS/c
cp -r ./c/target/build/doc/html/* ./target/DOCS/c/
# mkdir -p ./target/DOCS/go
# cp -r ./go/target/docs/* ./target/DOCS/go/
# mkdir -p ./target/DOCS/python
# cp -r ./python/target/doc/variantkey.html ./target/DOCS/python/
# mkdir -p ./target/DOCS/python-class
# cp -r ./python-class/target/doc/*.html ./target/DOCS/python-class/
# mkdir -p ./target/DOCS/r
# cp -r ./r/variantkey/docs/* ./target/DOCS/r/
# cp ./resources/doc/index.html ./target/DOCS/
git clone git@github.com:tecnickcom/variantkey.git ./target/gh-pages
cd target/gh-pages && git checkout gh-pages
mv -f ./target/gh-pages/.git ./target/DOCS/
rm -rf ./target/gh-pages
cd ./target/DOCS/ && \
git add . -A && \
git commit -m 'Update documentation' && \
git push origin gh-pages --force
## Tag the Git repository
.PHONY: tag
tag:
git tag -a "v$(VERSION)" -m "Version $(VERSION)" && \
git push origin --tags
## Increase the patch number in the VERSION file
.PHONY: versionup
versionup:
echo ${VERSION} | gawk -F. '{printf("%d.%d.%d\n",$$1,$$2,(($$3+1)));}' > VERSION