-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
115 lines (87 loc) · 2.78 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
#!/usr/bin/env make
#
# dbwebb utility, to work with a dbwebb course.
# See organisation on GitHub: https://github.com/dbwebb-se
# ------------------------------------------------------------------------
#
# General stuff, reusable for all Makefiles.
#
# Detect OS
OS = $(shell uname -s)
# Defaults
ECHO = echo
# Make adjustments based on OS
ifneq (, $(findstring CYGWIN, $(OS)))
ECHO = /bin/echo -e
endif
# Colors and helptext
NO_COLOR = \033[0m
ACTION = \033[32;01m
OK_COLOR = \033[32;01m
ERROR_COLOR = \033[31;01m
WARN_COLOR = \033[33;01m
# Print out colored action message
ACTION_MESSAGE = $(ECHO) "$(ACTION)---> $(1)$(NO_COLOR)"
# Which makefile am I in?
WHERE-AM-I = "$(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))"
THIS_MAKEFILE := $(call WHERE-AM-I)
# Echo some nice helptext based on the target comment
HELPTEXT = $(call ACTION_MESSAGE, $(shell egrep "^\# target: $(1) " $(THIS_MAKEFILE) | sed "s/\# target: $(1)[ ]*-[ ]* / /g"))
# Check version and path to command and display on one line
CHECK_VERSION = printf "%-15s %-13s %s\n" "`basename $(1)`" "`$(1) --version $(2)`" "`which $(1)`"
# Get current working directory, it may not exist as environment variable.
PWD = $(shell pwd)
# target: help - Displays help.
.PHONY: help
help:
@$(call HELPTEXT,$@)
@sed '/^$$/q' $(THIS_MAKEFILE) | tail +3 | sed 's/#\s*//g'
@$(ECHO) "Usage:"
@$(ECHO) " make [target] ..."
@$(ECHO) "target:"
@egrep "^# target:" $(THIS_MAKEFILE) | sed 's/# target: / /g'
# ------------------------------------------------------------------------
#
# Specifics for this project.
#
# # Default values for arguments
# container ?= cli
#
# # Add local bin path for test tools
# PATH := $(PWD)/bin:$(PWD)/vendor/bin:$(PWD)/node_modules/.bin:$(PATH)
# SHELL := env PATH='$(PATH)' $(SHELL)
#
# # Tools
# DBWEBB := bin/dbwebb
# DBWEBB_VALIDATE := bin/dbwebb-validate
# DBWEBB_INSPECT := bin/dbwebb-inspect
# PHPCS := bin/phpcs
# PHPMD := bin/phpmd
# ----------------------------------------------------------------------------
#
# Highlevel targets
#
# # target: prepare - Prepare the build directory.
# .PHONY: prepare
# prepare:
# @$(call HELPTEXT,$@)
# [ -d build ] || install -d build/webroot
# [ -d bin/pip ] || install -d bin/pip
# target: install - Install needed utilities locally.
.PHONY: install
install:
@$(call HELPTEXT,$@)
install --mode 0755 gui.bash /usr/local/bin/dbwebb-inspect-gui
# target: deinstall - Deinstall needed utilities locally.
.PHONY: deinstall
deinstall:
@$(call HELPTEXT,$@)
rm /usr/local/bin/dbwebb-inspect-gui
# target: test - Run tests.
.PHONY: test
test:
@$(call HELPTEXT,$@)
# target: clean - Remove all generated files.
.PHONY: clean
clean:
@$(call HELPTEXT,$@)