From f510f626ab9ced40c7decd12a8a7e7549333d174 Mon Sep 17 00:00:00 2001 From: "aynic.os" Date: Tue, 1 Jun 2021 00:52:21 +0200 Subject: [PATCH] wip --- make/apps/common.mk | 3 +-- make/apps/def.mk | 1 - make/def.mk | 2 ++ make/help.mk | 1 + make/update.mk | 17 +++++++++++++---- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/make/apps/common.mk b/make/apps/common.mk index 7a1f966..5a5ff82 100644 --- a/make/apps/common.mk +++ b/make/apps/common.mk @@ -111,12 +111,11 @@ tests: app-tests ## Test application up: docker-compose-up app-start ## Create application dockers .PHONY: update app-update -update: app-update ## Update application +update: update-app app-update ## Update application # target %: Always fired target ## this target is fired everytime make is runned to call the stack target and ## update COMPOSE_FILE variable with all .yml files of the current project stack -.PHONY: FORCE %: FORCE stack %-rule-exists ; # target %-rule-exists: Print a warning message if $* target does not exists diff --git a/make/apps/def.mk b/make/apps/def.mk index 3fa4f7a..e22cbf9 100644 --- a/make/apps/def.mk +++ b/make/apps/def.mk @@ -1,7 +1,6 @@ APP_DIR ?= $(CURDIR) APP_DOMAIN ?= $(ENV)$(addprefix .,$(DOMAIN)) APP_HOST ?= $(APP)$(addprefix .,$(APP_DOMAIN)) -APP_NAME ?= $(APP) APP_PARAMETERS_REPOSITORY ?= $(GIT_PARAMETERS_REPOSITORY) APP_PATH ?= /$(APP_PATH_PREFIX) APP_REPOSITORY ?= $(GIT_REPOSITORY) diff --git a/make/def.mk b/make/def.mk index 97cd86f..1039066 100644 --- a/make/def.mk +++ b/make/def.mk @@ -3,6 +3,7 @@ dollar ?= $ dquote ?= " quote ?= ' APP ?= $(if $(wildcard .git),$(notdir $(CURDIR))) +APP_NAME ?= $(APP) APP_TYPE ?= $(if $(SUBREPO),subrepo) $(if $(MYOS),,myos) APPS ?= $(if $(MONOREPO),$(sort $(patsubst $(MONOREPO_DIR)/%/.git,%,$(wildcard $(MONOREPO_DIR)/*/.git)))) APPS_NAME ?= $(foreach app,$(APPS),$(or $(shell awk -F '=' '$$1 == "APP" {print $$2}' $(or $(wildcard $(MONOREPO_DIR)/$(app)/.env),$(wildcard $(MONOREPO_DIR)/$(app)/.env.$(ENV)),$(MONOREPO_DIR)/$(app)/.env.dist) 2>/dev/null),$(app))) @@ -44,6 +45,7 @@ MAKE_VARS ?= ENV MONOREPO ?= $(if $(filter myos,$(MYOS)),$(notdir $(CURDIR)),$(if $(APP),$(notdir $(realpath $(CURDIR)/..)))) MONOREPO_DIR ?= $(if $(MONOREPO),$(if $(filter myos,$(MYOS)),$(realpath $(CURDIR)),$(if $(APP),$(realpath $(CURDIR)/..)))) MYOS ?= $(if $(filter $(MAKE_DIR),$(call pop,$(MAKE_DIR))),,$(call pop,$(MAKE_DIR))) +QUIET ?= $(if $(filter false,$(VERBOSE)),--quiet) RECURSIVE ?= true SHARED ?= shared SSH_DIR ?= ${HOME}/.ssh diff --git a/make/help.mk b/make/help.mk index 207c63e..1a5ecf4 100644 --- a/make/help.mk +++ b/make/help.mk @@ -3,6 +3,7 @@ COLOR_RESET ?= \033[0m COLOR_GREEN ?= \033[32m COLOR_BROWN ?= \033[33m COLOR_BLUE ?= \033[36m +.PHONY: FORCE ## # HELP diff --git a/make/update.mk b/make/update.mk index 6d6dd52..5dd9eba 100644 --- a/make/update.mk +++ b/make/update.mk @@ -1,11 +1,20 @@ ## # UPDATE -.PHONY: update-parameters -update-app: $(APP) ## Update application source files +.PHONY: update-apps +update-apps: + $(foreach app,$(APPS),$(call make,update-app APP_NAME=$(app))) -$(APP): myos-base - $(call exec,[ -d ../$(APP) ] && cd ../$(APP) && git pull --quiet origin $(BRANCH) || git clone --quiet $(APP_REPOSITORY) ../$(APP)) +.PHONY: update-app +update-app: update-app-$(APP_NAME) ; ## Update application source files + +.PHONY: update-app-% +update-app-%: myos-base % ; + +.PHONY: $(APP) +$(APP): APP_DIR := $(if $(filter myos,$(MYOS)),,../)$(APP) +$(APP): + $(call exec,[ -d $(APP_DIR) ] && cd $(APP_DIR) && git pull $(QUIET) origin $(BRANCH) || git clone $(QUIET) $(APP_REPOSITORY) $(APP_DIR)) ## Update /etc/hosts .PHONY: update-hosts