Redesign of GNU Make (Makefile) oriented towards project management and command uniformisation among all your projects.
When working in an microservice environment with multiple languages and/or frameworks it is sometimes hard to switch between command sets. This is why I have created gomake to help better manage running commands between projects
- Works on windows
- Bash commands are executed in the same context ( no more single line linked commands - ending in ;\ )
- Clearer settings file
- Different declaration of variables and environment variables.
- Uses only the cli you choose, no more Make extras
Go project
targets:
run: go run /path/to/package
Ruby on rails project:
targets:
run: rails -s -b 0.0.0.0 -p 3000
PHP:
targets:
run: php -S localhost:8000
If you have golang installed (and GOBIN is added to your path):
go get github.com/efimovalex/gomake
wget https://github.com/efimovalex/gomake/releases/download/v1.0.0/gomake_1.0.0_Linux_x86_64.tar.gz
tar -C /usr/local -xzf gomake_1.0.0_Linux_x86_64.tar.gz
brew tap efimovalex/gomake
brew install efimovalex/gomake/gomake
Download the exe file for your system from the latest release and unarchive it to your C:\Windows
folder in order to be accesible from everywhere in the system.
You can create an alias to remove de .exe
ending by running in PowerShell:
Set-Alias -Name gomake -Value C:\Windows\gomake.exe
You can provide you own file with the -file=path/to/makefile.yml
Point to the CLI you want to use: bash
,sh
and for windows cmd
, powershell
and bash
(bash.exe
if you have wsl)
cli: bash
vars:
buildCmd: go build -ldflags "-X main.BuildName=${package_name} -X main.BuildVersion=${version}"
package_name: pkg
package: pkg
GOARCH: amd64
version: "1.0.0"
targets:
build_darwin: env GOOS=darwin GOARCH=${GOARCH} ${buildCmd} -o ${package_name}_v${version}_darwin_amd64 ${package}
build_windows: env GOOS=windows GOARCH=${GOARCH} ${buildCmd} -o ${package_name}_v${version}_windows_amd64.exe ${package}
build_linux: env GOOS=linux GOARCH=${GOARCH} ${buildCmd} -o ${package_name}_v${version}_linux_amd64 ${package}
Define env variables that are loaded only for the purpose of your project isolated from your current environment
cli: bash
vars:
package_name: pkg
package: pkg
version: "1.0.0"
buildCmd: go build -ldflags "-X main.BuildName=${package_name} -X main.BuildVersion=${version}"
env:
GOARCH: amd64
targets:
build_darwin: env GOOS=darwin ${buildCmd} -o ${package_name}_v${version}_darwin_amd64 ${package}
build_windows: env GOOS=windows ${buildCmd} -o ${package_name}_v${version}_windows_amd64.exe ${package}
build_linux: env GOOS=linux ${buildCmd} -o ${package_name}_v${version}_linux_amd64 ${package}
targets:
build_darwin: env GOOS=darwin ${buildCmd} -o ${package_name}_v${version}_darwin_amd64 ${package}
build_windows: env GOOS=windows ${buildCmd} -o ${package_name}_v${version}_windows_amd64.exe ${package}
build_linux: env GOOS=linux ${buildCmd} -o ${package_name}_v${version}_linux_amd64 ${package}
gomake build_darwin
If the target is not found/defined you will get an error message saying: no target found for {target}
If you are working in an multi os team, you could define a separate file for windows users and provide that file on windows machines which should contain the same targets but defined as windows commands.
gomake -f makefile_win.yml