-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile.base
executable file
·48 lines (38 loc) · 1.18 KB
/
Makefile.base
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
.PHONY: build test
DOCKER_COMPOSE ?= docker-compose
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
OPEN_CMD ?= open
DOCKER_HOST_IP ?= $(shell echo $(DOCKER_HOST) | sed 's/tcp:\/\///' | sed 's/:[0-9.]*//')
else
OPEN_CMD ?= xdg-open
DOCKER_HOST_IP ?= 127.0.0.1
endif
# Targets
# -------
default: help
up: ##@development start stack
$(DOCKER_COMPOSE) up -d
clean: ##@development remove all containers in stack
$(DOCKER_COMPOSE) kill
$(DOCKER_COMPOSE) rm -fv --all
$(DOCKER_COMPOSE) down --rmi local --remove-orphans
# Help based on https://gist.github.com/prwhite/8168133 thanks to @nowox and @prwhite
# And add help text after each target name starting with '\#\#'
# A category can be added with @category
HELP_FUN = \
%help; \
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([\w-]+)\s*:.*\#\#(?:@([\w-]+))?\s(.*)$$/ }; \
print "\nusage: make [target ...]\n\n"; \
for (keys %help) { \
print "$$_:\n"; \
for (@{$$help{$$_}}) { \
$$sep = "." x (25 - length $$_->[0]); \
print " $$_->[0]$$sep$$_->[1]\n"; \
} \
print "\n"; }
help: ##@system show this help
#
# General targets
#
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)