Skip to content

Commit 436f0f3

Browse files
committed
SWPROT-8953: build: Make more generic
No need to hardcode zpc stuff since v7 It will be reintroduced elsewhere yarn is also used by EMD Origin: #6 Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent 08790ef commit 436f0f3

File tree

1 file changed

+37
-48
lines changed

1 file changed

+37
-48
lines changed

helper.mk

Lines changed: 37 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# ex: set tabstop=4 noexpandtab:
44
# -*- coding: utf-8 -*
55

6-
default: help zpc/default
6+
default: help all/default
77
@echo "$@: TODO: Support more than $^ by default"
88
@date -u
99

@@ -12,8 +12,11 @@ SELF?=${CURDIR}/helper.mk
1212
project?=unifysdk
1313

1414
# Allow overloading from env if needed
15+
# VERBOSE?=1
1516
BUILD_DEV_GUI?=OFF
1617

18+
cmake_options?=-B ${build_dir}
19+
1720
CMAKE_GENERATOR?=Ninja
1821
export CMAKE_GENERATOR
1922

@@ -29,37 +32,36 @@ packages+=nlohmann-json3-dev
2932
packages+=curl wget python3-pip
3033
packages+=time
3134

35+
# Extra for components, make it optional
36+
packages+=python3-jinja2
37+
packages+=yarnpkg
38+
3239
rust_url?=https://sh.rustup.rs
3340
RUST_VERSION?=1.65.0
3441
export PATH := ${HOME}/.cargo/bin:${PATH}
3542

36-
zpc_exe?=${build_dir}/applications/zpc/zpc
37-
exes+=${zpc_exe}
3843

3944
# Allow overloading from env if needed
45+
ifdef VERBOSE
46+
CMAKE_VERBOSE_MAKEFILE?=${VERBOSE}
47+
cmake_options+=-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}
48+
endif
49+
50+
ifdef BUILD_DEV_GUI
51+
cmake_options+=-DBUILD_DEV_GUI=${BUILD_DEV_GUI}
4052
ifeq (${BUILD_DEV_GUI}, ON)
4153
packages+=nodejs
42-
packages+=yarnpkg
54+
endif
4355
endif
4456

57+
# Allow to bypass env detection, to support more build systems
58+
ifdef CMAKE_SYSTEM_PROCESSOR
59+
cmake_options+=-DCMAKE_SYSTEM_PROCESSOR="${CMAKE_SYSTEM_PROCESSOR}"
60+
export CMAKE_SYSTEM_PROCESSOR
61+
else
62+
# CMAKE_SYSTEM_PROCESSOR?=$(shell uname -m)
63+
endif
4564

46-
zpc_cmake_options?=\
47-
-DBUILD_AOXPC=OFF \
48-
-DBUILD_CPCD=OFF \
49-
-DBUILD_DEV_GUI=${BUILD_DEV_GUI} \
50-
-DBUILD_EMD=OFF \
51-
-DBUILD_EPC=OFF \
52-
-DBUILD_GMS=OFF \
53-
-DBUILD_IMAGE_PROVIDER=OFF \
54-
-DBUILD_NAL=OFF \
55-
-DBUILD_OTBR=OFF \
56-
-DBUILD_POSITIONING=OFF \
57-
-DBUILD_TESTING=ON \
58-
-DBUILD_UPTI_CAP=OFF \
59-
-DBUILD_UPTI_WRITER=OFF \
60-
-DBUILD_UPVL=OFF \
61-
-DBUILD_ZIGBEED=OFF \
62-
-DBUILD_ZIGPC=OFF
6365

6466
help: README.md
6567
@cat $<
@@ -121,12 +123,16 @@ setup/debian/bookworm: setup/debian setup/rust setup/python
121123
setup: setup/debian/${debian_codename}
122124
date -u
123125

124-
git/lfs/prepare: .git/lfs
125-
git lfs version || echo "$@: warning: Please install git-lfs"
126-
git lfs status --porcelain || git lfs install
127-
time git lfs pull
128-
git lfs update || git lfs update --force
129-
git lfs status --porcelain
126+
127+
git/lfs/prepare:
128+
[ ! -r .git/lfs/objects ] \
129+
|| { git lfs version || echo "$@: warning: Please install git-lfs" \
130+
&& git lfs status --porcelain || git lfs install \
131+
&& time git lfs pull \
132+
&& git lfs update || git lfs update --force \
133+
&& git lfs status --porcelain \
134+
&& git lfs ls-files \
135+
; }
130136

131137
git/modules/prepare:
132138
[ ! -r .git/modules ] || git submodule update --init --recursive
@@ -136,8 +142,8 @@ git/prepare: git/modules/prepare git/lfs/prepare
136142
configure: ${build_dir}/CMakeCache.txt
137143
file -E $<
138144

139-
${build_dir}/CMakeCache.txt: CMakeLists.txt ${build_pre_list}
140-
cmake -B ${build_dir}
145+
${build_dir}/CMakeCache.txt: CMakeLists.txt
146+
cmake ${cmake_options}
141147

142148
build: ${build_dir}/CMakeCache.txt
143149
cmake --build ${<D} \
@@ -146,13 +152,7 @@ build: ${build_dir}/CMakeCache.txt
146152
.PHONY: build
147153

148154
${build_dir}/%: build
149-
file -E "$<"
150-
151-
${exe}: build
152-
file -E $<
153-
154-
all: ${exes}
155-
file -E $<
155+
file -E "$@"
156156

157157
test: ${build_dir}
158158
ctest --test-dir ${<}
@@ -169,20 +169,9 @@ distclean:
169169

170170
prepare: git/prepare
171171

172-
all/default: configure build test
172+
all/default: configure prepare build test dist
173173
@date -u
174174

175-
zpc/configure: CMakeLists.txt
176-
cmake -B ${build_dir} ${zpc_cmake_options}
177-
178-
zpc/build: zpc/configure build
179-
@date -u
180-
181-
zpc/test: ${build_dir}/applications/zpc/components/zwave_command_classes/test/
182-
ctest --test-dir ${<}
183-
184-
zpc/default: zpc/configure zpc/build zpc/test dist
185-
@date -u
186175

187176
### @rootfs is faster than docker for env check
188177

0 commit comments

Comments
 (0)