-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
149 lines (123 loc) · 3.83 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
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
# 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=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
# Target directory
TARGETDIR=$(CURRENTDIR)target
# Docker command
ifeq ($(DOCKER),)
DOCKER=docker
endif
# --- MAKE TARGETS ---
# Display general help about this command
.PHONY: help
help:
@echo ""
@echo "VariantKey Makefile."
@echo "The following commands are available:"
@echo ""
@echo " make c : Build and test the C version"
@echo " make go : Build and test the GO version"
@echo " make javascript : Build and test the Javascript version"
@echo " make python : Build and test the Python version"
@echo " make python-class : Build and test the Python wrapper class"
@echo " make r : Build and test the R version"
@echo " make clean : Remove any build artifact"
@echo " make dbuild : Build everything inside a Docker container"
@echo " make tag : Tag the Git repository"
@echo ""
all: c go javascript python python-class r
# Build and test the C version
.PHONY: c
c:
cd c && make all
# 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
# 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