2 -> 3
[storage-units.git] / Makefile
blobdff646b37941d1dbde944b42972b43a677bc8d4e
1 # http://www.gnu.org/software/make/manual/make.html
2 # https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html#Makefile-Basics
3 # http://clarkgrubb.com/makefile-style-guide
5 ############
6 # PROLOGUE #
7 ############
8 MAKEFLAGS += --warn-undefined-variables
9 SHELL = /bin/sh
10 .SHELLFLAGS := -eu -o pipefail -c
11 .DEFAULT_GOAL := all
12 .DELETE_ON_ERROR:
13 .SUFFIXES:
15 ######################
16 # INTERNAL VARIABLES #
17 ######################
18 TIMESTAMP := $(shell /bin/date "+%Y%m%d%H%M%S")
19 USERID := $(shell id -u)
20 GREEN := $(shell tput -Txterm setaf 2)
21 WHITE := $(shell tput -Txterm setaf 7)
22 YELLOW := $(shell tput -Txterm setaf 3)
23 RESET := $(shell tput -Txterm sgr0)
25 ######################
26 # INTERNAL FUNCTIONS #
27 ######################
28 HELP_FUN = \
29 %help; \
30 while(<>) { push @{$$help{$$2 // 'targets'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
31 print "usage: make [target]\n\n"; \
32 for (sort keys %help) { \
33 print "${WHITE}$$_:${RESET}\n"; \
34 for (@{$$help{$$_}}) { \
35 $$sep = " " x (32 - length $$_->[0]); \
36 print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
37 }; \
38 print "\n"; }
40 ###############
41 # GOALS/RULES #
42 ###############
43 .PHONY: all
44 all: help
46 help: ##@other Show this help
47 @perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
49 .PHONY: sonar-analysis
50 sonar-analysis: ##@sebhoss Perform Sonarqube analysis
51 # http://docs.sonarqube.org/display/SONAR/Analyzing+with+Maven
52 mvn clean install
53 mvn sonar:sonar -Dsonar.host.url=http://localhost:59000 -Dsonar.pitest.mode=reuseReport
55 .PHONY: sign-waiver
56 sign-waiver: ##@contributing Sign the WAIVER
57 gpg2 --no-version --armor --sign AUTHORS/WAIVER
59 .PHONY: docker-verify
60 docker-verify: ##@docker Verify project in pre-defined build environment
61 docker-compose -f build/docker/build-environment.yml run --rm verify-project
62 # since we are 'root' inside the container, we need another container run to cleanup after ourselves
63 docker-compose -f build/docker/build-environment.yml run --rm clean-project
64 # findbugs likes to create these
65 rm -rf ?/
67 .PHONY: update-parent
68 update-parent: ##@maintenance Updates the Maven parent to its latest version
69 mvn versions:update-parent -U -DgenerateBackupPoms=false
70 git add pom.xml
71 git commit pom.xml -s -S -m 'Update to latest parent'
73 .PHONY: update-maintenance-badge
74 update-maintenance-badge: ##@maintenance Updates the maintenance badge to the current year
75 sed -i -e "s/maintenance\/yes\/[0-9]*/maintenance\/yes\/$(CURRENT_YEAR)/" README.asciidoc
76 git add README.asciidoc
77 git commit pom.xml -s -S -m 'Update maintenance badge'
79 .PHONY: release-into-local-nexus
80 release-into-local-nexus: ##@release Release all artifacts into a local nexus
81 mvn clean deploy scm:tag -Prelease -Drevision=$(TIMESTAMP) -DpushChanges=false -DskipLocalStaging=true -Drelease=local
83 .PHONY: release-into-sonatype-nexus
84 release-into-sonatype-nexus: ##@release Release all artifacts into Maven Central (through Sonatype OSSRH)
85 mvn clean deploy scm:tag -Prelease -Drevision=$(TIMESTAMP) -DpushChanges=false -Drelease=sonatype
86 git push --tags origin master