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