|
1 | | -.ONESHELL:# single shell invocation for all lines in the recipe |
| 1 | +SHELL := bash# we want bash behaviour in all shell invocations |
2 | 2 |
|
3 | 3 | .DEFAULT_GOAL = help |
4 | 4 |
|
5 | 5 | ### VARIABLES ### |
6 | 6 | # |
7 | | -export PATH :=$(CURDIR):$(CURDIR)/scripts:$(PATH) |
8 | | -OS := $(shell uname -s | tr '[:upper:]' '[:lower:]') |
9 | | -HARDWARE := $(shell uname -m | tr '[:upper:]' '[:lower:]') |
10 | | -GPG_KEYNAME := $(shell cat pom.xml | grep -oPm1 "(?<=<gpg.keyname>)[^<]+") |
| 7 | +export PATH := $(CURDIR):$(CURDIR)/scripts:$(PATH) |
| 8 | + |
| 9 | +OS := $$(uname -s | tr '[:upper:]' '[:lower:]') |
| 10 | +HARDWARE := $$(uname -m | tr '[:upper:]' '[:lower:]') |
| 11 | + |
| 12 | +GPG_KEYNAME := $$(awk -F'[<>]' '/<gpg.keyname>/ { print $$3 }' pom.xml) |
| 13 | + |
| 14 | +RELEASE_VERSION ?= 2.3.0 |
11 | 15 |
|
12 | 16 | ### TARGETS ### |
13 | 17 | # |
14 | 18 |
|
| 19 | +.PHONY: binary |
15 | 20 | binary: clean ## Build the binary distribution |
16 | 21 | @mvnw package -P assemblies -Dgpg.skip=true -Dmaven.test.skip |
17 | 22 |
|
| 23 | +.PHONY: native-image |
18 | 24 | native-image: clean ## Build the native image |
19 | 25 | @mvnw -q package -DskipTests -P native-image -P '!java-packaging' |
20 | 26 | native-image -jar target/perf-test.jar -H:Features="com.rabbitmq.perf.NativeImageFeature" |
21 | 27 |
|
| 28 | +.PHONY: docker-image |
| 29 | +docker-image: ## Build Docker image |
| 30 | + @docker build \ |
| 31 | + --tag pivotalrabbitmq/perf-test:$(RELEASE_VERSION) \ |
| 32 | + --tag pivotalrabbitmq/perf-test:latest \ |
| 33 | + --build-arg perf_test_version=$(RELEASE_VERSION) . |
22 | 34 |
|
| 35 | +.PHONY: package-native-image |
23 | 36 | package-native-image: native-image ## Package the native image |
24 | 37 | cp perf-test target/perf-test_$(OS)_$(HARDWARE) |
25 | 38 | @mvnw -q checksum:files -P native-image |
26 | 39 | gpg --armor --local-user $(GPG_KEYNAME) --detach-sign target/perf-test_$(OS)_$(HARDWARE) |
27 | 40 |
|
| 41 | +.PHONY: help |
28 | 42 | help: |
29 | | - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
| 43 | + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-24s\033[0m %s\n", $$1, $$2}' |
30 | 44 |
|
| 45 | +.PHONY: clean |
31 | 46 | clean: ## Clean all build artefacts |
32 | 47 | @mvnw clean |
33 | 48 |
|
| 49 | +.PHONY: compile |
34 | 50 | compile: ## Compile the source code |
35 | 51 | @mvnw compile |
36 | 52 |
|
| 53 | +.PHONY: install |
37 | 54 | install: clean ## Create and copy the binaries into the local Maven repository |
38 | 55 | @mvnw install -Dmaven.test.skip |
39 | 56 |
|
| 57 | +.PHONY: jar |
40 | 58 | jar: clean ## Build the JAR file |
41 | 59 | @mvnw package -Dmaven.test.skip |
42 | 60 |
|
| 61 | +.PHONY: run |
43 | 62 | run: compile ## Run PerfTest, pass exec arguments via ARGS, e.g. ARGS="-x 1 -y 1 -r 1" |
44 | 63 | @mvnw exec:java -Dexec.mainClass="com.rabbitmq.perf.PerfTest" -Dexec.args="$(ARGS)" |
45 | 64 |
|
| 65 | +.PHONY: signed-binary |
46 | 66 | signed-binary: clean ## Build a GPG signed binary |
47 | 67 | @mvnw package -P assemblies |
48 | 68 |
|
| 69 | +.PHONY: doc |
49 | 70 | doc: ## Generate PerfTest documentation |
50 | 71 | @mvnw asciidoctor:process-asciidoc |
51 | | - |
52 | | -.PHONY: binary help clean compile jar run signed-binary |
|
0 commit comments