md -> asciidoc
[fiscal-year.java.git] / Makefile
blob317d41eeccdeff169f733ee7d67f18fca0d730aa
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: release-into-local-nexus
74 release-into-local-nexus: ##@release Release all artifacts into a local nexus
75 mvn clean deploy scm:tag -Prelease -Drevision=$(TIMESTAMP) -DpushChanges=false -DskipLocalStaging=true -Drelease=local
77 .PHONY: release-into-sonatype-nexus
78 release-into-sonatype-nexus: ##@release Release all artifacts into Maven Central (through Sonatype OSSRH)
79 mvn clean deploy scm:tag -Prelease -Drevision=$(TIMESTAMP) -DpushChanges=false -Drelease=sonatype
80 git push --tags origin master