make file includes:
- High-level, simple commands. Such as;
compile
start
stop
watch
, etc. - Managing project-specific environment variables. It should inclide
.env
file. - Development-mode that auto-compiles on change.
- Development-mode that shows compile error without verbosity around it.
- Project-specific GOPATH, so I can keep dependencies in
vendor
folder. - Simplified file watching. e.g
make watch run="go test ./..."
形成make的最终结果是:
1 | make |
makefile文件示例
环境设置:
1 | include .env |
命令部分的设置:
1 | # exec: Run given command, wrapped with custom GOPATH. e.g; make exec run="go test ./..." |
一些子命令的设置:
1 | compile: |
一些其他命令的设置:
1 | # clean: Clean build files. Runs `go clean` internally. |
help部分的设置
1 | help: Makefile |