diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-08-23 17:11:16 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-08-23 17:22:28 +0200 |
commit | 11ad75c2d2360a08250e6c23ab177954eb48b6d0 (patch) | |
tree | ef63481a64250b7ecda997f4b1b98e2bfaf5387b | |
parent | fe68795a5060827b696d7109516a4b6729edab53 (diff) |
build: Add cross-compile target
-rw-r--r-- | Makefile | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -4,6 +4,9 @@ OS := $(shell uname) ifeq ($(OS),Linux) TAR_OPTS := --wildcards endif +XGOARCH := amd64 +XGOOS := linux +XBIN := $(XGOOS)_$(XGOARCH)/echoip all: lint test install @@ -62,3 +65,13 @@ ifndef PORT $(error PORT must be set) endif echoip -C 1000000 -f data/country.mmdb -c data/city.mmdb -a data/asn.mmdb -p -r -H CF-Connecting-IP -H X-Forwarded-For -l :$(PORT) + +xinstall: + env GOOS=$(XGOOS) GOARCH=$(XGOARCH) go install ./... + +publish: +ifndef DEST_PATH + $(error DEST_PATH must be set when publishing) +endif + rsync -a $(GOPATH)/bin/$(XBIN) $(DEST_PATH)/$(XBIN) + @sha256sum $(GOPATH)/bin/$(XBIN) |