Skip to content

Commit f633474

Browse files
committed
Define phony targets in situ
Having a list of phonies at the end of the Makefile makes it easy to miss adding a new phony when a target gets defined. Also, when the list of targets grows, it's more difficult to manage phonies. We are defining a target as phony just above the target definition - this keeps things close.
1 parent c9f7fa5 commit f633474

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ GPG_KEYNAME := $$(awk -F'[<>]' '/<gpg.keyname>/ { print $$3 }' pom.xml)
1414
### TARGETS ###
1515
#
1616

17+
.PHONY: binary
1718
binary: clean ## Build the binary distribution
1819
@mvnw package -P assemblies -Dgpg.skip=true -Dmaven.test.skip
1920

21+
.PHONY: native-image
2022
native-image: clean ## Build the native image
2123
@mvnw -q package -DskipTests -P native-image -P '!java-packaging'
2224
native-image -jar target/perf-test.jar -H:Features="com.rabbitmq.perf.NativeImageFeature"
@@ -28,33 +30,40 @@ docker-image:
2830
docker build --build-arg perf_test_distribution=rabbitmq-perf-test-$(RELEASE_VERSION) -t pivotalrabbitmq/perf-test:$(RELEASE_VERSION) -t pivotalrabbitmq/perf-test:latest .
2931
rm -rf rabbitmq-perf-test-$(RELEASE_VERSION)*
3032

33+
.PHONY: package-native-image
3134
package-native-image: native-image ## Package the native image
3235
cp perf-test target/perf-test_$(OS)_$(HARDWARE)
3336
@mvnw -q checksum:files -P native-image
3437
gpg --armor --local-user $(GPG_KEYNAME) --detach-sign target/perf-test_$(OS)_$(HARDWARE)
3538

39+
.PHONY: help
3640
help:
3741
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
3842

43+
.PHONY: clean
3944
clean: ## Clean all build artefacts
4045
@mvnw clean
4146

47+
.PHONY: compile
4248
compile: ## Compile the source code
4349
@mvnw compile
4450

51+
.PHONY: install
4552
install: clean ## Create and copy the binaries into the local Maven repository
4653
@mvnw install -Dmaven.test.skip
4754

55+
.PHONY: jar
4856
jar: clean ## Build the JAR file
4957
@mvnw package -Dmaven.test.skip
5058

59+
.PHONY: run
5160
run: compile ## Run PerfTest, pass exec arguments via ARGS, e.g. ARGS="-x 1 -y 1 -r 1"
5261
@mvnw exec:java -Dexec.mainClass="com.rabbitmq.perf.PerfTest" -Dexec.args="$(ARGS)"
5362

63+
.PHONY: signed-binary
5464
signed-binary: clean ## Build a GPG signed binary
5565
@mvnw package -P assemblies
5666

67+
.PHONY: doc
5768
doc: ## Generate PerfTest documentation
5869
@mvnw asciidoctor:process-asciidoc
59-
60-
.PHONY: binary help clean compile jar run signed-binary

0 commit comments

Comments
 (0)