added a few cross compilation rules

This commit is contained in:
evilsocket 2018-02-08 08:06:37 +01:00
parent 102d0b2c5b
commit 92f88f6cc5

View file

@ -1,4 +1,6 @@
TARGET=bettercap-ng TARGET=bettercap-ng
PCAP=http://www.tcpdump.org/release/libpcap-1.8.1.tar.gz
LDFLAGS='-linkmode external -extldflags "-static -s -w"'
all: fmt vet build all: fmt vet build
@echo "@ Done" @echo "@ Done"
@ -10,6 +12,22 @@ build: resources
@echo "@ Building ..." @echo "@ Building ..."
@go build $(FLAGS) -o $(TARGET) . @go build $(FLAGS) -o $(TARGET) .
linux_arm:
@echo "@ Cross compiling for linux/arm-7"
@xgo -ldflags=$(LDFLAGS) --deps=$(PCAP) --depsargs="--with-pcap=linux" --targets=linux/arm-7 .
linux_arm64:
@echo "@ Cross compiling for linux/arm64"
@xgo -ldflags=$(LDFLAGS) --deps=$(PCAP) --depsargs="--with-pcap=linux" --targets=linux/arm64 .
linux_mips:
@echo "@ Cross compiling for linux/mips"
@xgo -ldflags=$(LDFLAGS) --deps=$(PCAP) --depsargs="--with-pcap=linux" --targets=linux/mips .
linux_mips64:
@echo "@ Cross compiling for linux/mips64"
@xgo -ldflags=$(LDFLAGS) --deps=$(PCAP) --depsargs="--with-pcap=linux" --targets=linux/mips64 .
resources: oui resources: oui
oui: oui:
@ -26,6 +44,7 @@ lint:
deps: deps:
@go get -u github.com/jteeuwen/go-bindata/... @go get -u github.com/jteeuwen/go-bindata/...
@go get github.com/ykyuen/xgo
@go get ./... @go get ./...
clean: clean: