fix(Makefile): container steps

This commit is contained in:
Markus Pesch 2019-08-26 15:12:32 +02:00
parent 6835d4793b
commit 837f6c1cb2
Signed by: volker.raschek
GPG Key ID: 852BCC170D81A982

View File

@ -29,8 +29,10 @@ EXECUTABLE:=flucky
# UNIX_EXECUTABLES
# Define all executables for different architectures and operation systems
UNIX_EXECUTABLES := \
darwin/386/$(EXECUTABLE) \
darwin/amd64/$(EXECUTABLE) \
freebsd/amd64/$(EXECUTABLE) \
linux/386/$(EXECUTABLE) \
linux/amd64/$(EXECUTABLE) \
linux/arm/5/$(EXECUTABLE) \
linux/arm/7/$(EXECUTABLE) \
@ -49,20 +51,13 @@ COMPRESSED_EXECUTABLE_TARGETS=$(COMPRESSED_EXECUTABLES:%=bin/%)
# To avoid a conflict with an existing file and a defined make step
.PHONY: clean container/${EXECUTABLE_TARGETS} container/test release remote test
all: ${EXECUTABLE}
$(EXECUTABLE): bindata
go build -ldflags "-X main.version=${VERSION}" -o "$@"
bin/tmp/${EXECUTABLE}: bindata
go build -ldflags "-X main.version=${VERSION}" -o "$@"
all: ${EXECUTABLE_TARGETS}
# arm
bin/linux/arm/5/${EXECUTABLE}: bindata
GOARM=5 GOARCH=arm go build -ldflags "-X main.version=${VERSION}" -o "$@"
bin/linux/arm/7/${EXECUTABLE}: bindata
GOARM=7 GOARCH=arm go build -ldflags "-X main.version=${VERSION}" -o "$@"
container/bin/tmp/${EXECUTABLE}:
$(MAKE) container-run COMMAND=$(subst container/,,$@)
# 386
bin/darwin/386/$(EXECUTABLE): bindata
@ -81,10 +76,19 @@ bin/darwin/amd64/$(EXECUTABLE): bindata
bin/linux/amd64/$(EXECUTABLE): bindata
GOARCH=amd64 GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o "$@"
# arm
bin/linux/arm/5/${EXECUTABLE}: bindata
GOARM=5 GOARCH=arm go build -ldflags "-X main.version=${VERSION}" -o "$@"
bin/linux/arm/7/${EXECUTABLE}: bindata
GOARM=7 GOARCH=arm go build -ldflags "-X main.version=${VERSION}" -o "$@"
bindata:
go-bindata -pkg db -o ./pkg/db/bindataSQL.go ./pkg/db/sql/***
go-bindata -pkg goldenfiles -o ./test/goldenfiles/bindata.go ./test/goldenfiles/json/***
%.tar.bz2: %
tar --create --bzip2 --file "$@" "$<"
@ -98,7 +102,6 @@ bindata:
test: ${EXECUTABLE}
go test -v ./pkg/...
release: clean
$(MAKE) $(COMPRESSED_EXECUTABLE_TARGETS)
github-release release \
@ -114,15 +117,45 @@ clean:
rm --recursive --force bin/ || true
container/all:
$(MAKE) container-run COMMAND=all
# container
container/${EXECUTABLE}:
$(MAKE) container-run COMMAND=$(subst container/,,$@)
container/all:
$(MAKE) container-run COMMAND=$(subst container/,,$@)
container/test:
$(MAKE) container-run COMMAND=test
$(MAKE) container-run COMMAND=$(subst container/,,$@)
container/release:
$(MAKE) container-run COMMAND=release
$(MAKE) container-run COMMAND=$(subst container/,,$@)
# container - 386
container/bin/darwin/386/$(EXECUTABLE):
$(MAKE) container-run COMMAND=$(subst container/,,$@)
container/bin/linux/386/$(EXECUTABLE):
$(MAKE) container-run COMMAND=$(subst container/,,$@)
# container - amd
container/bin/freebsd/amd64/$(EXECUTABLE):
$(MAKE) container-run COMMAND=$(subst container/,,$@)
container/bin/darwin/amd64/$(EXECUTABLE):
$(MAKE) container-run COMMAND=$(subst container/,,$@)
container/bin/linux/amd64/$(EXECUTABLE):
$(MAKE) container-run COMMAND=$(subst container/,,$@)
# container - arm
container/bin/linux/arm/7/${EXECUTABLE}:
$(MAKE) container-run COMMAND=$(subst container/,,$@)
container/bin/linux/arm/5/${EXECUTABLE}:
$(MAKE) container-run COMMAND=$(subst container/,,$@)
container-run:
${CONTAINER_RUNTIME} run \