From 92f88f6cc58fc711a87b7466fbe9714fc639a72d Mon Sep 17 00:00:00 2001 From: evilsocket Date: Thu, 8 Feb 2018 08:06:37 +0100 Subject: [PATCH] added a few cross compilation rules --- Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Makefile b/Makefile index 25381cbc..36b796f1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ 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 @echo "@ Done" @@ -10,6 +12,22 @@ build: resources @echo "@ Building ..." @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 oui: @@ -26,6 +44,7 @@ lint: deps: @go get -u github.com/jteeuwen/go-bindata/... + @go get github.com/ykyuen/xgo @go get ./... clean: