Skip to content

Commit 2c77489

Browse files
committed
Get all phony targets declared
It is generally a good practice to have the `.PHONY` declarations close to the affected targets themselves (instead of declaring them phony in one group at the end of the `Makefile`) so as not to miss any. (As it already happened to the `log`, `precommit`, `build_all`, etc., targets.) Thus, removed the one big declaration from the end of the file and prepended all phony targets with a declaration separately. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
1 parent e0d1598 commit 2c77489

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

Makefile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ export SHELL=/bin/bash
155155
# "Build all" targets prefix
156156
BUILD_ALL := build_all
157157

158+
.PHONY: all
158159
all: precommit
159160

161+
.PHONY: $(BUILD_DIRS_NATIVE)
160162
$(BUILD_DIRS_NATIVE): prerequisites
161163
$(Q) if [ "$$TOOLCHAIN" == "" ]; \
162164
then \
@@ -177,18 +179,21 @@ $(BUILD_DIRS_NATIVE): prerequisites
177179
(cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_LOG=$(LOG) -DENABLE_LTO=$(LTO) -DCMAKE_TOOLCHAIN_FILE=`cat toolchain.config` ../../.. 2>&1 | tee cmake.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
178180
(echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;); \
179181

182+
.PHONY: $(BUILD_DIRS_STM32F3)
180183
$(BUILD_DIRS_STM32F3): prerequisites
181184
$(Q) mkdir -p $@
182185
$(Q) cd $@ && \
183186
(cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_LTO=$(LTO) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f3.cmake ../../.. 2>&1 | tee cmake.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
184187
(echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;)
185188

189+
.PHONY: $(BUILD_DIRS_STM32F4)
186190
$(BUILD_DIRS_STM32F4): prerequisites
187191
$(Q) mkdir -p $@
188192
$(Q) cd $@ && \
189193
(cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_LTO=$(LTO) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f4.cmake ../../.. 2>&1 | tee cmake.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
190194
(echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;)
191195

196+
.PHONY: $(JERRY_LINUX_TARGETS)
192197
$(JERRY_LINUX_TARGETS): $(BUILD_DIR)/native
193198
$(Q) mkdir -p $(OUT_DIR)/$@
194199
$(Q) [ "$(STATIC_CHECK)" = "OFF" ] || ($(MAKE) -C $(BUILD_DIR)/native VERBOSE=1 cppcheck.$@ 2>&1 | tee $(OUT_DIR)/$@/cppcheck.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
@@ -197,6 +202,7 @@ $(JERRY_LINUX_TARGETS): $(BUILD_DIR)/native
197202
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
198203
$(Q) cp $(BUILD_DIR)/native/$@ $(OUT_DIR)/$@/jerry
199204

205+
.PHONY: unittests
200206
unittests: $(BUILD_DIR)/native
201207
$(Q) mkdir -p $(OUT_DIR)/$@
202208
$(Q) [ "$(STATIC_CHECK)" = "OFF" ] || ($(MAKE) -C $(BUILD_DIR)/native VERBOSE=1 cppcheck.$@ 2>&1 | tee $(OUT_DIR)/$@/cppcheck.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
@@ -205,6 +211,7 @@ unittests: $(BUILD_DIR)/native
205211
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
206212
$(Q) cp $(BUILD_DIR)/native/unit-test-* $(OUT_DIR)/$@
207213

214+
.PHONY: $(BUILD_ALL)_native
208215
$(BUILD_ALL)_native: $(BUILD_DIRS_NATIVE)
209216
$(Q) mkdir -p $(OUT_DIR)/$@
210217
$(Q) ($(MAKE) -C $(BUILD_DIR)/native jerry-libc-all VERBOSE=1 2>&1 | tee $(OUT_DIR)/$@/make.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
@@ -214,6 +221,7 @@ $(BUILD_ALL)_native: $(BUILD_DIRS_NATIVE)
214221
$(Q) ($(MAKE) -C $(BUILD_DIR)/native $(JERRY_LINUX_TARGETS) unittests VERBOSE=1 2>&1 | tee $(OUT_DIR)/$@/make.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
215222
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
216223

224+
.PHONY: $(JERRY_STM32F3_TARGETS)
217225
$(JERRY_STM32F3_TARGETS): $(BUILD_DIR)/stm32f3
218226
$(Q) mkdir -p $(OUT_DIR)/$@
219227
$(Q) [ "$(STATIC_CHECK)" = "OFF" ] || ($(MAKE) -C $(BUILD_DIR)/stm32f3 VERBOSE=1 cppcheck.$@ 2>&1 | tee $(OUT_DIR)/$@/cppcheck.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
@@ -223,13 +231,15 @@ $(JERRY_STM32F3_TARGETS): $(BUILD_DIR)/stm32f3
223231
$(Q) cp $(BUILD_DIR)/stm32f3/$@ $(OUT_DIR)/$@/jerry
224232
$(Q) cp $(BUILD_DIR)/stm32f3/[email protected] $(OUT_DIR)/$@/jerry.bin
225233

234+
.PHONY: $(BUILD_ALL)_stm32f3
226235
$(BUILD_ALL)_stm32f3: $(BUILD_DIRS_STM32F3)
227236
$(Q) mkdir -p $(OUT_DIR)/$@
228237
$(Q) ($(MAKE) -C $(BUILD_DIR)/stm32f3 jerry-libc-all VERBOSE=1 2>&1 | tee $(OUT_DIR)/$@/make.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
229238
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
230239
$(Q) ($(MAKE) -C $(BUILD_DIR)/stm32f3 $(JERRY_STM32F3_TARGETS) VERBOSE=1 2>&1 | tee $(OUT_DIR)/$@/make.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
231240
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
232241

242+
.PHONY: $(JERRY_STM32F4_TARGETS)
233243
$(JERRY_STM32F4_TARGETS): $(BUILD_DIR)/stm32f4
234244
$(Q) mkdir -p $(OUT_DIR)/$@
235245
$(Q) [ "$(STATIC_CHECK)" = "OFF" ] || ($(MAKE) -C $(BUILD_DIR)/stm32f4 VERBOSE=1 cppcheck.$@ 2>&1 | tee $(OUT_DIR)/$@/cppcheck.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
@@ -239,49 +249,60 @@ $(JERRY_STM32F4_TARGETS): $(BUILD_DIR)/stm32f4
239249
$(Q) cp $(BUILD_DIR)/stm32f4/$@ $(OUT_DIR)/$@/jerry
240250
$(Q) cp $(BUILD_DIR)/stm32f4/[email protected] $(OUT_DIR)/$@/jerry.bin
241251

252+
.PHONY: $(BUILD_ALL)_stm32f4
242253
$(BUILD_ALL)_stm32f4: $(BUILD_DIRS_STM32F4)
243254
$(Q) mkdir -p $(OUT_DIR)/$@
244255
$(Q) ($(MAKE) -C $(BUILD_DIR)/stm32f4 jerry-libc-all VERBOSE=1 2>&1 | tee $(OUT_DIR)/$@/make.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
245256
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
246257
$(Q) ($(MAKE) -C $(BUILD_DIR)/stm32f4 $(JERRY_STM32F4_TARGETS) VERBOSE=1 2>&1 | tee $(OUT_DIR)/$@/make.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
247258
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
248259

260+
.PHONY: build_all
249261
build_all: $(BUILD_ALL)_native $(BUILD_ALL)_stm32f3 $(BUILD_ALL)_stm32f4
250262

251263
#
252264
# build - build_all, then run cppcheck and copy output to OUT_DIR
253265
# Prebuild is needed to avoid race conditions between make instances running in parallel
254266
#
267+
.PHONY: build
255268
build: $(BUILD_ALL)
256269
$(Q) mkdir -p $(OUT_DIR)/$@
257270
$(Q) ($(MAKE) VERBOSE=1 $(JERRY_TARGETS) 2>&1 | tee $(OUT_DIR)/$@/make.log $(QLOG) ; ( exit $${PIPESTATUS[0]} ) ) || \
258271
(echo "Build failed. See $(OUT_DIR)/$@/make.log for details."; exit 1;)
259272
$(Q) rm -rf $(OUT_DIR)/$(BUILD_ALL)* $(OUT_DIR)/$@
260273

274+
.PHONY: $(FLASH_TARGETS)
261275
$(FLASH_TARGETS): $(BUILD_DIR)/mcu
262276
$(Q) $(MAKE) -C $(BUILD_DIR)/mcu VERBOSE=1 $@ $(QLOG)
263277

278+
.PHONY: push
264279
push: ./tools/git-scripts/push.sh
265280
$(Q) ./tools/git-scripts/push.sh
266281

282+
.PHONY: pull
267283
pull: ./tools/git-scripts/pull.sh
268284
$(Q) ./tools/git-scripts/pull.sh
269285

286+
.PHONY: log
270287
log: ./tools/git-scripts/log.sh
271288
$(Q) ./tools/git-scripts/log.sh
272289

290+
.PHONY: precommit
273291
precommit: clean prerequisites
274292
$(Q) ./tools/precommit.sh "$(MAKE)" "$(OUT_DIR)" "$(PRECOMMIT_CHECK_TARGETS_LIST)"
275293

294+
.PHONY: unittests_run
276295
unittests_run: unittests
277296
$(Q) rm -rf $(OUT_DIR)/unittests/check
278297
$(Q) mkdir -p $(OUT_DIR)/unittests/check
279298
$(Q) ./tools/runners/run-unittests.sh $(OUT_DIR)/unittests || \
280299
(echo "Unit tests run failed. See $(OUT_DIR)/unittests/unit_tests_run.log for details."; exit 1;)
281300

301+
.PHONY: clean
282302
clean:
283303
$(Q) rm -rf $(BUILD_DIR_PREFIX)* $(OUT_DIR)
284304

305+
.PHONY: prerequisites
285306
prerequisites: $(PREREQUISITES_STATE_DIR)/.prerequisites
286307

287308
$(PREREQUISITES_STATE_DIR)/.prerequisites:
@@ -291,8 +312,7 @@ $(PREREQUISITES_STATE_DIR)/.prerequisites:
291312
(echo "Prerequisites setup failed. See $(PREREQUISITES_STATE_DIR)/prerequisites.log for details."; exit 1;)
292313
@ echo "Prerequisites setup succeeded"
293314

315+
.PHONY: prerequisites_clean
294316
prerequisites_clean:
295317
$(Q) ./tools/prerequisites.sh $(PREREQUISITES_STATE_DIR)/.prerequisites clean
296318
$(Q) rm -rf $(PREREQUISITES_STATE_DIR)
297-
298-
.PHONY: prerequisites_clean prerequisites clean build unittests_run $(BUILD_DIRS_ALL) $(JERRY_TARGETS) $(FLASH_TARGETS)

0 commit comments

Comments
 (0)