fix(Makefile): remove obsolete steps
changes: - Replace substr func with variable patterns. - Remove deploy and compression steps
This commit is contained in:
parent
39b3a495ac
commit
5f48d29dae
135
Makefile
135
Makefile
@ -1,14 +1,7 @@
|
|||||||
# UID/GID
|
|
||||||
# UID or GID is the UNIX user ID or group ID of the user who executes
|
|
||||||
# make. If the UID or GID is not passed as a make variable, an attempt
|
|
||||||
# is made to determine it.
|
|
||||||
UID?=$(shell id --user)
|
|
||||||
GID?=$(shell id --group)
|
|
||||||
|
|
||||||
# VERSION/RELEASE
|
# VERSION/RELEASE
|
||||||
# If no version is specified as a parameter of make, the last git hash
|
# If no version is specified as a parameter of make, the last git hash
|
||||||
# value is taken.
|
# value is taken.
|
||||||
VERSION?=$(shell git describe --abbrev=0)+hash.$(shell git rev-parse --short HEAD)
|
VERSION?=$(shell git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g')
|
||||||
RELEASE?=1
|
RELEASE?=1
|
||||||
|
|
||||||
# CONTAINER_IMAGE_VERSION
|
# CONTAINER_IMAGE_VERSION
|
||||||
@ -27,13 +20,6 @@ CONTAINER_IMAGE_VERSION:=latest
|
|||||||
CONTAINER_RUNTIME?=$(shell which docker)
|
CONTAINER_RUNTIME?=$(shell which docker)
|
||||||
BUILD_IMAGE:=volkerraschek/build-image:latest
|
BUILD_IMAGE:=volkerraschek/build-image:latest
|
||||||
|
|
||||||
# GH_USER/GITHUB_TOKEN
|
|
||||||
# It's the user name from github.com and his token. This token and the username
|
|
||||||
# can be set over encrypted environment variables in the ci/cd pipeline. It's
|
|
||||||
# necessary to push the releases on github.com
|
|
||||||
GITHUB_USER=volker-raschek
|
|
||||||
GITHUB_TOKEN?=""
|
|
||||||
|
|
||||||
# EXECUTABLE
|
# EXECUTABLE
|
||||||
# Executable binary which should be compiled for different architecures
|
# Executable binary which should be compiled for different architecures
|
||||||
EXECUTABLE:=flucky
|
EXECUTABLE:=flucky
|
||||||
@ -83,34 +69,11 @@ EXECUTABLES:=\
|
|||||||
EXECUTABLE_TARGETS:= \
|
EXECUTABLE_TARGETS:= \
|
||||||
${UNIX_EXECUTABLE_TARGETS}
|
${UNIX_EXECUTABLE_TARGETS}
|
||||||
|
|
||||||
# COMPRSSED_EXECUTABLES
|
|
||||||
# Append to all defined executables the compression extentions to detect the
|
|
||||||
# different make steps which compress the binary
|
|
||||||
COMPRESSED_EXECUTABLES:= \
|
|
||||||
${UNIX_EXECUTABLES:%=%.tar.bz2} \
|
|
||||||
${UNIX_EXECUTABLES:%=%.tar.gz} \
|
|
||||||
${UNIX_EXECUTABLES:%=%.tar.xz} \
|
|
||||||
${UNIX_EXECUTABLES:%=%.zip}
|
|
||||||
COMPRESSED_EXECUTABLE_TARGETS:=${COMPRESSED_EXECUTABLES:%=bin/%}
|
|
||||||
|
|
||||||
# RPM_TARGETS
|
|
||||||
RPM_EXECUTABLES:=${LINUX_EXECUTABLES:%=%.rpm}
|
|
||||||
RPM_EXECUTABLE_TARGETS:=${RPM_EXECUTABLES:%=bin/%}
|
|
||||||
|
|
||||||
# RELEASE_TARGETS
|
|
||||||
RELEASE_EXECUTABLES:= \
|
|
||||||
${COMPRESSED_EXECUTABLE_TARGETS} \
|
|
||||||
${RPM_EXECUTABLE_TARGETS}
|
|
||||||
|
|
||||||
RELEASE_EXECUTABLE_TARGETS:= \
|
|
||||||
${COMPRESSED_EXECUTABLE_TARGETS:%=release/%} \
|
|
||||||
${RPM_EXECUTABLE_TARGETS:%=release/%}
|
|
||||||
|
|
||||||
# BINARIES
|
# BINARIES
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# current os
|
# current os
|
||||||
${EXECUTABLE}: bindata
|
${EXECUTABLE}: bindata
|
||||||
CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION}" -o "$@"
|
CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION}" -o ${@}
|
||||||
|
|
||||||
# build all binaries
|
# build all binaries
|
||||||
PHONY:=all
|
PHONY:=all
|
||||||
@ -118,27 +81,27 @@ all: ${EXECUTABLE_TARGETS}
|
|||||||
|
|
||||||
# darwin os
|
# darwin os
|
||||||
bin/darwin/386/${EXECUTABLE}: bindata
|
bin/darwin/386/${EXECUTABLE}: bindata
|
||||||
CGO_ENABLED=0 GOARCH=386 GOOS=darwin go build -ldflags "-X main.version=${VERSION}" -o "$@"
|
CGO_ENABLED=0 GOARCH=386 GOOS=darwin go build -ldflags "-X main.version=${VERSION}" -o ${@}
|
||||||
|
|
||||||
bin/darwin/amd64/${EXECUTABLE}: bindata
|
bin/darwin/amd64/${EXECUTABLE}: bindata
|
||||||
CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -ldflags "-X main.version=${VERSION}" -o "$@"
|
CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -ldflags "-X main.version=${VERSION}" -o ${@}
|
||||||
|
|
||||||
# freebsd os
|
# freebsd os
|
||||||
bin/freebsd/amd64/${EXECUTABLE}: bindata
|
bin/freebsd/amd64/${EXECUTABLE}: bindata
|
||||||
CGO_ENABLED=0 GOARCH=amd64 GOOS=freebsd go build -ldflags "-X main.version=${VERSION}" -o "$@"
|
CGO_ENABLED=0 GOARCH=amd64 GOOS=freebsd go build -ldflags "-X main.version=${VERSION}" -o ${@}
|
||||||
|
|
||||||
# linux os
|
# linux os
|
||||||
bin/linux/386/${EXECUTABLE}: bindata
|
bin/linux/386/${EXECUTABLE}: bindata
|
||||||
CGO_ENABLED=0 GOARCH=386 GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o "$@"
|
CGO_ENABLED=0 GOARCH=386 GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o ${@}
|
||||||
|
|
||||||
bin/linux/amd64/${EXECUTABLE}: bindata
|
bin/linux/amd64/${EXECUTABLE}: bindata
|
||||||
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o "$@"
|
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o ${@}
|
||||||
|
|
||||||
bin/linux/arm/5/${EXECUTABLE}: bindata
|
bin/linux/arm/5/${EXECUTABLE}: bindata
|
||||||
CGO_ENABLED=0 GOARM=5 GOARCH=arm GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o "$@"
|
CGO_ENABLED=0 GOARM=5 GOARCH=arm GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o ${@}
|
||||||
|
|
||||||
bin/linux/arm/7/${EXECUTABLE}: bindata
|
bin/linux/arm/7/${EXECUTABLE}: bindata
|
||||||
CGO_ENABLED=0 GOARM=7 GOARCH=arm GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o "$@"
|
CGO_ENABLED=0 GOARM=7 GOARCH=arm GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o ${@}
|
||||||
|
|
||||||
# GO-BINDATA
|
# GO-BINDATA
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@ -161,55 +124,12 @@ test-update-all: ${EXECUTABLE}
|
|||||||
rpm-builder \
|
rpm-builder \
|
||||||
--exec-file "$<:/usr/bin/${EXECUTABLE}" \
|
--exec-file "$<:/usr/bin/${EXECUTABLE}" \
|
||||||
--dir "systemd:/usr/lib/systemd/system" \
|
--dir "systemd:/usr/lib/systemd/system" \
|
||||||
--license AGFA_PROPERTERY \
|
--license "Apache 2.0" \
|
||||||
--version ${VERSION} \
|
--version ${VERSION} \
|
||||||
--release ${RELEASE} \
|
--release ${RELEASE} \
|
||||||
--out $@ \
|
--out ${@} \
|
||||||
${EXECUTABLE}
|
${EXECUTABLE}
|
||||||
|
|
||||||
# RELEASE
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=release/all
|
|
||||||
release/all: clean ${RELEASE_EXECUTABLES}
|
|
||||||
|
|
||||||
github-release release \
|
|
||||||
--user ${GITHUB_USER} \
|
|
||||||
--repo ${EXECUTABLE} \
|
|
||||||
--tag ${VERSION}
|
|
||||||
|
|
||||||
$(foreach FILE,${RELEASE_EXECUTABLES},github-release upload --user ${GITHUB_USER} --repo ${EXECUTABLE} --tag ${VERSION} --name $(subst /,-,${FILE}) --file bin/${FILE} --replace;)
|
|
||||||
|
|
||||||
PHONY+=${RELEASE_EXECUTABLE_TARGETS}
|
|
||||||
${RELEASE_EXECUTABLE_TARGETS}: clean
|
|
||||||
$(MAKE) $(subst release/,,$@)
|
|
||||||
|
|
||||||
github-release release \
|
|
||||||
--user ${GITHUB_USER} \
|
|
||||||
--repo ${EXECUTABLE} \
|
|
||||||
--tag ${VERSION}
|
|
||||||
|
|
||||||
github-release upload \
|
|
||||||
--user ${GITHUB_USER} \
|
|
||||||
--repo ${EXECUTABLE} \
|
|
||||||
--tag ${VERSION} \
|
|
||||||
--name $(subst /,-,$(subst release/bin/,,$@)) \
|
|
||||||
--file $(subst release/,,$@) \
|
|
||||||
--replace
|
|
||||||
|
|
||||||
# COMPRESSION
|
|
||||||
# ==============================================================================
|
|
||||||
%.tar.bz2: %
|
|
||||||
tar --create --bzip2 --file "$@" "$<"
|
|
||||||
|
|
||||||
%.tar.gz: %
|
|
||||||
tar --create --gunzip --file "$@" "$<"
|
|
||||||
|
|
||||||
%.tar.xz: %
|
|
||||||
tar --create --xz --file "$@" "$<"
|
|
||||||
|
|
||||||
%.zip: %
|
|
||||||
zip "$@" "$<"
|
|
||||||
|
|
||||||
# OTHER STUFF
|
# OTHER STUFF
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=clean
|
PHONY+=clean
|
||||||
@ -218,7 +138,6 @@ clean:
|
|||||||
rm ${EXECUTABLE}.* || true
|
rm ${EXECUTABLE}.* || true
|
||||||
rm --recursive --force bin/ || true
|
rm --recursive --force bin/ || true
|
||||||
|
|
||||||
|
|
||||||
# CONTAINER IMAGE STEPS
|
# CONTAINER IMAGE STEPS
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=container-image/build/amd64
|
PHONY+=container-image/build/amd64
|
||||||
@ -236,54 +155,38 @@ container-image/push/amd64: container-image/build/amd64
|
|||||||
# current os
|
# current os
|
||||||
PHONY+=container-run/${EXECUTABLE}
|
PHONY+=container-run/${EXECUTABLE}
|
||||||
container-run/${EXECUTABLE}:
|
container-run/${EXECUTABLE}:
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
||||||
|
|
||||||
# build all binaries for any operating system
|
# build all binaries for any operating system
|
||||||
PHONY+=container-run/all
|
PHONY+=container-run/all
|
||||||
container-run/all:
|
container-run/all:
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
||||||
|
|
||||||
PHONY+=${UNIX_EXECUTABLE_TARGETS:%=container-run/%}
|
PHONY+=${UNIX_EXECUTABLE_TARGETS:%=container-run/%}
|
||||||
${UNIX_EXECUTABLE_TARGETS:%=container-run/%}:
|
${UNIX_EXECUTABLE_TARGETS:%=container-run/%}:
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
||||||
|
|
||||||
# CONTAINER STEPS - GO-BINDATA
|
# CONTAINER STEPS - GO-BINDATA
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=container-run/bindata
|
PHONY+=container-run/bindata
|
||||||
container-run/bindata:
|
container-run/bindata:
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
||||||
|
|
||||||
# CONTAINER STEPS - TEST
|
# CONTAINER STEPS - TEST
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=container-run/test
|
PHONY+=container-run/test
|
||||||
container-run/test:
|
container-run/test:
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
||||||
|
|
||||||
PHONY+=container-run/test-update-all
|
PHONY+=container-run/test-update-all
|
||||||
container-run/test-update-all:
|
container-run/test-update-all:
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
||||||
|
|
||||||
# CONTAINER STEPS - COMPRESSED BINARIES AND PACKAGES
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=${COMPRESSED_EXECUTABLE_TARGETS:%=container-run/%}
|
|
||||||
${COMPRESSED_EXECUTABLE_TARGETS:%=container-run/%}:
|
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
|
||||||
|
|
||||||
PHONY+=${RPM_EXECUTABLE_TARGETS:%=container-run/%}
|
|
||||||
${RPM_EXECUTABLE_TARGETS:%=container-run/%}:
|
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
|
||||||
|
|
||||||
# CONTAINER STEPS - RELEASE COMPRESSED BINARIES AND PACKAGES
|
|
||||||
# ==============================================================================
|
|
||||||
PHONY+=${RELEASE_EXECUTABLE_TARGETS%=container-run/%}
|
|
||||||
${RELEASE_EXECUTABLE_TARGETS:%=container-run/%}:
|
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
|
||||||
|
|
||||||
# CONTAINER STEPS - OTHER STUF
|
# CONTAINER STEPS - OTHER STUF
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
PHONY+=container-run/clean
|
PHONY+=container-run/clean
|
||||||
container-run/clean:
|
container-run/clean:
|
||||||
$(MAKE) container-run COMMAND=$(subst container-run/,,$@)
|
$(MAKE) container-run COMMAND=${@:container-run/%=%}
|
||||||
|
|
||||||
# GENERAL CONTAINER COMMAND
|
# GENERAL CONTAINER COMMAND
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
@ -294,8 +197,6 @@ container-run:
|
|||||||
--volume ${PWD}:/workspace \
|
--volume ${PWD}:/workspace \
|
||||||
${BUILD_IMAGE} \
|
${BUILD_IMAGE} \
|
||||||
make ${COMMAND} \
|
make ${COMMAND} \
|
||||||
UID=${UID} \
|
|
||||||
GID=${GID} \
|
|
||||||
VERSION=${VERSION} \
|
VERSION=${VERSION} \
|
||||||
RELEASE=${RELEASE}
|
RELEASE=${RELEASE}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user