13544: Removing packages-with-versions target in Makefile. Consolidated in packages
[arvados-workbench2.git] / Makefile
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 APP_NAME?=arvados-workbench2
6
7 # GIT_TAG is the last tagged stable release (i.e. 1.2.0)
8 GIT_TAG?=$(shell git describe --abbrev=0)
9
10 # TS_GIT is the timestamp in the current directory (i.e. 1528815021).
11 # Note that it will only change if files change.
12 TS_GIT?=$(shell git log -n1 --first-parent "--format=format:%ct" .)
13
14 # DATE_FROM_TS_GIT is the human(ish)-readable version of TS_GIT
15 # 1528815021 -> 20180612145021
16 DATE_FROM_TS_GIT?=$(shell date -ud @$(TS_GIT) +%Y%m%d%H%M%S)
17
18 # VERSION uses all the above to produce X.Y.Z.timestamp
19 # something in the lines of 1.2.0.20180612145021, this will be the package version
20 # it can be overwritten when invoking make as in make packages VERSION=1.2.0
21 VERSION?=$(GIT_TAG).$(DATE_FROM_TS_GIT)
22
23 # ITERATION is the package iteration, intended for manual change if anything non-code related
24 # changes in the package. (i.e. example config files externally added
25 ITERATION?=1
26
27 DESCRIPTION=Arvados Workbench2 - Arvados is a free and open source platform for big data science.
28 MAINTAINER=Ward Vandewege <wvandewege@veritasgenetics.com>
29
30 # DEST_DIR will have the build package copied.
31 DEST_DIR=/var/www/arvados-workbench2/workbench2/
32
33 export WORKSPACE?=$(shell pwd)
34
35 .PHONY: help clean* yarn-install test build packages packages-with-version 
36
37 help:
38         @echo >&2
39         @echo >&2 "There is no default make target here.  Did you mean 'make test'?"
40         @echo >&2
41         @echo >&2 "More info:"
42         @echo >&2 "  Installing              --> http://doc.arvados.org/install"
43         @echo >&2 "  Developing/contributing --> https://dev.arvados.org"
44         @echo >&2 "  Project home            --> https://arvados.org"
45         @echo >&2
46         @false
47
48 clean-deb:
49         rm -f $(WORKSPACE)/*.deb
50
51 clean-rpm:
52         rm -f $(WORKSPACE)/*.rpm
53
54 clean-node-modules:
55         rm -rf $(WORKSPACE)/node_modules
56
57 clean: clean-rpm clean-deb clean-node-modules
58
59 yarn-install:
60         yarn install
61
62 test: yarn-install
63         yarn test       --no-watchAll --bail --ci
64
65 build: yarn-install test
66         yarn build
67
68 # use FPM to create DEB and RPM
69 packages: build
70         fpm \
71          -s dir \
72          -t deb \
73          -n "$(APP_NAME)" \
74          -v "$(VERSION)" \
75          --iteration "$(ITERATION)" \
76          --maintainer="$(MAINTAINER)" \
77          --description="$(DESCRIPTION)" \
78          --deb-no-default-config-files \
79         $(WORKSPACE)/build/=DEST_DIR
80         fpm \
81          -s dir \
82          -t rpm \
83          -n "$(APP_NAME)" \
84          -v "$(VERSION)" \
85          --iteration "$(ITERATION)" \
86          --maintainer="$(MAINTAINER)" \
87          --description="$(DESCRIPTION)" \
88          $(WORKSPACE)/build/=DEST_DIR