Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tsavola/make-go
Artifact build system for Go projects
https://github.com/tsavola/make-go
build-system go
Last synced: about 23 hours ago
JSON representation
Artifact build system for Go projects
- Host: GitHub
- URL: https://github.com/tsavola/make-go
- Owner: tsavola
- License: bsd-3-clause
- Created: 2021-12-31T02:05:00.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-05T15:22:50.000Z (about 1 month ago)
- Last Synced: 2024-10-21T15:34:54.436Z (29 days ago)
- Topics: build-system, go
- Language: Go
- Homepage: https://import.name/make
- Size: 18.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[import.name/make](https://pkg.go.dev/import.name/make) is a build system where
you specify tasks by writing Go code. It is not intended for building Go code,
as the Go toolchain already has that covered. Instead, it can be used to build
non-Go artifacts of projects that already depend on the Go toolchain.Add file `make.go` to your project root:
```go
//go:build ignorepackage main
import (
. "import.name/make"
)func main() {
Main(targets,
"make.go", // These files are universal dependencies: if they
"go.mod", // are modified, all targets need to be rebuilt.
)
}func targets() (targets Tasks) {
var (
CC = Getvar("CC", "gcc")
)sources := Globber("src/*.c")
myTarget := targets.Add(Target("mytarget",
If(Outdated("mytarget", sources),
Command(CC, "-c", "-o", "example.o", sources),
Command(CC, "-o", "mytarget", "example.o"),
),
))// ...
return
}
```Build your project by invoking:
go run make.go
go run make.go mytarget
go run make.go mytarget another-target FOO=bar BAZ=quuxShow usage and list available targets and variables:
go run make.go -h
See a [practical example](https://github.com/gate-computer/gate/blob/main/make.go).