GNU Make→BSD Make

This commit is contained in:
守矢諏訪子 2024-06-06 15:19:05 +09:00
parent c832b91bd1
commit 41bdd1e01f
3 changed files with 59 additions and 38 deletions

View File

@ -1,5 +1,6 @@
# 2.3.0
* GPL→ISC
* GNU Make→BSD Make
# 2.2.0
* ポート番号の修正

View File

@ -1,56 +1,75 @@
NAME=urloli
VERSION := $(shell cat main.go | grep "var version" | awk '{print $$4}' | sed "s/\"//g")
# Linux、Illumos
PREFIX=/usr
# FreeBSDとOpenBSD
#PREFIX=/usr/local
# NetBSD
#PREFIX=/usr/pkg
MANPREFIX=${PREFIX}/share/man
# LinuxとOpenBSD
UNAME_S != uname -s
NAME != cat main.go | grep "var sofname" | awk '{print $$4}' | sed "s/\"//g"
VERSION != cat main.go | grep "var version" | awk '{print $$4}' | sed "s/\"//g"
PREFIX = /usr/local
.if ${UNAME_S} == "Linux"
PREFIX = /usr
.endif
MANPREFIX = ${PREFIX}/share/man
.if ${UNAME_S} == "OpenBSD"
MANPREFIX = ${PREFIX}/man
.endif
CNFPREFIX=/etc
# FreeBSD
#CNFPREFIX=/usr/local/etc
.if ${UNAME_S} == "FreeBSD" || ${UNAME_S} == "NetBSD" || ${UNAME_S} == "Dragonfly"
CNFPREFIX=${PREFIX}/etc
.endif
CC=CGO_ENABLED=0 go build
# リリース。なし=デバッグ。
RELEASE=-ldflags="-s -w" -buildvcs=false
all:
${CC} ${RELEASE} -o ${NAME}
release:
env GOOS=linux GOARCH=amd64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-linux-amd64
env GOOS=linux GOARCH=arm64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-linux-arm64
env GOOS=linux GOARCH=arm ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-linux-arm
env GOOS=linux GOARCH=riscv64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-linux-riscv64
env GOOS=linux GOARCH=386 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-linux-386
env GOOS=linux GOARCH=ppc64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-linux-ppc64
env GOOS=linux GOARCH=mips64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-linux-mips64
env GOOS=openbsd GOARCH=amd64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-openbsd-amd64
env GOOS=openbsd GOARCH=386 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-openbsd-386
env GOOS=openbsd GOARCH=arm64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-openbsd-arm64
env GOOS=openbsd GOARCH=arm ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-openbsd-arm
env GOOS=openbsd GOARCH=mips64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-openbsd-mips64
env GOOS=freebsd GOARCH=amd64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-freebsd-amd64
env GOOS=freebsd GOARCH=386 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-freebsd-386
env GOOS=freebsd GOARCH=arm ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-freebsd-arm4
env GOOS=freebsd GOARCH=arm64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-freebsd-arm64
env GOOS=freebsd GOARCH=riscv64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-freebsd-riscv64
env GOOS=netbsd GOARCH=amd64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-netbsd-amd64
env GOOS=netbsd GOARCH=386 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-netbsd-386
env GOOS=netbsd GOARCH=arm ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-netbsd-arm4
env GOOS=netbsd GOARCH=arm64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-netbsd-arm64
env GOOS=illumos GOARCH=amd64 ${CC} ${RELEASE} -o bin/${NAME}-${VERSION}-illumos-amd64
mkdir -p release/bin
env GOOS=linux GOARCH=amd64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-linux-amd64
env GOOS=linux GOARCH=arm64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-linux-arm64
env GOOS=linux GOARCH=riscv64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-linux-riscv64
env GOOS=linux GOARCH=ppc64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-linux-ppc64
env GOOS=linux GOARCH=mips64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-linux-mips64
env GOOS=openbsd GOARCH=amd64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-openbsd-amd64
env GOOS=openbsd GOARCH=arm64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-openbsd-arm64
env GOOS=openbsd GOARCH=mips64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-openbsd-mips64
env GOOS=openbsd GOARCH=ppc64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-openbsd-ppc64
env GOOS=openbsd GOARCH=riscv64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-openbsd-riscv64
env GOOS=openbsd GOARCH=sparc64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-openbsd-sparc64
env GOOS=freebsd GOARCH=amd64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-freebsd-amd64
env GOOS=freebsd GOARCH=arm64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-freebsd-arm64
env GOOS=freebsd GOARCH=riscv64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-freebsd-riscv64
env GOOS=netbsd GOARCH=amd64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-netbsd-amd64
env GOOS=netbsd GOARCH=arm64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-netbsd-arm64
env GOOS=illumos GOARCH=amd64 ${CC} ${RELEASE} -o \
release/bin/${NAME}-${VERSION}-illumos-amd64
clean:
rm -f ${NAME} ${NAME}-${VERSION}.tar.gz
dist: clean
mkdir -p ${NAME}-${VERSION}
mkdir -p ${NAME}-${VERSION} release/src
cp -R LICENSE.txt Makefile README.md CHANGELOG.md\
view static logo.jpg\
${NAME}.1 *.go *.json go.mod go.sum ${NAME}-${VERSION}
tar zcfv ${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION}
tar zcfv release/src/${NAME}-${VERSION}.tar.gz ${NAME}-${VERSION}
rm -rf ${NAME}-${VERSION}
install: all

View File

@ -6,7 +6,8 @@ import (
"strconv"
)
var version = "2.2.0"
var sofname = "urloli"
var version = "2.3.0"
func help () {
fmt.Println(" URLロリ - クッソ小さいURL短縮作成ソフトだわ〜♡")