Skip to content

Commit

Permalink
Merge pull request #40 from SUSE/make_tweaks
Browse files Browse the repository at this point in the history
Tweak Makefile to better support multiple modules
  • Loading branch information
rtamalin authored Jul 31, 2024
2 parents 593e2a5 + c788954 commit 311db56
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 18 deletions.
32 changes: 15 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
.DEFAULT_GOAL := build

.PHONY: fmt vet build clean test test-verbose
ifeq ($(MAKELEVEL),0)

fmt:
go fmt ./...

vet:
go vet ./...
.DEFAULT_GOAL := build

build: vet
go build ./...
SUBDIRS = \
. \
cmd/authenticator \
cmd/clientds \
cmd/generator \
examples/app

clean:
go clean
go clean -testcache
TARGETS = fmt vet build build-only clean test test-clean test-verbose tidy

test: build
go clean -testcache && go test -cover ./...
.PHONY: $(TARGETS)

test-verbose: build
go clean -testcache && go test -v -cover ./...
$(TARGETS):
$(foreach subdir, $(SUBDIRS), $(MAKE) -C $(subdir) $@;)
else
include Makefile.golang
endif
29 changes: 29 additions & 0 deletions Makefile.golang
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.DEFAULT_GOAL := build

.PHONY: fmt vet build build-only clean test-clean test-verbose

fmt:
go fmt ./...

vet:
go vet ./...

build-only:
go build ./...

build: vet build-only

clean: test-clean
go clean ./...

test-clean:
go clean -testcache

test: test-clean build
go test -cover ./...

test-verbose: test-clean build
go test -v -cover ./...

tidy:
go mod tidy
1 change: 1 addition & 0 deletions cmd/authenticator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
authenticator
1 change: 1 addition & 0 deletions cmd/authenticator/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.golang
1 change: 1 addition & 0 deletions cmd/clientds/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clientds
1 change: 1 addition & 0 deletions cmd/clientds/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.golang
1 change: 1 addition & 0 deletions cmd/generator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generator
1 change: 1 addition & 0 deletions cmd/generator/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.golang
1 change: 1 addition & 0 deletions examples/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
app
1 change: 1 addition & 0 deletions examples/app/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ../../Makefile.golang
3 changes: 2 additions & 1 deletion examples/app/go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
module github.com/SUSE/telemetry/examples/app

go 1.21.9
go 1.21

replace github.com/SUSE/telemetry => ../../

require github.com/SUSE/telemetry v0.0.0-00010101000000-000000000000

require (
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/mattn/go-sqlite3 v1.14.22 // indirect
github.com/xyproto/randomstring v1.0.5 // indirect
Expand Down
2 changes: 2 additions & 0 deletions examples/app/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
Expand Down

0 comments on commit 311db56

Please sign in to comment.