123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- PROGNAME = dtlspipe
- OUTSUFFIX = bin/$(PROGNAME)
- VERSION := $(shell git describe)
- BUILDOPTS = -a -tags netgo -trimpath -asmflags -trimpath
- LDFLAGS = -ldflags '-s -w -extldflags "-static" -X main.version=$(VERSION)'
- LDFLAGS_NATIVE = -ldflags '-s -w -X main.version=$(VERSION)'
- MAIN_PACKAGE = ./cmd/$(PROGNAME)
- NDK_CC_ARM = $(abspath ../../ndk-toolchain-arm/bin/arm-linux-androideabi-gcc)
- NDK_CC_ARM64 = $(abspath ../../ndk-toolchain-arm64/bin/aarch64-linux-android21-clang)
- GO := go
- src = $(wildcard *.go */*.go */*/*.go go.mod go.sum)
- native: bin-native
- all: bin-linux-amd64 bin-linux-386 bin-linux-arm bin-linux-arm64 \
- bin-linux-mips bin-linux-mipsle bin-linux-mips64 bin-linux-mips64le \
- bin-freebsd-amd64 bin-freebsd-386 bin-freebsd-arm bin-freebsd-arm64 \
- bin-netbsd-amd64 bin-netbsd-386 bin-netbsd-arm bin-netbsd-arm64 \
- bin-openbsd-amd64 bin-openbsd-386 bin-openbsd-arm bin-openbsd-arm64 \
- bin-darwin-amd64 bin-darwin-arm64 \
- bin-windows-amd64 bin-windows-386 bin-windows-arm
- allplus: all \
- bin-android-arm bin-android-arm64
- bin-native: $(OUTSUFFIX)
- bin-linux-amd64: $(OUTSUFFIX).linux-amd64
- bin-linux-386: $(OUTSUFFIX).linux-386
- bin-linux-arm: $(OUTSUFFIX).linux-arm
- bin-linux-arm64: $(OUTSUFFIX).linux-arm64
- bin-linux-mips: $(OUTSUFFIX).linux-mips
- bin-linux-mipsle: $(OUTSUFFIX).linux-mipsle
- bin-linux-mips64: $(OUTSUFFIX).linux-mips64
- bin-linux-mips64le: $(OUTSUFFIX).linux-mips64le
- bin-freebsd-amd64: $(OUTSUFFIX).freebsd-amd64
- bin-freebsd-386: $(OUTSUFFIX).freebsd-386
- bin-freebsd-arm: $(OUTSUFFIX).freebsd-arm
- bin-freebsd-arm64: $(OUTSUFFIX).freebsd-arm64
- bin-netbsd-amd64: $(OUTSUFFIX).netbsd-amd64
- bin-netbsd-386: $(OUTSUFFIX).netbsd-386
- bin-netbsd-arm: $(OUTSUFFIX).netbsd-arm
- bin-netbsd-arm64: $(OUTSUFFIX).netbsd-arm64
- bin-openbsd-amd64: $(OUTSUFFIX).openbsd-amd64
- bin-openbsd-386: $(OUTSUFFIX).openbsd-386
- bin-openbsd-arm: $(OUTSUFFIX).openbsd-arm
- bin-openbsd-arm64: $(OUTSUFFIX).openbsd-arm64
- bin-darwin-amd64: $(OUTSUFFIX).darwin-amd64
- bin-darwin-arm64: $(OUTSUFFIX).darwin-arm64
- bin-windows-amd64: $(OUTSUFFIX).windows-amd64.exe
- bin-windows-386: $(OUTSUFFIX).windows-386.exe
- bin-windows-arm: $(OUTSUFFIX).windows-arm.exe
- bin-android-arm: $(OUTSUFFIX).android-arm
- bin-android-arm64: $(OUTSUFFIX).android-arm64
- $(OUTSUFFIX): $(src)
- $(GO) build $(LDFLAGS_NATIVE) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).linux-amd64: $(src)
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).linux-386: $(src)
- CGO_ENABLED=0 GOOS=linux GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).linux-arm: $(src)
- CGO_ENABLED=0 GOOS=linux GOARCH=arm $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).linux-arm64: $(src)
- CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).linux-mips: $(src)
- CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).linux-mips64: $(src)
- CGO_ENABLED=0 GOOS=linux GOARCH=mips64 GOMIPS=softfloat $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).linux-mipsle: $(src)
- CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).linux-mips64le: $(src)
- CGO_ENABLED=0 GOOS=linux GOARCH=mips64le GOMIPS=softfloat $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).freebsd-amd64: $(src)
- CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).freebsd-386: $(src)
- CGO_ENABLED=0 GOOS=freebsd GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).freebsd-arm: $(src)
- CGO_ENABLED=0 GOOS=freebsd GOARCH=arm $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).freebsd-arm64: $(src)
- CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).netbsd-amd64: $(src)
- CGO_ENABLED=0 GOOS=netbsd GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).netbsd-386: $(src)
- CGO_ENABLED=0 GOOS=netbsd GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).netbsd-arm: $(src)
- CGO_ENABLED=0 GOOS=netbsd GOARCH=arm $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).netbsd-arm64: $(src)
- CGO_ENABLED=0 GOOS=netbsd GOARCH=arm64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).openbsd-amd64: $(src)
- CGO_ENABLED=0 GOOS=openbsd GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).openbsd-386: $(src)
- CGO_ENABLED=0 GOOS=openbsd GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).openbsd-arm: $(src)
- CGO_ENABLED=0 GOOS=openbsd GOARCH=arm $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).openbsd-arm64: $(src)
- CGO_ENABLED=0 GOOS=openbsd GOARCH=arm64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).darwin-amd64: $(src)
- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).darwin-arm64: $(src)
- CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).windows-amd64.exe: $(src)
- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).windows-386.exe: $(src)
- CGO_ENABLED=0 GOOS=windows GOARCH=386 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).windows-arm.exe: $(src)
- CGO_ENABLED=0 GOOS=windows GOARCH=arm GOARM=7 $(GO) build $(BUILDOPTS) $(LDFLAGS) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).android-arm: $(src)
- CC=$(NDK_CC_ARM) CGO_ENABLED=1 GOOS=android GOARCH=arm GOARM=7 $(GO) build $(LDFLAGS_NATIVE) -o $@ $(MAIN_PACKAGE)
- $(OUTSUFFIX).android-arm64: $(src)
- CC=$(NDK_CC_ARM64) CGO_ENABLED=1 GOOS=android GOARCH=arm64 $(GO) build $(LDFLAGS_NATIVE) -o $@ $(MAIN_PACKAGE)
- clean:
- rm -f bin/*
- fmt:
- $(GO) fmt ./...
- run:
- $(GO) run $(LDFLAGS) $(MAIN_PACKAGE)
- install:
- $(GO) install $(LDFLAGS_NATIVE) $(MAIN_PACKAGE)
- .PHONY: clean all native fmt install \
- bin-native \
- bin-linux-amd64 \
- bin-linux-386 \
- bin-linux-arm \
- bin-linux-arm64 \
- bin-linux-mips \
- bin-linux-mipsle \
- bin-linux-mips64 \
- bin-linux-mips64le \
- bin-freebsd-amd64 \
- bin-freebsd-386 \
- bin-freebsd-arm \
- bin-freebsd-arm64 \
- bin-netbsd-amd64 \
- bin-netbsd-386 \
- bin-netbsd-arm \
- bin-netbsd-arm64 \
- bin-openbsd-amd64 \
- bin-openbsd-386 \
- bin-openbsd-arm \
- bin-openbsd-arm64 \
- bin-darwin-amd64 \
- bin-darwin-arm64 \
- bin-windows-amd64 \
- bin-windows-386 \
- bin-windows-arm \
- bin-android-arm \
- bin-android-arm64
|