This repository was archived by the owner on Sep 1, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change 25
25
prerelease : false
26
26
files : |
27
27
LICENSE.md
28
- target/openldap_exporter*
28
+ target/*.gz
Original file line number Diff line number Diff line change @@ -3,12 +3,14 @@ GIT_TAG := $(shell git describe --tags 2>/dev/null)
3
3
4
4
LDFLAGS := -s -w -X github.com/tomcz/openldap_exporter.commit=${GITCOMMIT}
5
5
LDFLAGS := ${LDFLAGS} -X github.com/tomcz/openldap_exporter.tag=${GIT_TAG}
6
+ OUTFILE ?= openldap_exporter
6
7
7
8
.PHONY : precommit
8
- precommit : clean format lint build
9
+ precommit : clean format lint compile
9
10
10
11
.PHONY : commit
11
- commit : clean build
12
+ commit : clean cross-compile
13
+ ls -lha target/
12
14
13
15
.PHONY : clean
14
16
clean :
33
35
@echo "Running staticcheck ..."
34
36
@staticcheck $(shell go list ./... | grep -v /vendor/)
35
37
36
- compile = GOOS=$1 GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o target/openldap_exporter-$1 ./cmd/openldap_exporter
37
-
38
- .PHONY : build
39
- build : target
40
- $(call compile,linux)
41
- $(call compile,darwin)
38
+ .PHONY : compile
39
+ compile : target
40
+ go build -ldflags " ${LDFLAGS} " -o target/${OUTFILE} ./cmd/openldap_exporter/...
41
+ gzip -c < target/${OUTFILE} > target/${OUTFILE} .gz
42
+
43
+ .PHONY : cross-compile
44
+ cross-compile :
45
+ OUTFILE=openldap_exporter-linux-amd64 GOOS=linux GOARCH=amd64 $(MAKE ) compile
46
+ OUTFILE=openldap_exporter-linux-nocgo CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(MAKE ) compile
47
+ OUTFILE=openldap_exporter-osx-amd64 GOOS=darwin GOARCH=amd64 $(MAKE ) compile
48
+ OUTFILE=openldap_exporter-osx-arm64 GOOS=darwin GOARCH=arm64 $(MAKE ) compile
You can’t perform that action at this time.
0 commit comments