/
Makefile
executable file
·93 lines (69 loc) · 2.07 KB
/
Makefile
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#################################################################################
# My Docker Script Makefile #
# Written by: Stephen Reaves #
# #
# Every Docker container should have it's own dir with the '.d' suffix. Inside #
# that dir, there should be mds.sh script that defines variables like the image.#
# From there, the parent mds.sh script should handle docker builds, runs, etc. #
#################################################################################
usage :
ifneq (,$(wildcard /usr/bin/cowsay))
@cowsay "Run 'make init' or 'make search' to begin creating a service. Then, run 'make <servicename>' to start that service, or 'make all' to start all services."
else
@echo "Run 'make init' or 'make search' to begin creating a service. \
Then, run 'make <servicename>' to start that service, or \
'make all' to start all services."
endif
CMD="run"
DIR = $(wildcard *.d)
TARGET = $(DIR:.d=)
.PHONY: $(DIR) $(TARGET) new clean search restart enable disable
$(DIR) :
@(cd $@ && mds.sh $(CMD))
$(TARGET) : % : %.d
clean :
docker system prune -a
./mds.sh clean
all : $(DIR)
list :
@dialog --title "Running services" --infobox "`docker ps -a | awk '/Up/ {print $$NF}'`" 0 0
checkPorts :
@dialog --title "Used Ports" --infobox "`mds.sh checkPorts`" 0 0
proxyReset :
@mds.sh proxyReset
new :
@mds.sh new
search :
@mds.sh search
init :
@mds.sh init
restart :
@: # Hide output
$(eval CMD=restart)
start :
@: # Hide output
$(eval CMD=start)
stop :
@: # Hide ouput
$(eval CMD=stop)
remove :
@: # Hide output
$(eval CMD=remove)
run :
@: # Hide output
$(eval CMD=run)
enable :
@:
$(eval CMD=enable)
# Try running anything as command
# This allows us to run 'make customFunction service' instead of
# 'make CMD=customFunction service' on an abstract level
% :
@: # Hide output
$(eval CMD=$@)
remStart :
@: # Hide output
$(eval CMD=remStart)
# $(eval CMD=run)
todo:
@vim TODO.md