Minor updates for Makefiles

This commit is contained in:
Thomas Roehl 2022-05-25 15:45:21 +02:00
parent 132ebabd45
commit ad5dbd85ea
2 changed files with 16 additions and 13 deletions

View File

@ -16,20 +16,23 @@ COMPONENT_DIRS := collectors \
internal/multiChanTicker internal/multiChanTicker
BINDIR = bin BINDIR = bin
GOBIN = $(shell which go)
.PHONY: all .PHONY: all
all: $(APP) all: $(APP)
$(APP): $(GOSRC) $(APP): $(GOSRC)
make -C collectors if [ "$(shell $(GOBIN) version | cut -d' ' -f 3 | cut -d '.' -f1-2)" == "go1.16" ]; then \
if [ "$(shell go version | cut -d' ' -f 3 | cut -d '.' -f1-2)" == "go1.16" ]; then \ echo "1.16"; \
cp go.mod.1.16 go.mod; \ cp go.mod.1.16 go.mod; \
else \ else \
echo "1.17+"; \
cp go.mod.1.17+ go.mod; \ cp go.mod.1.17+ go.mod; \
fi fi
go get make -C collectors
go build -o $(APP) $(GOSRC_APP) $(GOBIN) get
$(GOBIN) build -o $(APP) $(GOSRC_APP)
install: $(APP) install: $(APP)
@WORKSPACE=$(PREFIX) @WORKSPACE=$(PREFIX)
@ -56,25 +59,25 @@ clean:
.PHONY: fmt .PHONY: fmt
fmt: fmt:
go fmt $(GOSRC_COLLECTORS) $(GOBIN) fmt $(GOSRC_COLLECTORS)
go fmt $(GOSRC_SINKS) $(GOBIN) fmt $(GOSRC_SINKS)
go fmt $(GOSRC_RECEIVERS) $(GOBIN) fmt $(GOSRC_RECEIVERS)
go fmt $(GOSRC_APP) $(GOBIN) fmt $(GOSRC_APP)
@for F in $(GOSRC_INTERNAL); do go fmt $$F; done @for F in $(GOSRC_INTERNAL); do $(GOBIN) fmt $$F; done
# Examine Go source code and reports suspicious constructs # Examine Go source code and reports suspicious constructs
.PHONY: vet .PHONY: vet
vet: vet:
go vet ./... $(GOBIN) vet ./...
# Run linter for the Go programming language. # Run linter for the Go programming language.
# Using static analysis, it finds bugs and performance issues, offers simplifications, and enforces style rules # Using static analysis, it finds bugs and performance issues, offers simplifications, and enforces style rules
.PHONY: staticcheck .PHONY: staticcheck
staticcheck: staticcheck:
go install honnef.co/go/tools/cmd/staticcheck@latest $(GOBIN) install honnef.co/go/tools/cmd/staticcheck@latest
$$(go env GOPATH)/bin/staticcheck ./... $$($(GOBIN) env GOPATH)/bin/staticcheck ./...
.ONESHELL: .ONESHELL:
.PHONY: RPM .PHONY: RPM

View File

@ -1,6 +1,6 @@
# LIKWID version # LIKWID version
LIKWID_VERSION = 5.2.1 LIKWID_VERSION = 5.2.1
LIKWID_INSTALLED_FOLDER=$(shell dirname $(shell which likwid-topology 2>/dev/null)) LIKWID_INSTALLED_FOLDER=$(shell dirname $(shell which likwid-topology 2>/dev/null) 2>/dev/null)
LIKWID_FOLDER="$(shell pwd)/likwid" LIKWID_FOLDER="$(shell pwd)/likwid"