Skip to content

Commit eb3d4f4

Browse files
committed
docs: improve makefile documentation and add usage help target
- Add comments to describe various make targets such as `build`, `install`, `test`, and different platform-specific builds. - Add a `help` target to print usage information for the makefile. Signed-off-by: appleboy <[email protected]>
1 parent 5f3cccf commit eb3d4f4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,42 @@ else
1717
endif
1818
COMMIT ?= $(shell git rev-parse --short HEAD)
1919

20+
## build: build the codegpt binary
2021
build: $(EXECUTABLE)
2122

2223
$(EXECUTABLE): $(GOFILES)
2324
$(GO) build -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o bin/$@ ./cmd/$(EXECUTABLE)
2425

26+
## install: install the codegpt binary
2527
install: $(GOFILES)
2628
$(GO) install -v -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)'
2729

30+
## test: run tests
2831
test:
2932
@$(GO) test -v -cover -coverprofile coverage.txt ./... && echo "\n==>\033[32m Ok\033[m\n" || exit 1
3033

34+
## build_linux_amd64: build the codegpt binary for linux amd64
3135
build_linux_amd64:
3236
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/amd64/$(EXECUTABLE) ./cmd/$(EXECUTABLE)
3337

38+
## build_linux_arm64: build the codegpt binary for linux arm64
3439
build_linux_arm64:
3540
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm64/$(EXECUTABLE) ./cmd/$(EXECUTABLE)
3641

42+
## build_linux_arm: build the codegpt binary for linux arm
3743
build_linux_arm:
3844
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/linux/arm/$(EXECUTABLE) ./cmd/$(EXECUTABLE)
3945

46+
## build_mac_intel: build the codegpt binary for mac intel
4047
build_mac_intel:
4148
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/mac/intel/$(EXECUTABLE) ./cmd/$(EXECUTABLE)
4249

50+
## build_windows_64: build the codegpt binary for windows 64
4351
build_windows_64:
4452
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build -a -tags '$(TAGS)' -ldflags '$(EXTLDFLAGS)-s -w $(LDFLAGS)' -o release/windows/intel/$(EXECUTABLE).exe ./cmd/$(EXECUTABLE)
53+
54+
## help: print this help message
55+
.PHONY: help
56+
help:
57+
@echo 'Usage:'
58+
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'

0 commit comments

Comments
 (0)