.pre-build: mkdir -p bin/ BIN = ./bin all: x86 arm32 arm64 android test: .pre-build export GOARCH=amd64 GOOS=linux GO111MODULE=on && go build -ldflags="-s -w" -tags netgo -o $(BIN)/nat_detect export GOARCH=arm GOOS=linux GO111MODULE=on CGO_ENABLED=0 CC=arm-linux-gnueabi-gcc && go build -ldflags="-extldflags '-static' " -tags netgo -o $(BIN)/nat_detect.arm x86: .pre-build export GOARCH=amd64 GOOS=linux GO111MODULE=on CGO_ENABLED=1 && go build -ldflags="-extldflags '-static' " -tags netgo -o $(BIN)/nat_detect upx $(BIN)/nat_detect -1 arm32: .pre-build export GOARCH=arm GOOS=linux GO111MODULE=on CGO_ENABLED=1 CC=arm-linux-gnueabi-gcc && go build -ldflags="-extldflags '-static' " -tags netgo -o $(BIN)/nat_detect.arm32 upx $(BIN)/nat_detect.arm32 -1 arm64: .pre-build export GOARCH=arm64 GOOS=linux GO111MODULE=on CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc && go build -ldflags '-extldflags "-static"' -tags netgo -o $(BIN)/nat_detect.arm upx $(BIN)/nat_detect.arm64 -1 android: .pre-build export GOARCH=arm GOOS=android GO111MODULE=on CGO_ENABLED=1 CC=/usr/local/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi19-clang && go build -o $(BIN)/nat_detect.ndk clean: $(RM) -r $(BIN) || true