This commit is contained in:
aynic.os
2021-06-06 16:29:54 +02:00
parent 85ffdb7096
commit 3a9ddae015
26 changed files with 183 additions and 158 deletions
+10 -13
View File
@@ -33,9 +33,6 @@ build: docker-compose-build ## Build application docker images
# on local host
.PHONY: build@% app-build
build@%: myos-base
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(eval docker_images += $(foreach service,$(SERVICES),$(if $(shell docker images -q $(DOCKER_REPOSITORY)/$(service):$(DOCKER_IMAGE_TAG) 2>/dev/null),$(service))))
$(eval build_app := $(or $(filter $(DOCKER_BUILD_CACHE),false),$(filter-out $(docker_images),$(SERVICES))))
$(if $(build_app), \
@@ -75,7 +72,7 @@ connect@%: SERVICE ?= $(DOCKER_SERVICE)
connect@%:
$(call make,ssh-connect,$(MYOS),APP SERVICE)
# target deploy: Fire deploy@ENV
# target deploy: Fire deploy@% for ENV
.PHONY: deploy
deploy: deploy@$(ENV) ## Deploy application dockers
@@ -84,7 +81,7 @@ deploy: deploy@$(ENV) ## Deploy application dockers
.PHONY: down
down: docker-compose-down ## Remove application dockers
# target exec: Exec command in docker SERVICE
# target exec: Exec ARGS in docker SERVICE
# on local host
.PHONY: exec
exec: ## Exec command in docker SERVICE
@@ -94,7 +91,7 @@ else
$(call make,docker-compose-exec,,ARGS)
endif
# target exec@%: Exec command in docker SERVICE of % ENV
# target exec@%: Exec ARGS in docker SERVICE of % ENV
# on all remote hosts
.PHONY: exec@%
exec@%: SERVICE ?= $(DOCKER_SERVICE)
@@ -104,7 +101,7 @@ exec@%:
# target install app-install: Install application
# on local host
.PHONY: install app-install
install: app-install ## Install application
install: update-app app-install ## Install application
# target logs: Display application dockers logs
# on local host
@@ -132,7 +129,7 @@ rebuild@%:
.PHONY: recreate
recreate: docker-compose-recreate app-start ## Recreate application dockers
# target reinstall: Fire clean and call install target
# target reinstall: Fire clean, Call .env target, Call install target
# on local host
.PHONY: reinstall
reinstall: clean ## Reinstall application
@@ -148,7 +145,7 @@ release: release-create ## Create release VERSION
.PHONY: restart
restart: docker-compose-restart app-start ## Restart application
# target run: Run command in a new docker SERVICE
# target run: Run command ARGS in a new docker SERVICE
# on local host
.PHONY: run
run: ## Run a command in a new docker
@@ -158,7 +155,7 @@ else
$(call make,docker-compose-run,,ARGS)
endif
# target run@%: Run command in a new docker SERVICE of % ENV
# target run@%: Run command ARGS in a new docker SERVICE of % ENV
# on all remote hosts
.PHONY: run@%
run@%: SERVICE ?= $(DOCKER_SERVICE)
@@ -182,7 +179,7 @@ ssh@%:
stack:
$(foreach stackz,$(STACK),$(call docker-stack,$(stackz)))
# target stack-%: Call docker-compose-% target on a given stack
# target stack-%: Call docker-compose-% target on STACK
## it splits % on dashes and extracts stack from the beginning and command from
## the last part of %
## ex: stack-base-up will fire the docker-compose-up target in the base stack
@@ -194,9 +191,9 @@ stack-%:
$(if $(filter $(command),$(filter-out %-%,$(patsubst docker-compose-%,%,$(filter docker-compose-%,$(MAKE_TARGETS))))), \
$(call make,docker-compose-$(command) STACK="$(stack)" $(if $(filter node,$(stack)),COMPOSE_PROJECT_NAME=$(COMPOSE_PROJECT_NAME_NODE)),,ARGS COMPOSE_IGNORE_ORPHANS SERVICE)))
# target start: Start application dockers
# target start app-start: Start application dockers
# on local host
.PHONY: start
.PHONY: start app-start
start: docker-compose-start ## Start application dockers
# target stop: Stop application dockers
+4 -1
View File
@@ -2,6 +2,8 @@ APP_DIR ?= $(CURDIR)
APP_DOMAIN ?= $(ENV)$(addprefix .,$(DOMAIN))
APP_HOST ?= $(APP)$(addprefix .,$(APP_DOMAIN))
APP_PARAMETERS_REPOSITORY ?= $(GIT_PARAMETERS_REPOSITORY)
APP_PARENT ?= $(MONOREPO)
APP_PARENT_DIR ?= $(MONOREPO_DIR)
APP_PATH ?= /$(APP_PATH_PREFIX)
APP_REPOSITORY ?= $(GIT_REPOSITORY)
APP_SCHEME ?= https
@@ -9,9 +11,10 @@ APP_UPSTREAM_REPOSITORY ?= $(or $(shell git config --get remote.upstream
APP_URI ?= $(APP_HOST)$(APP_PATH)
APP_URL ?= $(APP_SCHEME)://$(APP_URI)
BUILD_ENV_VARS ?= APP BRANCH COMMIT DEPLOY_HOOK_URL ENV VERSION
CONTEXT_DEBUG += APP_DIR APP_DOMAIN APP_HOST APP_PATH APP_URL APP_REPOSITORY APP_UPSTREAM_REPOSITORY APP_PARAMETERS_REPOSITORY CONSUL_HTTP_TOKEN
CONTEXT_DEBUG += APP_DIR APP_DOMAIN APP_HOST APP_PATH APP_URL APP_REPOSITORY APP_UPSTREAM_REPOSITORY APP_PARAMETERS_REPOSITORY CONSUL_HTTP_TOKEN SERVICES
ENV_DEPLOY ?= $(shell ls .git/refs/heads/)
ENV_VARS += APP_DIR APP_DOMAIN APP_HOST APP_PATH APP_URL CONSUL_HTTP_TOKEN $(if $(filter true,$(MOUNT_NFS)),NFS_CONFIG)
MOUNT_NFS ?= false
NFS_CONFIG ?= addr=$(NFS_HOST),actimeo=3,intr,noacl,noatime,nocto,nodiratime,nolock,soft,rsize=32768,wsize=32768,tcp,rw,vers=3
NFS_HOST ?= host.docker.internal
SERVICES ?= $(eval DRYRUN_IGNORE := true) $(shell $(call docker-compose,--log-level critical config --services)) $(eval DRYRUN_IGNORE := false)
+6 -48
View File
@@ -1,7 +1,7 @@
##
# DOCKER
# target docker-build: Fire docker-images-myos and call docker-build-% target for each DOCKER_IMAGES
# target docker-build: Fire docker-images-myos, Call docker-build-% target for each DOCKER_IMAGES
.PHONY: docker-build
docker-build: docker-images-myos
$(foreach image,$(or $(SERVICE),$(DOCKER_IMAGES)),$(call make,docker-build-$(image)))
@@ -17,25 +17,16 @@ docker-build-%:
# target docker-commit: Call docker-commit for each SERVICES
.PHONY: docker-commit
docker-commit:
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(foreach service,$(or $(SERVICE),$(SERVICES)),$(call docker-commit,$(service)))
# target docker-commit-%: Call docker-commit with tag % for each SERVICES
.PHONY: docker-commit-%
docker-commit-%:
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(foreach service,$(or $(SERVICE),$(SERVICES)),$(call docker-commit,$(service),,,$*))
# target docker-compose-build: Fire docker-images-myos and call docker-compose build SERVICE
# target docker-compose-build: Fire docker-images-myos, Call docker-compose build SERVICE
.PHONY: docker-compose-build
docker-compose-build: docker-images-myos
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(call docker-compose,build $(if $(filter $(DOCKER_BUILD_NO_CACHE),true),--pull --no-cache) $(if $(filter $(SERVICE),$(SERVICES)),$(SERVICE)))
# target docker-compose-config: Call docker-compose config
@@ -52,9 +43,6 @@ docker-compose-connect:
# target docker-compose-down: Call docker-compose rm SERVICE or docker-compose down
.PHONY: docker-compose-down
docker-compose-down:
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(if $(filter $(SERVICE),$(SERVICES)),$(call docker-compose,rm -fs $(SERVICE)),$(call docker-compose,down $(DOCKER_COMPOSE_DOWN_OPTIONS)))
# target docker-compose-exec: Call docker-compose-exec SERVICE ARGS
@@ -66,9 +54,6 @@ docker-compose-exec:
# target docker-compose-logs: Call docker-compose logs SERVICE
.PHONY: docker-compose-logs
docker-compose-logs:
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(call docker-compose,logs -f --tail=100 $(if $(filter $(SERVICE),$(SERVICES)),$(SERVICE))) || true
# target docker-compose-ps: Call docker-compose ps
@@ -88,17 +73,11 @@ docker-compose-recreate: docker-compose-rm docker-compose-up
# target docker-compose-restart: Call docker-compose restart SERVICE
.PHONY: docker-compose-restart
docker-compose-restart:
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(call docker-compose,restart $(if $(filter $(SERVICE),$(SERVICES)),$(SERVICE)))
# target docker-compose-rm: Call docker-compose rm SERVICE
.PHONY: docker-compose-rm
docker-compose-rm:
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(call docker-compose,rm -fs $(if $(filter $(SERVICE),$(SERVICES)),$(SERVICE)))
# target docker-compose-run: Call docker-compose run SERVICE ARGS
@@ -116,25 +95,16 @@ docker-compose-scale:
# target docker-compose-start: Call docker-compose start SERVICE
.PHONY: docker-compose-start
docker-compose-start:
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(call docker-compose,start $(if $(filter $(SERVICE),$(SERVICES)),$(SERVICE)))
# target docker-compose-stop: Call docker-compose stop SERVICE
.PHONY: docker-compose-stop
docker-compose-stop:
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(call docker-compose,stop $(if $(filter $(SERVICE),$(SERVICES)),$(SERVICE)))
# target docker-compose-up: Fire docker-image-myos and call docker-compose up SERVICE
# target docker-compose-up: Fire docker-image-myos, Call docker-compose up SERVICE
.PHONY: docker-compose-up
docker-compose-up: docker-images-myos
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(call docker-compose,up $(DOCKER_COMPOSE_UP_OPTIONS) $(if $(filter $(SERVICE),$(SERVICES)),$(SERVICE)))
# target docker-images-myos: Call myos-docker-build-% target for each DOCKER_IMAGES_MYOS
@@ -152,7 +122,7 @@ docker-images-rm:
docker-images-rm-%:
docker images |awk '$$1 ~ /^$(subst /,\/,$*)/ {print $$3}' |sort -u |while read image; do docker rmi -f $$image; done
# target docker-login: Exec docker login
# target docker-login: Exec 'docker login'
.PHONY: docker-login
docker-login: myos-base
$(ECHO) docker login
@@ -161,7 +131,7 @@ docker-login: myos-base
.PHONY: docker-network-create
docker-network-create: docker-network-create-$(DOCKER_NETWORK)
# target docker-network-create-%: Create docker network %
# target docker-network-create-%: Exec 'docker network create %'
.PHONY: docker-network-create-%
docker-network-create-%:
[ -n "$(shell docker network ls -q --filter name='^$*$$' 2>/dev/null)" ] \
@@ -177,7 +147,7 @@ docker-network-rm-%:
[ -z "$(shell docker network ls -q --filter name='^$*$$' 2>/dev/null)" ] \
|| { echo -n "Removing docker network $* ... " && $(ECHO) docker network rm $* >/dev/null 2>&1 && echo "done" || echo "ERROR"; }
# target docker-plugin-install: Install docker plugin DOCKER_PLUGIN with DOCKER_PLUGIN_OPTIONS
# target docker-plugin-install: Exec 'docker plugin install DOCKER_PLUGIN_OPTIONS DOCKER_PLUGIN'
.PHONY: docker-plugin-install
docker-plugin-install:
$(eval docker_plugin_state := $(shell docker plugin ls | awk '$$2 == "$(DOCKER_PLUGIN)" {print $$NF}') )
@@ -187,9 +157,6 @@ docker-plugin-install:
.PHONY: docker-push
docker-push:
ifneq ($(filter $(DEPLOY),true),)
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(foreach service,$(or $(SERVICE),$(SERVICES)),$(call docker-push,$(service)))
else
printf "${COLOR_BROWN}WARNING${COLOR_RESET}: ${COLOR_GREEN}target${COLOR_RESET} $@ ${COLOR_GREEN}not enabled in${COLOR_RESET} $(APP).\n" >&2
@@ -199,9 +166,6 @@ endif
.PHONY: docker-push-%
docker-push-%:
ifneq ($(filter $(DEPLOY),true),)
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(foreach service,$(or $(SERVICE),$(SERVICES)),$(call docker-push,$(service),,$*))
else
printf "${COLOR_BROWN}WARNING${COLOR_RESET}: ${COLOR_GREEN}target${COLOR_RESET} $@ ${COLOR_GREEN}not enabled in${COLOR_RESET} $(APP).\n" >&2
@@ -245,9 +209,6 @@ docker-run-%: docker-build-%
.PHONY: docker-tag
docker-tag:
ifneq ($(filter $(DEPLOY),true),)
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(foreach service,$(or $(SERVICE),$(SERVICES)),$(call docker-tag,$(service)))
else
printf "${COLOR_BROWN}WARNING${COLOR_RESET}: ${COLOR_GREEN}target${COLOR_RESET} $@ ${COLOR_GREEN}not enabled in${COLOR_RESET} $(APP).\n" >&2
@@ -257,9 +218,6 @@ endif
.PHONY: docker-tag-%
docker-tag-%:
ifneq ($(filter $(DEPLOY),true),)
$(eval DRYRUN_IGNORE := true)
$(eval SERVICES ?= $(shell $(call docker-compose,--log-level critical config --services)))
$(eval DRYRUN_IGNORE := false)
$(foreach service,$(or $(SERVICE),$(SERVICES)),$(call docker-tag,$(service),,,,$*))
else
printf "${COLOR_BROWN}WARNING${COLOR_RESET}: ${COLOR_GREEN}target${COLOR_RESET} $@ ${COLOR_GREEN}not enabled in${COLOR_RESET} $(APP).\n" >&2
+2 -2
View File
@@ -7,7 +7,7 @@ SSH_PUBLIC_HOST_KEYS ?= $(SSH_REMOTE_HOSTS) $(SSH_BASTION_HOSTNAME)
SSH_PRIVATE_IP_RANGE ?= 10.10.*
SSH_REMOTE_HOSTS ?= github.com gitlab.com
# function ssh-connect: Exec command on remote hosts with tty
# function ssh-connect: Exec command 2 on remote hosts 1 with tty
define ssh-connect
$(eval hosts := $(1))
$(eval command := $(2))
@@ -16,7 +16,7 @@ define ssh-connect
$(foreach host,$(hosts),$(call exec,ssh -t -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no $(user)@$(host) "$(command)") ||) true
endef
# function ssh-exec: Exec command on remote hosts without tty
# function ssh-exec: Exec command 2 on remote hosts 1 without tty
define ssh-exec
$(eval hosts := $(1))
$(eval command := $(2))
+14 -10
View File
@@ -1,22 +1,26 @@
##
# SSH
# target ssh: Call ssh-connect with command SHELL
.PHONY: ssh
ssh: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME) ## Connect to first remote host
$(call ssh-connect,$(AWS_INSTANCE_IP),$(SHELL))
# target get-PrivateIpAddress-%: Fire aws-ec2-get-instances-PrivateIpAddress-%
.PHONY: get-PrivateIpAddress-%
get-PrivateIpAddress-%: aws-ec2-get-instances-PrivateIpAddress-%;
# target ssh-connect: Call ssh-connect with command make connect
# target ssh: Call ssh-connect ARGS or SHELL
.PHONY: ssh
ssh: get-PrivateIpAddress-$(SERVER_NAME) ## Connect to first remote host
$(call ssh-connect,$(AWS_INSTANCE_IP),$(if $(ARGS),$(ARGS),$(SHELL)))
# target ssh-connect: Call ssh-connect make connect SERVICE
.PHONY: ssh-connect
ssh-connect: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME)
ssh-connect: get-PrivateIpAddress-$(SERVER_NAME)
$(call ssh-connect,$(AWS_INSTANCE_IP),make connect $(if $(SERVICE),SERVICE=$(SERVICE)))
# target ssh-connect: Call ssh-connect with command make exec
# target ssh-exec: Call ssh-exec make exec SERVICE ARGS
.PHONY: ssh-exec
ssh-exec: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME)
ssh-exec: get-PrivateIpAddress-$(SERVER_NAME)
$(call ssh-exec,$(AWS_INSTANCE_IP),make exec $(if $(SERVICE),SERVICE=$(SERVICE)) $(if $(ARGS),ARGS='\''"$(ARGS)"'\''))
# target ssh-run: Call ssh-connect with command make run
# target ssh-run: Call ssh-run make run SERVICE ARGS
.PHONY: ssh-run
ssh-run: aws-ec2-get-PrivateIpAddress-$(SERVER_NAME)
ssh-run: get-PrivateIpAddress-$(SERVER_NAME)
$(call ssh-exec,$(AWS_INSTANCE_IP),make run $(if $(SERVICE),SERVICE=$(SERVICE)) $(if $(ARGS),ARGS='\''"$(ARGS)"'\''))
+8
View File
@@ -7,6 +7,14 @@ ifeq ($(SETUP_SYSCTL),true)
$(foreach config,$(SETUP_SYSCTL_CONFIG),$(call docker-run,--privileged alpine:latest,sysctl -q -w $(config)) &&) true
endif
.PHONY: setup-nfsd
setup-nfsd:
ifeq ($(SETUP_NFSD),true)
ifeq ($(HOST_SYSTEM),DARWIN)
$(call setup-nfsd-osx)
endif
endif
define setup-nfsd-osx
$(eval dir:=$(or $(1),$(MONOREPO_DIR)))
$(eval uid:=$(or $(2),$(UID)))
+8 -7
View File
@@ -4,7 +4,7 @@ dquote ?= "
quote ?= '
APP ?= $(if $(wildcard .git),$(notdir $(CURDIR)))
APP_NAME ?= $(APP)
APP_TYPE ?= $(if $(SUBREPO),subrepo) $(if $(MYOS),,myos)
APP_TYPE ?= $(if $(SUBREPO),subrepo) $(if $(filter .,$(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)))
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
@@ -41,15 +41,16 @@ MAKE_ENV_ARGS ?= $(foreach var,$(filter $(ENV_VARS),$(MAKE_ENV
MAKE_ENV_VARS ?= $(strip $(foreach var, $(filter-out .VARIABLES,$(.VARIABLES)), $(if $(filter environment,$(origin $(var))),$(var))))
MAKE_FILE_ARGS ?= $(foreach var,$(filter $(ENV_VARS),$(MAKE_FILE_VARS)),$(var)='$($(var))')
MAKE_FILE_VARS ?= $(strip $(foreach var, $(filter-out .VARIABLES,$(.VARIABLES)), $(if $(filter file,$(origin $(var))),$(var))))
MAKE_OLDFILE ?= $@
MAKE_TARGETS ?= $(filter-out $(.VARIABLES),$(shell $(MAKE) -qp 2>/dev/null |awk -F':' '/^[a-zA-Z0-9][^$$\#\/\t=]*:([^=]|$$)/ {print $$1}' |sort -u))
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)))
MYOS ?= $(if $(filter $(MAKE_DIR),$(call pop,$(MAKE_DIR))),.,$(call pop,$(MAKE_DIR)))
PARAMETERS ?= $(RELATIVE)parameters
QUIET ?= $(if $(filter false,$(VERBOSE)),--quiet)
RECURSIVE ?= true
RELATIVE ?= $(if $(filter myos,$(MYOS)),,../)
RELATIVE ?= $(if $(filter myos,$(MYOS)),./,../)
SHARED ?= $(RELATIVE)shared
SSH_DIR ?= ${HOME}/.ssh
SUBREPO ?= $(if $(wildcard .gitrepo),$(notdir $(CURDIR)))
@@ -129,10 +130,10 @@ define conf
done < "$(file)"
endef
# macro force: Run command sine die
# return never
## it starts command if it is not already running
force = $$(while true; do [ $$(ps x |awk 'BEGIN {nargs=split("'"$$*"'",args)} $$field == args[1] { matched=1; for (i=1;i<=NF-field;i++) { if ($$(i+field) == args[i+1]) {matched++} } if (matched == nargs) {found++} } END {print found+0}' field=4) -eq 0 ] && $(ECHO) $(command) || sleep 1; done)
# macro force: Run command 1 sine die
## it starts command 1 if it is not already running
## it returns never
force = $$(while true; do [ $$(ps x |awk 'BEGIN {nargs=split("'"$$*"'",args)} $$field == args[1] { matched=1; for (i=1;i<=NF-field;i++) { if ($$(i+field) == args[i+1]) {matched++} } if (matched == nargs) {found++} } END {print found+0}' field=4) -eq 0 ] && $(ECHO) $(1) || sleep 1; done)
# macro gid: Return GID of group 1
gid = $(shell grep '^$(1):' /etc/group 2>/dev/null |awk -F: '{print $$3}')
+2 -2
View File
@@ -13,7 +13,7 @@ COLOR_BLUE ?= \033[36m
blank1 blank2:
printf "\n"
# target context: Call context-% for each CONTEXT
# target context: Call context-% target for each CONTEXT
.PHONY: context
context:
printf "${COLOR_BROWN}Context:${COLOR_RESET}\n"
@@ -30,7 +30,7 @@ context-%:
# target doc: Fire functions macros target variables
doc: functions macros targets variables ;
# target doc: Fire functions-% macros-% target-% variables-%
# target doc-%: Fire functions-% macros-% target-% variables-%
doc-%: functions-% macros-% targets-% variables-%;
# target help: Fire usage blank1 target blank2 context
+1 -3
View File
@@ -1,9 +1,7 @@
##
# MYOS
# target myos-%: call % target in MYOS folder
# target myos-%: Call % target in MYOS folder
.PHONY: myos-%
myos-%: ;
ifeq ($(wildcard $(MYOS)),$(MYOS))
$(call make,$*,$(MYOS))
endif
+1 -1
View File
@@ -10,7 +10,7 @@ update-apps:
.PHONY: update-app
update-app: update-app-$(APP_NAME) ;
# target update-app-%: Fire % target
# target update-app-%: Fire myos-base %
.PHONY: update-app-%
update-app-%: myos-base % ;