Latest version
You must have go 1.19 installed
go install github.com/Hand-of-Doom/gomake@latest
Create Gomakefile
in /path/to/folder
Then cd /path/to/folder
and run gomake
[foo@bar sample]$ pwd
/home/foo/sample
[foo@bar sample]$ ls
Gomakefile
[foo@bar sample]$ cat Gomakefile
sample:
echo "Hello from bash!"
out=go {
fmt.Println("Hello from go!")
}
echo "$out"
[foo@bar sample]$ gomake sample
go: creating new go.mod: module gomakegen
go: to add module requirements and sums:
go mod tidy
./sampletarget
Hello from bash!
Hello from go!
sample:
go {
import "github.com/google/uuid"
fmt.Println(uuid.NewString())
}
Then run gomake sample
You can use all the features of bash since targets are bash scripts
e.g. you can use multiline targets
sample:
echo "Hello, Gomake!"
echo "Next line"
echo "Next line"
It's just Makefile preprocessor
Gomakefile builds into a Makefile so you keep using make
It's definitely slower than make cause gomake builds each go statement every time
I can work on optimization but for now this is not my primary goal
No. Gomakefile targets are bash scripts
It's not compatible with Makefile
You will need to rewrite your code