-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (90 loc) · 3 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/false
## Makefile
.PHONY: intro help help-commands help-platform pause pause online
#
## default rule
#
intro :
## $@ ##
@echo "project_name is $(package_name)"
@echo "project_root is $(project_root)"
@echo "for further info try =make help="
help :
## $@ ##
@echo "make online -- readies and executes $(package_name)"
@echo "additional documentation is available in the ./ReadMe.org file"
@echo "\tor for example: make help-x -- where x is any of: $(module_keys)"
@echo "\tor for a list of commands: make help-commands"
help-commands:
## $@ ##
@find $(project_root)/srv/salt/pillar/base.*/MISC/GNUMAKE/*-mod.mk -exec sed -ne '/^[a-zA-Z0-9%$$_-]*:.*/N;s/^\([a-zA-Z0-9%$$_-]*\):.*## $$@ ##\(.*\)/\1 ... \2/p' {} \;
help-commands-%:
## $@ ##
@find $(project_root)/srv/salt/pillar/base.*/MISC/GNUMAKE/*-mod.mk -exec sed -ne '/^[a-zA-Z0-9%$$_-]*:.*/N;s/^\([a-zA-Z0-9%$$_-]*\):.*## $$@ ##\(.*\)/\1 ... \2/p' {} \; | grep -is -e '$(subst help-commands-,,$@)'
help-platform:
## $@ ##
@echo "\tmachineinfo_uname == $(machineinfo_uname)"
@echo "\tmachineinfo_lsbrelease == $(machineinfo_lsbrelease)"
pause:
## $@ ##
@sleep 3
pause%:
## $@ ##
@sleep $(@:pause%=%)
## helper variables
empty :=
space := $(empty) $(empty)
comma := ,
lparen := $(empty)($(empty)
rparen := $(empty))$(empty)
## Essential Basics
package_name := gema-ctl
package_key := gema
project_root := $(shell pwd)
uri_logfile ?= $(project_root)/tmp/log
opt_shell_postfix ?= 2>/dev/null
## Platform Info
machineinfo_uname := $(shell uname -a)
machineinfo_lsbrelease := $(shell which lsb_release >/dev/null 2>/dev/null && lsb_release -a 2>/dev/null)
#
## Build Paths
#+nb: "?=" variables can be overrided from enviroment as needed
TMP_DIR ?= $(project_root)/tmp
TMP_DIR_LIST := $(TMP_DIR) $(TMP_DIR)/log
BUILD_DIR ?= $(TMP_DIR)/build
OBJ_DIR ?= $(BUILD_DIR)/obj
LIB_DIR ?= $(BUILD_DIR)/lib
DBG_DIR ?= $(BUILD_DIR)/dbg
DEP_DIR ?= $(BUILD_DIR)/dep
BIN_DIR ?= $(BUILD_DIR)/bin
BUILD_DIR_LIST := $(BUILD_DIR) $(OBJ_DIR) $(LIB_DIR) $(DBG_DIR) $(DEP_DIR) $(BIN_DIR)
## Release Paths
prefix ?= $(INSTALL_DIR)
exec_prefix ?= $(prefix)
bindir ?= $(exec_prefix)/bin
libdir ?= $(exec_prefix)/lib
libexecdir ?= $(exec_prefix)/libexec/$(package_name)
includedir ?= $(prefix)/include
sysconfdir ?= $(prefix)/etc
datarootdir ?= $(prefix)/share
datadir ?= $(datarootdir)/dat/$(package_name)
docdir ?= $(datarootdir)/doc/$(package_name)
#srcdir := $(project_root)/src
srcdir := $(project_root)/srv
RELEASE_DIR_LIST := $(prefix) $(exec_prefix) $(bindir) $(libdir) $(libexecdir) $(includedir) $(sysconfdir) $(datarootdir) $(datadir) $(docdir)
DIR_LIST := $(TMP_DIR_LIST) $(BUILD_DIR_LIST) $(INSTALL_DIR) $(RELEASE_DIR_LIST)
#
## config variables
timestamp := $(shell date -u "+%Y%m%dT%H%M%S%z")
#
## repo-level operations
#
online: $(package_key)-online
chkdirs:
## $@ ##
mkdir -p $(project_root)/var/{log,tmp,cache/pki/minions,cache/proc,scratch,build}
#
## Modular Makefile Auxiliary Info
#
## pull in Makefile functional modules
-include ./srv/salt/pillar/base.*/MISC/GNUMAKE/*-mod.mk