2018-04-11 00:23:07 -06:00
|
|
|
BIN_IMAGE = blockbook-build
|
|
|
|
DEB_IMAGE = blockbook-build-deb
|
2018-04-10 03:53:33 -06:00
|
|
|
PACKAGER = $(shell id -u):$(shell id -g)
|
2021-02-17 07:21:58 -07:00
|
|
|
BASE_IMAGE = $$(awk -F= '$$1=="ID" { print $$2 ;}' /etc/os-release):$$(awk -F= '$$1=="VERSION_ID" { print $$2 ;}' /etc/os-release | tr -d '"')
|
2018-04-11 00:23:07 -06:00
|
|
|
NO_CACHE = false
|
2021-02-17 05:30:19 -07:00
|
|
|
TCMALLOC =
|
2018-06-12 05:35:13 -06:00
|
|
|
ARGS ?=
|
2018-04-10 03:53:33 -06:00
|
|
|
|
2018-07-26 06:49:14 -06:00
|
|
|
TARGETS=$(subst .json,, $(shell ls configs/coins))
|
|
|
|
|
2018-04-11 00:23:07 -06:00
|
|
|
.PHONY: build build-debug test deb
|
2018-04-10 03:53:33 -06:00
|
|
|
|
2018-04-11 00:23:07 -06:00
|
|
|
build: .bin-image
|
2020-11-13 04:55:39 -07:00
|
|
|
docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(BIN_IMAGE) make build ARGS="$(ARGS)"
|
2018-04-10 03:53:33 -06:00
|
|
|
|
2018-04-11 00:23:07 -06:00
|
|
|
build-debug: .bin-image
|
2020-11-13 04:55:39 -07:00
|
|
|
docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(BIN_IMAGE) make build-debug ARGS="$(ARGS)"
|
2018-04-10 03:53:33 -06:00
|
|
|
|
2018-04-11 00:23:07 -06:00
|
|
|
test: .bin-image
|
2020-11-13 04:55:39 -07:00
|
|
|
docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" --network="host" $(BIN_IMAGE) make test ARGS="$(ARGS)"
|
2018-04-10 03:53:33 -06:00
|
|
|
|
2018-10-05 06:59:18 -06:00
|
|
|
test-integration: .bin-image
|
2020-11-13 04:55:39 -07:00
|
|
|
docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" --network="host" $(BIN_IMAGE) make test-integration ARGS="$(ARGS)"
|
2018-10-05 06:59:18 -06:00
|
|
|
|
2018-04-13 08:29:00 -06:00
|
|
|
test-all: .bin-image
|
2020-11-13 04:55:39 -07:00
|
|
|
docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" --network="host" $(BIN_IMAGE) make test-all ARGS="$(ARGS)"
|
2018-04-13 08:29:00 -06:00
|
|
|
|
2018-07-26 06:49:14 -06:00
|
|
|
deb-backend-%: .deb-image
|
2020-11-13 04:55:39 -07:00
|
|
|
docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(DEB_IMAGE) /build/build-deb.sh backend $* $(ARGS)
|
2018-07-26 06:49:14 -06:00
|
|
|
|
|
|
|
deb-blockbook-%: .deb-image
|
2020-11-13 04:55:39 -07:00
|
|
|
docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(DEB_IMAGE) /build/build-deb.sh blockbook $* $(ARGS)
|
2018-07-26 06:49:14 -06:00
|
|
|
|
|
|
|
deb-%: .deb-image
|
2020-11-13 04:55:39 -07:00
|
|
|
docker run -t --rm -e PACKAGER=$(PACKAGER) -v "$(CURDIR):/src" -v "$(CURDIR)/build:/out" $(DEB_IMAGE) /build/build-deb.sh all $* $(ARGS)
|
2018-04-11 00:23:07 -06:00
|
|
|
|
2018-10-03 04:45:33 -06:00
|
|
|
deb-blockbook-all: clean-deb $(addprefix deb-blockbook-, $(TARGETS))
|
|
|
|
|
2018-07-26 06:49:14 -06:00
|
|
|
$(addprefix all-, $(TARGETS)): all-%: clean-deb build-images deb-%
|
2018-05-28 07:22:02 -06:00
|
|
|
|
2018-07-26 06:49:14 -06:00
|
|
|
all: clean-deb build-images $(addprefix deb-, $(TARGETS))
|
2018-05-28 07:22:02 -06:00
|
|
|
|
2018-10-15 06:58:40 -06:00
|
|
|
build-images: clean-images
|
2018-04-11 00:23:07 -06:00
|
|
|
$(MAKE) .bin-image .deb-image
|
|
|
|
|
|
|
|
.bin-image:
|
2018-10-17 05:04:03 -06:00
|
|
|
@if [ $$(build/tools/image_status.sh $(BIN_IMAGE):latest build/docker) != "ok" ]; then \
|
2021-02-17 07:21:58 -07:00
|
|
|
echo "Building image $(BIN_IMAGE) from $(BASE_IMAGE)"; \
|
|
|
|
docker build --no-cache=$(NO_CACHE) --build-arg TCMALLOC=$(TCMALLOC) --build-arg BASE_IMAGE=$(BASE_IMAGE) -t $(BIN_IMAGE) build/docker/bin; \
|
2018-10-17 05:04:03 -06:00
|
|
|
else \
|
|
|
|
echo "Image $(BIN_IMAGE) is up to date"; \
|
2018-10-15 06:58:40 -06:00
|
|
|
fi
|
2018-04-11 00:23:07 -06:00
|
|
|
|
2018-05-15 08:34:27 -06:00
|
|
|
.deb-image: .bin-image
|
2018-10-17 05:04:03 -06:00
|
|
|
@if [ $$(build/tools/image_status.sh $(DEB_IMAGE):latest build/docker) != "ok" ]; then \
|
2018-10-15 06:58:40 -06:00
|
|
|
echo "Building image $(DEB_IMAGE)..."; \
|
|
|
|
docker build --no-cache=$(NO_CACHE) -t $(DEB_IMAGE) build/docker/deb; \
|
2018-10-17 05:04:03 -06:00
|
|
|
else \
|
|
|
|
echo "Image $(DEB_IMAGE) is up to date"; \
|
2018-10-15 06:58:40 -06:00
|
|
|
fi
|
2018-04-11 00:23:07 -06:00
|
|
|
|
|
|
|
clean: clean-bin clean-deb
|
|
|
|
|
|
|
|
clean-all: clean clean-images
|
|
|
|
|
|
|
|
clean-bin:
|
2018-05-28 07:22:02 -06:00
|
|
|
find build -maxdepth 1 -type f -executable -delete
|
2018-04-11 00:23:07 -06:00
|
|
|
|
|
|
|
clean-deb:
|
2018-07-31 06:38:38 -06:00
|
|
|
rm -rf build/pkg-defs
|
2018-04-10 03:53:33 -06:00
|
|
|
rm -f build/*.deb
|
2018-04-11 00:23:07 -06:00
|
|
|
|
|
|
|
clean-images: clean-bin-image clean-deb-image
|
2018-10-17 03:03:14 -06:00
|
|
|
rm -f .bin-image .deb-image # remove obsolete tag files
|
2018-04-11 00:23:07 -06:00
|
|
|
|
|
|
|
clean-bin-image:
|
|
|
|
- docker rmi $(BIN_IMAGE)
|
|
|
|
|
|
|
|
clean-deb-image:
|
|
|
|
- docker rmi $(DEB_IMAGE)
|