Skip to content

Commit

Permalink
fix build more (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidnewhall authored Jan 7, 2021
1 parent 28fd488 commit 7baf42a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MD2ROFF_BIN=github.com/davidnewhall/md2roff
RSRC_BIN=github.com/akavel/rsrc

# If upx is available, use it to compress the binaries.
UPX=$(shell which upx)
UPXPATH=$(shell which upx)

# Travis CI passes the version in. Local builds get it from the current git tag.
ifeq ($(VERSION),)
Expand Down Expand Up @@ -128,39 +128,39 @@ $(shell go env GOPATH)/bin/rsrc:
build: $(BINARY)
$(BINARY): main.go
go build -o $(BINARY) -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ "$(UPX)" == "" ] || upx -q9 $@
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@

linux: $(BINARY).amd64.linux
$(BINARY).amd64.linux: main.go
# Building linux 64-bit x86 binary.
GOOS=linux GOARCH=amd64 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ "$(UPX)" == ""] || upx -q9 $@
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@

linux386: $(BINARY).i386.linux
$(BINARY).i386.linux: main.go
# Building linux 32-bit x86 binary.
GOOS=linux GOARCH=386 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ "$(UPX)" == "" ] || upx -q9 $@
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@

arm: arm64 armhf

arm64: $(BINARY).arm64.linux
$(BINARY).arm64.linux: main.go
# Building linux 64-bit ARM binary.
GOOS=linux GOARCH=arm64 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ "$(UPX)" == "" ] || upx -q9 $@
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@

armhf: $(BINARY).armhf.linux
$(BINARY).armhf.linux: main.go
# Building linux 32-bit ARM binary.
GOOS=linux GOARCH=arm GOARM=6 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ "$(UPX)" == "" ] || upx -q9 $@
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@

macos: $(BINARY).amd64.macos
$(BINARY).amd64.macos: main.go
# Building darwin 64-bit x86 binary.
GOOS=darwin GOARCH=amd64 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ "$(UPX)" == "" ] || upx -q9 $@
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@

freebsd: $(BINARY).amd64.freebsd
$(BINARY).amd64.freebsd: main.go
Expand All @@ -169,7 +169,7 @@ $(BINARY).amd64.freebsd: main.go
freebsd386: $(BINARY).i386.freebsd
$(BINARY).i386.freebsd: main.go
GOOS=freebsd GOARCH=386 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) "
[ "$(UPX)" == "" ] || upx -q9 $@ || true
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@ || true

freebsdarm: $(BINARY).armhf.freebsd
$(BINARY).armhf.freebsd: main.go
Expand All @@ -180,7 +180,7 @@ windows: $(BINARY).amd64.exe
$(BINARY).amd64.exe: rsrc.syso main.go
# Building windows 64-bit x86 binary.
GOOS=windows GOARCH=amd64 go build -o $@ -ldflags "-w -s $(VERSION_LDFLAGS) $(EXTRA_LDFLAGS) $(WINDOWS_LDFLAGS)"
[ "$(UPX)" == "" ] || upx -q9 $@
[ -z "$(UPXPATH)" ] || $(UPXPATH) -q9 $@

####################
##### Packages #####
Expand Down

0 comments on commit 7baf42a

Please sign in to comment.