-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
29 lines (26 loc) · 889 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
PACKAGE_NAME := github.com/xmapst/osreapi
GOLANG_CROSS_VERSION ?= latest
.PHONY: all
all: binary copy-binary
@sha256sum bin/osreapi* > bin/latest.sha256sum
# cgo build use ghcr.io/goreleaser/goreleaser-cross
.PHONY: binary
binary:
@echo "Building the binary..."
@rm -fr $(CURDIR)/dist
@docker run \
--rm \
--privileged \
--network host \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(CURDIR):/go/src/$(PACKAGE_NAME) \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser:${GOLANG_CROSS_VERSION} \
release --skip=validate --clean
.PHONY: copy-binary
copy-binary:
@echo "Copying binaries..."
@rm -fr $(CURDIR)/bin
@mkdir -p $(CURDIR)/bin
@find $(CURDIR)/dist/osreapi_* -type f -not -path "*checksums*" -exec bash -c 'cp -f {} $(CURDIR)/bin/`echo {}|sed "s|$(CURDIR)/dist/||g"|sed "s|/osreapi||g"`' \;
@rm -fr dist