Makefile: rely on targets in deb/rpm

Instead of dynamically getting list of distros to build for,
rely on the corresponding targets in sub-Makefiles. This also
ensures that deb/Makefile and rpm/Makefile will have up-to-date
list of distros included.

This also fixes the following bug:

> $ make deb
> for p in raspbian-stretch ubuntu-bionic ubuntu-disco ubuntu-xenial debbuild/ubuntu-disco ubuntu-cosmic debian-buster debian-stretch; do \
> ...

As you can see, `debbuild/ubuntu-disco` should not be included but it
is. Could be prevented by using `-maxdepth 1` argument to `find`.

While at it, amend the sub-Makefiles to print out the distro
that we build for.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2019-07-01 12:41:08 -07:00
Родитель 62a8258474
Коммит 8ac858c666
3 изменённых файлов: 4 добавлений и 8 удалений

Просмотреть файл

@ -36,18 +36,12 @@ clean: clean-image ## remove build artifacts
$(MAKE) -C static clean
.PHONY: rpm
rpm: DOCKER_BUILD_PKGS:=$(shell find rpm -type d | grep ".*-.*" | sed 's/^rpm\///')
rpm: ## build rpm packages
for p in $(DOCKER_BUILD_PKGS); do \
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \
done
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) rpm
.PHONY: deb
deb: DOCKER_BUILD_PKGS:=$(shell find deb -type d | grep ".*-.*" | sed 's/^deb\///')
deb: ## build deb packages
for p in $(DOCKER_BUILD_PKGS); do \
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \
done
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) deb
.PHONY: static
static: DOCKER_BUILD_PKGS:=static-linux cross-mac cross-win cross-arm

Просмотреть файл

@ -73,6 +73,7 @@ raspbian: $(RASPBIAN_VERSIONS) ## build all raspbian deb packages
.PHONY: $(DISTROS)
$(DISTROS): $(SOURCES)
@echo "== Building packages for $@ =="
$(BUILD)
$(RUN)
$(CHOWN) -R $(shell id -u):$(shell id -g) debbuild/$@

Просмотреть файл

@ -71,6 +71,7 @@ centos: $(CENTOS_RELEASES) ## build all centos rpm packages
.PHONY: $(FEDORA_RELEASES) $(CENTOS_RELEASES)
$(FEDORA_RELEASES) $(CENTOS_RELEASES): $(SOURCES)
@echo "== Building packages for $@ =="
$(CHOWN) -R root:root rpmbuild
$(BUILD)
$(RUN)