summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2021-07-24 21:41:19 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2021-07-25 00:20:48 +0200
commit21d5fb43546b3b1f45efc2ca3b35b075490e4317 (patch)
treea3f87665ecf9c5b5a30d6d27a6736e7a23f6440e
parent0ae21ab0673978dbb05c2f50c2277fcaf1a463d9 (diff)
Reorganize files and Makefiles
-rw-r--r--Makefile140
-rw-r--r--etc/docker/image (renamed from etc/docker/images/www)0
-rw-r--r--etc/docker/image.d/build-essential (renamed from etc/docker/images/build-essential)0
-rw-r--r--etc/docker/image.d/nginx (renamed from etc/docker/images/nginx)0
-rw-r--r--lib/www/version/version.sh8
-rw-r--r--libexec/stack.mk7
6 files changed, 35 insertions, 120 deletions
diff --git a/Makefile b/Makefile
index 61d9f29..c7edd25 100644
--- a/Makefile
+++ b/Makefile
@@ -4,66 +4,31 @@
# SPDX-License-Identifier: GPL-2.0-only OR LGPL-2.0-only
########################################################################
-# Do not print "Entering directory ..."
+SHELL := /bin/bash -Eeuo pipefail
+
+MAKEFLAGS += --no-builtin-rules
+MAKEFLAGS += --no-builtin-variables
MAKEFLAGS += --no-print-directory
+MAKEFLAGS += --silent
+MAKEFLAGS += --warn-undefined-variables
DESTDIR =
-prefix = /usr/local
-sysconfdir = $(prefix:/usr=)/etc
-MANDIR_ = $(CURDIR)/src/man-pages/
-htmlbuilddir = $(CURDIR)/tmp/html
srvdir = /srv
wwwdir = $(srvdir)/www
htmlext = .html
-version = $(shell git describe --tags | sed 's/^v//')
-
INSTALL = install
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = $(INSTALL) -m 755 -d
-arch_cur = $(shell uname -m)
-arch = $(shell uname -m)
-config = $(CURDIR)/.config
-
-build = $(CURDIR)/etc/docker/image.d/build-essential
-build_reg = $(shell <$(build) grep '^reg' | cut -f2)
-build_user = $(shell <$(build) grep '^user' | cut -f2)
-build_repo = $(shell <$(build) grep '^repo' | cut -f2)
-build_lbl = $(shell <$(build) grep '^lbl' | cut -f2)
-build_digest = $(shell <$(build) grep '^digest' | grep $(arch_cur) | cut -f3)
-
-nginx = $(CURDIR)/etc/docker/image.d/nginx
-nginx_reg = $(shell <$(nginx) grep '^reg' | cut -f2)
-nginx_user = $(shell <$(nginx) grep '^user' | cut -f2)
-nginx_repo = $(shell <$(nginx) grep '^repo' | cut -f2)
-nginx_lbl = $(shell <$(nginx) grep '^lbl' | cut -f2)
-nginx_digest = $(shell <$(nginx) grep '^digest' | grep $(arch) | cut -f3)
-
-image = $(CURDIR)/etc/docker/image
-reg = $(shell <$(image) grep '^reg' | cut -f2)
-user = $(shell <$(image) grep '^user' | cut -f2)
-repo = $(shell <$(image) grep '^repo' | cut -f2)
-repository = $(reg)/$(user)/$(repo)
-lbl = $(shell <$(image) grep '^lbl' | cut -f2)
-lbl_ = $(version)
-lbl_a = $(lbl_)_$(arch)
-img = $(repository):$(lbl)
-img_a = $(repository):$(lbl_a)
-archs = $(shell <$(config) grep '^archs' | cut -f2 | tr ',' ' ')
-imgs = $(addprefix $(img)_,$(archs))
-digest = $(shell <$(image) grep '^digest' | grep $(arch) | cut -f3)
-digest_ = $(addprefix @,$(digest))
-
-orchestrator = $(shell <$(config) grep '^orchest' | cut -f2)
-stack = $(shell <$(CURDIR)/.config grep '^stack' | cut -f2)
-project = $(shell <$(CURDIR)/.config grep '^project' | cut -f2)
+ROOTDIR = $(CURDIR)
+export ROOTDIR
.PHONY: all
-all: man
+all: image_
########################################################################
-# ./libexec deps.mk
+# ./libexec/deps.mk
.PHONY: deps-build
deps-build:
@@ -74,27 +39,41 @@ deps-run:
$(MAKE) -C $(CURDIR)/libexec/ -f deps.mk $@
########################################################################
-
-.PHONY: config
-config: submodules
-
-.PHONY: submodules
-submodules:
- git submodule init && git submodule update;
+# ./libexec/img.mk
.PHONY: Dockerfile
Dockerfile:
$(MAKE) -C $(CURDIR)/libexec/ -f img.mk $@
+.PHONY: image
+image:
+ $(MAKE) -C $(CURDIR)/libexec/ -f img.mk $@
+
+.PHONY: image_
+image_:
+ $(MAKE) -C $(CURDIR)/libexec/ -f img.mk $@
+
+########################################################################
+# ./libexec/stack.mk
+
.PHONY: digest
digest:
- $(MAKE) -C $(CURDIR)/libexec/ -f img.mk $@
+ $(MAKE) -C $(CURDIR)/libexec/ -f stack.mk $@
+
+.PHONY: stack-deploy
+stack-deploy:
+ $(MAKE) -C $(CURDIR)/libexec/ -f stack.mk $@
+
+.PHONY: stack-rm-stable
+.PHONY: stack-rm-test
+stack-rm-stable stack-rm-test: stack-rm-%:
+ $(MAKE) -C $(CURDIR)/libexec/ -f stack.mk $@
.PHONY: install
install: install-srv
.PHONY: install-srv
-install-srv: install-man | installdirs-srv
+install-srv: | installdirs-srv
@echo ' INSTALL $(DESTDIR)$(srvdir)/**';
@cd srv/ && \
find ./ -type f \
@@ -109,56 +88,3 @@ installdirs-srv:
|while read d; do \
$(INSTALL_DIR) "$(DESTDIR)$(srvdir)/$$d" || exit $$?; \
done;
-
-.PHONY: image
-image: submodules
- @for arch in $(archs); do \
- $(MAKE) image-build arch=$${arch} || exit $$?; \
- $(MAKE) image-push arch=$${arch} || exit $$?; \
- done;
- @sed -Ei 's/lbl .*/lbl $(lbl_)/' $(www);
- @$(MAKE) image-manifest;
-
-.PHONY: image-build
-image-build: Dockerfile
- @echo ' DOCKER image build $(img_a)';
- @docker image build -t '$(img_a)' $(CURDIR) >/dev/null;
-
-.PHONY: image-push
-image-push:
- @echo ' DOCKER image push $(img_a)';
- @docker image push '$(img_a)' \
- |grep 'digest:' \
- |sed -E 's/.*digest: ([^ ]+) .*/\1/' \
- |while read d; do \
- sed -Ei "s/^(digest $(arch)).*/\1 $${d}/" $(www); \
- done;
-
-.PHONY: image-manifest
-image-manifest:
- @$(MAKE) image-manifest-create;
- @$(MAKE) image-manifest-push;
-
-.PHONY: image-manifest-create
-image-manifest-create:
- @echo ' DOCKER manifest create $(img)';
- @docker manifest create '$(img)' $(imgs) >/dev/null;
-
-.PHONY: image-manifest-push
-image-manifest-push:
- @echo ' DOCKER manifest push $(img)';
- @docker manifest push '$(img)' >/dev/null;
-
-.PHONY: stack-deploy
-stack-deploy: digest
- @echo ' STACK deploy $(orchestrator) $(stack)';
- @alx_stack_deploy -o '$(orchestrator)' '$(stack)';
-
-.PHONY: stack-rm-stable
-.PHONY: stack-rm-test
-stack-rm-stable stack-rm-test: stack-rm-%:
- @echo ' STACK rm $(orchestrator) $(project)-$*';
- @alx_stack_delete -o '$(orchestrator)' '$(project)-$*';
-
-.PHONY: clean
-clean: clean-man
diff --git a/etc/docker/images/www b/etc/docker/image
index 7a58285..7a58285 100644
--- a/etc/docker/images/www
+++ b/etc/docker/image
diff --git a/etc/docker/images/build-essential b/etc/docker/image.d/build-essential
index 41d6eb8..41d6eb8 100644
--- a/etc/docker/images/build-essential
+++ b/etc/docker/image.d/build-essential
diff --git a/etc/docker/images/nginx b/etc/docker/image.d/nginx
index b63fd6a..b63fd6a 100644
--- a/etc/docker/images/nginx
+++ b/etc/docker/image.d/nginx
diff --git a/lib/www/version/version.sh b/lib/www/version/version.sh
index b1e5ed2..852154e 100644
--- a/lib/www/version/version.sh
+++ b/lib/www/version/version.sh
@@ -11,7 +11,7 @@ function update_version()
local _d="$(dirname "${BASH_SOURCE[0]}")";
local _D="${_d}/../../..";
- local www="${_D}/etc/docker/images/www";
+ local www="${_D}/etc/docker/image";
local dk_reg="$(<${www} grep '^reg' | cut -f2)";
local dk_user="$(<${www} grep '^user' | cut -f2)";
@@ -19,13 +19,9 @@ function update_version()
local dk_repository="${dk_reg}/${dk_user}/${dk_repo}";
sed "\%^lbl %s% .*% ${version}%" \
- -i ${_D}/etc/docker/images/www;
+ -i ${_D}/etc/docker/image;
sed "\%${dk_repository}:%s%${dk_repo}:.*\"%${dk_repo}:${version}\"%" \
-i ${_D}/etc/kubernetes/manifests/030_deploy.yaml;
- sed "\%${dk_repository}:%s%${dk_repo}:.*\"%${dk_repo}:${version}\"%" \
- -i ${_D}/etc/swarm/manifests/compose.yaml;
- sed "\%Version:%s%\(<.*>\)\(.*\)\(</.*>\)%\1${version}\3%" \
- -i ${_D}/srv/www/index.html;
sed "\%^version %s% .*% ${version}%" \
-i ${_D}/.config;
}
diff --git a/libexec/stack.mk b/libexec/stack.mk
index c9a4213..2c69db1 100644
--- a/libexec/stack.mk
+++ b/libexec/stack.mk
@@ -75,13 +75,6 @@ deps-run:
########################################################################
-.PHONY: config
-config: submodules
-
-.PHONY: submodules
-submodules:
- git submodule init && git submodule update;
-
.PHONY: Dockerfile
Dockerfile:
@echo ' Update Dockerfile ARGs';