diff --git a/Makefile b/Makefile index a6f8081..dadc8b6 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,12 @@ UNAME_S := $(shell uname -s) BINARY_NAME := robotfs .PHONY: all -all: proto build +all: deps proto build + +.PHONY: deps +deps: + @echo "Installing project dependencies..." + go install . .PHONY: proto proto: @@ -21,7 +26,7 @@ proto: protoc --go_out=. --go_opt=paths=source_relative pb/*.proto .PHONY: build -build: +build: deps proto ifeq ($(UNAME_S),Darwin) @echo "Building for MacOS..." GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $(BINARY_NAME) ./ @@ -31,7 +36,7 @@ else endif .PHONY: build-linux -build-linux: +build-linux: deps proto @echo "Building for Linux..." GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o $(BINARY_NAME) ./ @@ -44,7 +49,8 @@ clean: help: @echo "Available targets:" @echo " all - Generate protobuf files and build for current platform (default)" + @echo " deps - Install project dependencies" @echo " proto - Generate protobuf files" @echo " build - Build for current platform" - @echo " build-linux - Build for linux platform" + @echo " build-linux - Build for linux platform" @echo " clean - Remove built binaries and generated protobuf files" diff --git a/README.md b/README.md index 2689b73..8397080 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,7 @@ RobotFS 是一个轻量级的文件系统服务,提供用于管理文件和目 ### 编译步骤 -1. 生成 Protocol Buffers 文件 -```bash -make proto -``` - -2. 编译项目 +1. 编译项目 - 在当前平台编译: ```bash make build @@ -32,7 +27,7 @@ make build make build-linux ``` -3. 清理编译文件 +2. 清理编译文件 ```bash make clean ```