Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hand-of-doom/gomake
Run golang code in Makefile and use all the features of bash & multiline targets support
https://github.com/hand-of-doom/gomake
code-generator compiler go linux makefile-generator makefile-syntax
Last synced: 5 days ago
JSON representation
Run golang code in Makefile and use all the features of bash & multiline targets support
- Host: GitHub
- URL: https://github.com/hand-of-doom/gomake
- Owner: Hand-of-Doom
- License: bsd-3-clause
- Created: 2022-11-06T17:46:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-30T12:46:57.000Z (almost 2 years ago)
- Last Synced: 2024-06-21T09:03:08.164Z (5 months ago)
- Topics: code-generator, compiler, go, linux, makefile-generator, makefile-syntax
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GO in your Makefile
## Installation
Latest version\
You must have go 1.19 installed
```console
go install github.com/Hand-of-Doom/gomake@latest
```## How to use
Create `Gomakefile` in /path/to/folder\
Then `cd /path/to/folder` and run `gomake`
```console
[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!
```## Using golang libraries
```makefile
sample:
go {
import "github.com/google/uuid"
fmt.Println(uuid.NewString())
}
```
Then run `gomake sample`## Full bash support
You can use all the features of bash since targets are bash scripts\
e.g. you can use multiline targets
```makefile
sample:
echo "Hello, Gomake!"
echo "Next line"
echo "Next line"
```## How it works?
It's just Makefile preprocessor\
Gomakefile builds into a Makefile so you keep using make## Problems
### Is it slow?
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
### Is it Makefile compatible?
No. Gomakefile targets are bash scripts\
It's not compatible with Makefile\
You will need to rewrite your code