Skip to content

Commit aee776b

Browse files
committed
SWPROT-8953: build: Add run rule (#72)
Also hotfix version if tags are not cloned. Origin: #41 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent 4e1daa9 commit aee776b

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

helper.mk

+13-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ url?=https://github.com/SiliconLabsSoftware/z-wave-protocol-controller
1616
# https://gitlab.kitware.com/cmake/cmake/-/issues/22813#note_1620373
1717
project_test_dir?=applications
1818
project_docs_api_target?=zpc_doxygen
19-
version?=$(shell git describe --tags || echo "0")
19+
version?=$(shell git describe --tags --always 2> /dev/null || echo "0")
2020

2121
# Allow overloading from env if needed
2222
# VERBOSE?=1
@@ -92,14 +92,15 @@ cmake_options+=-DCARGO_TARGET_TRIPLE="${CARGO_TARGET_TRIPLE}"
9292
export CMAKE_TARGET_TRIPLE
9393
endif
9494

95+
run_file?=${build_dir}/applications/zpc/zpc
9596

9697
help: ./helper.mk
9798
@echo "# ${project}: ${url}"
9899
@echo "#"
99100
@echo "# Usage:"
100101
@echo "# ${<D}/${<F} setup # To setup developer system (once)"
101102
@echo "# ${<D}/${<F} VERBOSE=1 # Default build tasks verbosely (depends on setup)"
102-
@echo "# ${<D}/${<F} # For more info"
103+
@echo "# ${<D}/${<F} help/all # For more info"
103104
@echo "#"
104105

105106
help/all: README.md NEWS.md
@@ -226,14 +227,17 @@ ${build_dir}/CMakeCache.txt: CMakeLists.txt
226227
cmake ${cmake_options}
227228

228229
all: ${build_dir}/CMakeCache.txt
229-
cmake --build ${<D} \
230-
|| cat ${build_dir}/CMakeFiles/CMakeOutput.log
230+
# cmake --build ${<D} \
231+
# || cat ${build_dir}/CMakeFiles/CMakeOutput.log
231232
cmake --build ${<D}
232233
.PHONY: all
233234

234235
${build_dir}/%: all
235236
file -E "$@"
236237

238+
${build_dir}: ${build_dir}/CMakeCache.txt
239+
file -E "$<"
240+
237241
test: ${build_dir}
238242
ctest --test-dir ${<}/${project_test_dir}
239243

@@ -260,6 +264,10 @@ prepare: git/prepare
260264
all/default: configure prepare all test dist
261265
@date -u
262266

267+
run_args?=--help
268+
run:
269+
file -E ${run_file}
270+
${run_file} ${run_args}
263271

264272
### @rootfs is faster than docker for env check
265273

@@ -312,7 +320,7 @@ docker_url?=${url}.git\#${docker_branch}
312320
docker/%: Dockerfile
313321
time docker run "${project}:latest" -C "${docker_workdir}" "${@F}"
314322

315-
test/docker: distclean prepare/docker docker/help docker/test
323+
test/docker: distclean prepare/docker docker/help docker/test docker/run
316324
@echo "# ${project}: log: $@: done: $^"
317325

318326
test/docker/build:

0 commit comments

Comments
 (0)