Skip to content

Commit 55b6a3d

Browse files
committed
align Makefile with design-repo
1 parent 94ab187 commit 55b6a3d

1 file changed

Lines changed: 65 additions & 50 deletions

File tree

‎Makefile‎

Lines changed: 65 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,82 @@
44
#
55

66
# Colors
7-
NO_COLOR=\033[0m
8-
TARGET_COLOR=\033[32;01m
9-
OK_COLOR=\033[32;01m
10-
ERROR_COLOR=\033[31;01m
11-
WARN_COLOR=\033[33;01m
12-
ACTION=$(TARGET_COLOR)-->
7+
NO_COLOR = \033[0m
8+
TARGET_COLOR = \033[32;01m
9+
OK_COLOR = \033[32;01m
10+
ERROR_COLOR = \033[31;01m
11+
WARN_COLOR = \033[33;01m
12+
ACTION = $(TARGET_COLOR)-->
13+
HELPTEXT = "$(ACTION)" `egrep "^\# target: $(1) " Makefile | sed "s/\# target: $(1)[ ]\+- / /g"` "$(NO_COLOR)"
1314

1415
# Add local bin path for test tools
1516
PATH := "$(PWD)/bin:$(PWD)/vendor/bin:$(PWD)/node_modules/.bin:$(PATH)"
1617

1718

1819

19-
# target: help - Displays help.
20+
# target: help - Displays help.
2021
.PHONY: help
2122
help:
22-
@echo "Displaying help for this Makefile."
23+
@echo $(call HELPTEXT,$@)
2324
@echo "Usage:"
2425
@echo " make [target] ..."
2526
@echo "target:"
2627
@egrep "^# target:" Makefile | sed 's/# target: / /g'
2728

2829

2930

30-
# target: build-prepare - Prepare the build directory.
31+
# target: install - Install needed utilities locally.
32+
.PHONY: install
33+
install: automated-tests-prepare
34+
@echo $(call HELPTEXT,$@)
35+
36+
37+
38+
# target: check - Check installed utilities.
39+
.PHONY: check
40+
check: automated-tests-check
41+
@echo $(call HELPTEXT,$@)
42+
43+
44+
45+
46+
# target: test - Install test tools & run tests.
47+
.PHONY: test
48+
test: automated-tests-prepare automated-tests-check automated-tests-run dbwebb-testrepo
49+
@echo $(call HELPTEXT,$@)
50+
51+
52+
53+
# target: build-prepare - Prepare the build directory.
3154
.PHONY: build-prepare
3255
build-prepare:
33-
@echo "$(ACTION)Prepare the build directory$(NO_COLOR)"
56+
@echo $(call HELPTEXT,$@)
3457
install -d build
3558
install -d bin/pip
3659

3760

3861

39-
# target: clean - Remove all generated files.
62+
# target: clean - Remove all generated files.
4063
.PHONY: clean
4164
clean:
42-
@echo "$(ACTION)Remove all generated files$(NO_COLOR)"
65+
@echo $(call HELPTEXT,$@)
4366
rm -rf build
4467
rm -f npm-debug.log
4568

4669

4770

48-
# target: clean-me - Remove me-directory.
71+
# target: clean-me - Remove me-directory.
4972
.PHONY: clean-me
5073
clean-me:
51-
@echo "$(ACTION)Remove me-directory$(NO_COLOR)"
74+
@echo $(call HELPTEXT,$@)
5275
rm -rf me
5376

5477

5578

56-
# target: clean-all - Remove all installed files.
79+
# target: clean-all - Remove all installed files.
5780
.PHONY: clean-all
5881
clean-all: clean
59-
@echo "$(ACTION)Remove all installed files$(NO_COLOR)"
82+
@echo $(call HELPTEXT,$@)
6083
rm -rf bin
6184
rm -rf node_modules
6285
rm -rf vendor
@@ -66,7 +89,7 @@ clean-all: clean
6689
# target: dbwebb-install - Download and install dbwebb-cli.
6790
.PHONY: dbwebb-install
6891
dbwebb-install: build-prepare
69-
@echo "$(ACTION)Download and install dbwebb$(NO_COLOR)"
92+
@echo $(call HELPTEXT,$@)
7093
wget --quiet -O bin/dbwebb https://raw.githubusercontent.com/mosbth/dbwebb-cli/master/dbwebb2
7194
chmod 755 bin/dbwebb
7295
export PATH=$(PATH) && dbwebb config create noinput && dbwebb --version
@@ -76,15 +99,15 @@ dbwebb-install: build-prepare
7699
# target: dbwebb-testrepo - Test course repo.
77100
.PHONY: dbwebb-testrepo
78101
dbwebb-testrepo: dbwebb-install
79-
@echo "$(ACTION)Test course repo$(NO_COLOR)"
102+
@echo $(call HELPTEXT,$@)
80103
export PATH=$(PATH) && dbwebb --silent --local testrepo
81104

82105

83106

84107
# target: dbwebb-validate-install - Download and install dbwebb-validate.
85108
.PHONY: dbwebb-validate-install
86109
dbwebb-validate-install: build-prepare
87-
@echo "$(ACTION)Download and install dbwebb-validate$(NO_COLOR)"
110+
@echo $(call HELPTEXT,$@)
88111
wget --quiet -O bin/dbwebb-validate https://raw.githubusercontent.com/mosbth/dbwebb-cli/master/dbwebb2-validate
89112
chmod 755 bin/dbwebb-validate
90113
export PATH=$(PATH) && dbwebb-validate --version
@@ -94,95 +117,87 @@ dbwebb-validate-install: build-prepare
94117
# target: dbwebb-validate-check - Check version and environment for dbwebb-validate.
95118
.PHONY: dbwebb-validate-check
96119
dbwebb-validate-check:
97-
@echo "$(ACTION)Check version and environment for dbwebb-validate$(NO_COLOR)"
120+
@echo $(call HELPTEXT,$@)
98121
export PATH=$(PATH) && dbwebb-validate --version && dbwebb-validate --check
99122

100123

101124

102125
# target: dbwebb-validate-run - Run tests with dbwebb-validate.
103126
.PHONY: dbwebb-validate-run
104127
dbwebb-validate-run:
105-
@echo "$(ACTION)Run tests with dbwebb-validate$(NO_COLOR)"
128+
@echo $(call HELPTEXT,$@)
106129
export PATH=$(PATH) && dbwebb-validate --publish --publish-to build/webroot/ example
107130

108131

109132

110-
# target: npm-install-dev - Install npm packages for development.
133+
# target: npm-install-dev - Install npm packages for development.
111134
.PHONY: npm-install-dev
112135
npm-install-dev: build-prepare
113-
@echo "$(ACTION)Install npm packages for development$(NO_COLOR)"
114-
npm install --only=dev
136+
@echo $(call HELPTEXT,$@)
137+
if [ -f package.json ]; then npm install --only=dev; fi
115138

116139

117140

118-
# target: npm-update-dev - Update npm packages for development.
141+
# target: npm-update-dev - Update npm packages for development.
119142
.PHONY: npm-update-dev
120143
npm-update-dev:
121-
@echo "$(ACTION)Update npm packages for development$(NO_COLOR)"
122-
npm update --only=dev
144+
@echo $(call HELPTEXT,$@)
145+
if [ -f package.json ]; then npm update --only=dev; fi
123146

124147

125148

126-
# target: composer-install-dev - Install composer packages for development.
149+
# target: composer-install-dev - Install composer packages for development.
127150
.PHONY: composer-install-dev
128151
composer-install-dev: build-prepare
129-
@echo "$(ACTION)Install composer packages for development$(NO_COLOR)"
152+
@echo $(call HELPTEXT,$@)
130153
if [ -f composer.json ]; then composer install; fi
131154

132155

133156

134-
# target: composer-update-dev - Update composer packages for development.
157+
# target: composer-update-dev - Update composer packages for development.
135158
.PHONY: composer-update-dev
136159
composer-update-dev:
137-
@echo "$(ACTION)Update composer packages for development$(NO_COLOR)"
160+
@echo $(call HELPTEXT,$@)
138161
if [ -f composer.json ]; composer update; fi
139162

140163

141164

142-
# target: tools-install-dev - Install tools for development.
165+
# target: tools-install-dev - Install tools for development.
143166
.PHONY: tools-install-dev
144167
tools-install-dev: build-prepare composer-install-dev npm-install-dev
145-
@echo "$(ACTION)Install tools for development$(NO_COLOR)"
168+
@echo $(call HELPTEXT,$@)
146169

147170

148171

149-
# target: tools-update-dev - Update tools for development.
172+
# target: tools-update-dev - Update tools for development.
150173
.PHONY: tools-update-dev
151174
tools-update-dev: composer-update-dev npm-update-dev
152-
@echo "$(ACTION)Update tools for development$(NO_COLOR)"
175+
@echo $(call HELPTEXT,$@)
153176

154177

155178

156179
# target: automated-tests-prepare - Prepare for automated tests.
157180
.PHONY: automated-tests-prepare
158181
automated-tests-prepare: build-prepare dbwebb-validate-install dbwebb-install npm-install-dev composer-install-dev
159-
@echo "$(ACTION)Prepared for automated tests$(NO_COLOR)"
182+
@echo $(call HELPTEXT,$@)
160183

161184

162185

163-
# target: automated-tests-check - Check version and enviroment for automated tests.
186+
# target: automated-tests-check - Check version and environment for automated tests.
164187
.PHONY: automated-tests-check
165188
automated-tests-check: dbwebb-validate-check
166-
@echo "$(ACTION)Checked version and environment for automated tests$(NO_COLOR)"
189+
@echo $(call HELPTEXT,$@)
167190

168191

169192

170193
# target: automated-tests-run - Run all automated tests.
171194
.PHONY: automated-tests-run
172195
automated-tests-run: dbwebb-validate-run dbwebb-testrepo
173-
@echo "$(ACTION)Executed all automated tests$(NO_COLOR)"
174-
175-
176-
177-
# target: test - Install test tools & run tests.
178-
.PHONY: test
179-
test: automated-tests-prepare automated-tests-check automated-tests-run dbwebb-testrepo
180-
@echo "$(ACTION)Installed test tools & executed tests$(NO_COLOR)"
181-
196+
@echo $(call HELPTEXT,$@)
182197

183198

184-
# target: dbwebb-validate - Execute command with arg1=what.
199+
# target: dbwebb-validate - Execute dbwebb validate with arg1=what.
185200
.PHONY: dbwebb-validate
186201
dbwebb-validate:
187-
@echo "$(ACTION)Executed all automated tests$(NO_COLOR)"
188-
export PATH=$(PATH) && dbwebb-validate --publish --publish-to build/webroot/ $(arg1)
202+
@echo $(call HELPTEXT,$@)
203+
bin/dbwebb-validate --publish --publish-to build/webroot/ $(arg1)

0 commit comments

Comments
 (0)