Skip to content

Commit cb514cb

Browse files
authored
chore: specify which targets are PHONY (#2049)
Previously, we had several targets that were just recipes names and did not produce any artifacts. Adding `.PHONY` ensures that these are names and not file targets, thus guarding against the albeit unlikely chance that there is a file added with the same name as the recipe. https://www.gnu.org/software/make/manual/make.html#Phony-Targets <!-- Provide summary of changes --> <!-- Issue number, if available. E.g. "Fixes #31", "Addresses #42, 77" --> By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 7971ee5 commit cb514cb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,30 @@ release-docker:
3838
docker rm -f amazon-ecs-copilot-builder
3939
@echo "Built binaries under ./local/"
4040

41+
.PHONY: compile-local
4142
compile-local:
4243
go build -ldflags "${LINKER_FLAGS}" -o ${DESTINATION} ./cmd/copilot
4344

45+
.PHONY: compile-windows
4446
compile-windows:
4547
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "${LINKER_FLAGS} ${RELEASE_BUILD_LINKER_FLAGS}" -o ${DESTINATION}.exe ./cmd/copilot
4648

49+
.PHONY: compile-linux
4750
compile-linux:
4851
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "${LINKER_FLAGS} ${RELEASE_BUILD_LINKER_FLAGS}" -o ${DESTINATION}-linux-amd64 ./cmd/copilot
4952
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "${LINKER_FLAGS} ${RELEASE_BUILD_LINKER_FLAGS}" -o ${DESTINATION}-linux-arm64 ./cmd/copilot
5053

54+
.PHONY: compile-darwin
5155
compile-darwin:
5256
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "${LINKER_FLAGS} ${RELEASE_BUILD_LINKER_FLAGS}" -o ${DESTINATION} ./cmd/copilot
5357

58+
.PHONY: packr-build
5459
packr-build: tools package-custom-resources
5560
@echo "Packaging static files" &&\
5661
env -i PATH="$$PATH":${GOBIN} GOCACHE=$$(go env GOCACHE) GOPATH=$$(go env GOPATH) \
5762
go generate ./...
5863

64+
.PHONY: packr-clean
5965
packr-clean: tools package-custom-resources-clean
6066
@echo "Cleaning up static files generated code" &&\
6167
cd templates &&\
@@ -65,6 +71,7 @@ packr-clean: tools package-custom-resources-clean
6571
.PHONY: test
6672
test: packr-build run-unit-test custom-resource-tests packr-clean
6773

74+
.PHONY: custom-resource-tests
6875
custom-resource-tests:
6976
@echo "Running custom resource unit tests" &&\
7077
cd ${SOURCE_CUSTOM_RESOURCES} &&\
@@ -74,6 +81,7 @@ custom-resource-tests:
7481
# Minifies the resources in cf-custom-resources/lib and copies
7582
# those minified assets into templates/custom-resources so that
7683
# they can be packed.
84+
.PHONY: package-custom-resources
7785
package-custom-resources:
7886
@echo "Packaging custom resources to templates/custom-resources" &&\
7987
cd ${SOURCE_CUSTOM_RESOURCES} &&\
@@ -82,13 +90,16 @@ package-custom-resources:
8290

8391
# We only need the minified custom resources during building. After
8492
# they're packed, we can remove them.
93+
.PHONY: package-custom-resources-clean
8594
package-custom-resources-clean:
8695
@echo "Removing minified templates/custom-resources" &&\
8796
rm ${BUILT_CUSTOM_RESOURCES}/*.js
8897

98+
.PHONY: run-unit-test
8999
run-unit-test:
90100
go test -race -cover -count=1 -coverprofile ${COVERAGE} ${PACKAGES}
91101

102+
.PHONY: generate-coverage
92103
generate-coverage: ${COVERAGE}
93104
go tool cover -html=${COVERAGE}
94105

@@ -97,6 +108,7 @@ ${COVERAGE}: test
97108
.PHONY: integ-test
98109
integ-test: packr-build run-integ-test packr-clean
99110

111+
.PHONY: run-integ-test
100112
run-integ-test:
101113
# These tests have a long timeout as they create and teardown CloudFormation stacks.
102114
# Also adding count=1 so the test results aren't cached.
@@ -126,6 +138,7 @@ start-docs:
126138
hugo server -D
127139

128140
# Build and minify the documentation to the docs/ directory.
141+
.PHONY: build-docs
129142
build-docs:
130143
cd ${SOURDE_DOCS} &&\
131144
git submodule update --init --recursive &&\

0 commit comments

Comments
 (0)