base.mk 1.22 KB
Newer Older
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
1
export
2
NAME ?= $(shell basename $(CURDIR))
3
4
VERSION ?= $(shell git describe --tags --dirty 2>/dev/null)

5
6
ifeq ($(VERSION),)
	VERSION:="unknown"
7
8
endif

9
10
# Get the location of this makefile.
MK_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
11

12
13
-include .env
-include ../.env
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
14

15
16
17
18
help:           ## Show this help.
	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/\(.*:\)[^#]*##\s*\(.*\)/\1\t\2/' | column -t -s "	"

config:  ## Load config from the environment. You should run it once in every session before other tasks. Run: eval $(make config)
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
19
	@awk '{ print "export " $$0}' ../.env
20
21
22
23
24
25
26
27
28
	@awk '{ print "export " $$0}' .env
	@echo "# Please, run: "
	@echo "# eval \$$(make config)"
# If you need to run a command on the key/value pairs, use this:
# @awk '{ split($$0, a, "="); "echo " a[2] " | base64 -w 0" |& getline b64; print "export " a[1] "=" a[2]; print "export " a[1] "_BASE64=" b64}' .env

ci:  ## Run a task using gitlab-runner. Only use to debug problems in the CI pipeline
	gitlab-runner exec shell --builds-dir '.builds' --env CI_PROJECT_NAME=$(NAME) ${action}

29
include $(MK_DIR)/makefiles.mk
30
include $(MK_DIR)/docker.mk
31
include $(MK_DIR)/git.mk
32

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
33
34
35
info:: ## List all variables
	env

36
.PHONY:: config help ci