diff options
| author | EuAndreh <eu@euandre.org> | 2024-08-15 07:36:01 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2024-08-15 07:36:05 -0300 |
| commit | ebe6b2ae31145fd3534a0fb583410ce2cd8e8d69 (patch) | |
| tree | 87f8f9db7147bde3878665e192f3e0090707c111 | |
| parent | Makefile: Simplify a bit compile rule (diff) | |
| download | glaze-ebe6b2ae31145fd3534a0fb583410ce2cd8e8d69.tar.gz glaze-ebe6b2ae31145fd3534a0fb583410ce2cd8e8d69.tar.xz | |
Add src/version.go
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 17 | ||||
| -rw-r--r-- | src/glaze.go | 3 |
3 files changed, 15 insertions, 6 deletions
@@ -1,4 +1,5 @@ /*.bin +/src/version.go /src/*.a /src/*.bin /tests/*.a @@ -38,10 +38,12 @@ objects = \ sources = \ src/$(NAME).go \ + src/version.go \ src/main.go \ derived-assets = \ + src/version.go \ $(objects) \ src/main.bin \ tests/main.bin \ @@ -59,23 +61,28 @@ all: $(derived-assets) $(objects): Makefile -src/$(NAME).a: src/$(NAME).go +src/$(NAME).a: src/$(NAME).go src/version.go + go tool compile $(GOCFLAGS) -o $@ -p $(*F) -I $(@D) $*.go src/version.go + src/main.a: src/main.go src/$(NAME).a tests/main.a: tests/main.go tests/$(NAME).a -src/$(NAME).a src/main.a tests/main.a: +src/main.a tests/main.a: go tool compile $(GOCFLAGS) -o $@ -p $(*F) -I $(@D) $*.go -tests/$(NAME).a: tests/$(NAME).go src/$(NAME).go - go tool compile $(GOCFLAGS) -o $@ -p $(*F) $*.go src/$(*F).go +tests/$(NAME).a: tests/$(NAME).go src/$(NAME).go src/version.go + go tool compile $(GOCFLAGS) -o $@ -p $(*F) $*.go src/$(*F).go src/version.go src/main.bin: src/main.a tests/main.bin: tests/main.a src/main.bin tests/main.bin: - go tool link $(GOLDFLAGS) -o $@ -L $(@D) $*.a + go tool link $(GOLDFLAGS) -o $@ -L $(@D) --extldflags '$(LDLIBS)' $*.a $(NAME).bin: src/main.bin ln -fs $? $@ +src/version.go: Makefile + echo 'package $(NAME); var version = "$(VERSION)"' > $@ + tests.bin-check = \ diff --git a/src/glaze.go b/src/glaze.go index d0bc3e0..f5b2886 100644 --- a/src/glaze.go +++ b/src/glaze.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "io/fs" + "log/slog" "net" "net/http" "net/url" @@ -270,7 +271,7 @@ func start(listener net.Listener) { func Main() { - g.Init() + g.Init(slog.Group("versions", "gobang", g.Version, "this", version)) addr := parseArgs(os.Args) listener := listen(addr) start(listener) |
