3 # Permission is hereby granted, free of charge, to any person obtaining a copy
4 # of this software and associated documentation files (the "Software"), to deal
5 # in the Software without restriction, including without limitation the rights
6 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 # copies of the Software, and to permit persons to whom the Software is
8 # furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
13 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 # Note: You can override all variables by storing them
23 # in an external file called "make.conf".
24 -include conf/make.conf
27 # vusolo, bm750, vuuno, vuultimo, vuduo2
29 # This only sets the default value. All platforms now use a shared build
30 # directory. Run "MACHINE=vuultimo bitbake vuplus-image" to build an image
31 # for the vuultimo, if it is not the default.
36 # Adjust according to the number CPU cores to use for parallel build.
37 # Default: Number of processors in /proc/cpuinfo, if present, or 1.
38 NR_CPU := $(shell [ -f /proc/cpuinfo ] && grep -c '^processor\s*:' /proc/cpuinfo || echo 1)
39 BB_NUMBER_THREADS ?= $(NR_CPU)
40 PARALLEL_MAKE ?= -j $(NR_CPU)
44 BUILD_DIR = $(CURDIR)/build
45 TOPDIR = $(BUILD_DIR)/$(MACHINE)
46 DL_DIR = $(CURDIR)/sources
48 ifeq ($(MULTI_TEMPORARILY), YES)
49 SSTATE_DIR = $(TOPDIR)/sstate-cache
50 TMPDIR = $(TOPDIR)/tmp
51 DEPDIR = $(TOPDIR)/.deps
53 SSTATE_DIR = $(BUILD_DIR)/sstate-cache
54 TMPDIR = $(BUILD_DIR)/tmp
55 DEPDIR = $(BUILD_DIR)/.deps
59 $(CURDIR)/meta-bsp/$(MACHINE) \
60 $(CURDIR)/meta-bsp/common \
61 $(CURDIR)/meta-openvuplus \
62 $(CURDIR)/meta-openembedded/meta-oe \
63 $(CURDIR)/openembedded-core/meta
67 $(TOPDIR)/conf/bblayers.conf \
68 $(TOPDIR)/conf/local.conf
71 $(DEPDIR)/.bitbake.env.$(BITBAKE_ENV_HASH) \
72 $(DEPDIR)/.bblayers.conf.$(MACHINE).$(BBLAYERS_CONF_HASH) \
73 $(DEPDIR)/.local.conf.$(MACHINE).$(LOCAL_CONF_HASH)
76 GIT_REMOTE := $(shell $(GIT) remote)
77 GIT_USER_NAME := $(shell $(GIT) config user.name)
78 GIT_USER_EMAIL := $(shell $(GIT) config user.email)
80 hash = $(shell echo $(1) | $(XSUM) | awk '{print $$1}')
86 [ -d $@ ] || $(MAKE) $(MFLAGS) update
88 init: $(BBLAYERS) $(CONFFILES)
93 @echo " * Update the SDK"
94 @echo " $$ $(MAKE) update"
96 @echo " * Select a new target machine:"
97 @echo " $$ echo MACHINE=vuultimo >> conf/make.conf"
98 @echo " [Valid values: vusolo, bm750, vuuno, vuultimo, vusolo2, vuduo2]"
100 @echo " * Build a firmware image for the selected target machine:"
101 @echo " $$ $(MAKE) image"
103 @echo " * Build a firmware image for a different target machine:"
104 @echo " $$ $(MAKE) image MACHINE=vuultimo"
105 @echo " [Valid values: vusolo, bm750, vuuno, vuultimo, vusolo2, vuduo2]"
107 @echo " * Download all source files at once:"
108 @echo " $$ $(MAKE) download"
110 @echo " * Set up the environment to build recipes manually:"
111 @echo " $$ source bitbake.env"
112 @echo " $$ cd build/$(MACHINE)"
113 @echo " $$ bitbake <target>"
114 @echo " [Replace <target> with a recipe name, e.g. vuplus-image or enigma2]"
116 @echo "Your current settings:"
117 @echo " MACHINE = $(MACHINE)"
119 @echo " BB_NUMBER_THREADS = $(BB_NUMBER_THREADS)"
120 @echo " PARALLEL_MAKE = $(PARALLEL_MAKE)"
122 @echo "Trouble finding a recipe? Try ./scripts/drepo grep 'search string'"
123 @echo "or ./scripts/drepo find -name \"*recipe*\"."
127 @echo "[*] Please run '$(MAKE) help' to display further information!"
130 @echo '[*] Deleting generated configuration files'
131 @$(RM) $(CONFFILES) $(CONFDEPS)
134 @echo '[*] Deleting dependencies directory'
136 @echo '[*] Deleting download directory'
138 @echo '[*] Deleting tmp directory'
140 @echo '[*] Deleting sstate directory'
141 @$(RM) -r $(SSTATE_DIR)
142 @echo '[*] Deleting build directory'
143 @$(RM) -r $(BUILD_DIR)
144 @echo '[*] Deleting git submodules'
145 @$(GIT) submodule foreach 'rm -rf .* * 2>/dev/null || true'
148 @echo '[*] Building image for $(MACHINE)'
149 @. $(CURDIR)/bitbake.env && cd $(TOPDIR) && bitbake vuplus-image
152 @echo '[*] Downloading sources'
153 @. $(CURDIR)/bitbake.env && cd $(TOPDIR) && bitbake -cfetchall -k vuplus-image
156 @echo '[*] Updating Git repositories...'
157 @HASH=`$(XSUM) $(MAKEFILE_LIST)`; \
158 if [ -n "$(GIT_REMOTE)" ]; then \
159 $(GIT) pull --ff-only || $(GIT) pull --rebase; \
161 if [ "$$HASH" != "`$(XSUM) $(MAKEFILE_LIST)`" ]; then \
162 echo '[*] Makefile changed. Restarting...'; \
163 $(MAKE) $(MFLAGS) --no-print-directory $(MAKECMDGOALS); \
165 $(GIT) submodule sync && \
166 $(GIT) submodule update --init && \
167 echo "[*] The Vuplus SDK is now up-to-date."; \
170 .PHONY: all clean help image init update usage
172 MACHINE_INCLUDE_CONF = $(CURDIR)/conf/$(basename $(@F))-$(MACHINE)-ext.conf
173 DISTRO_INCLUDE_CONF = $(CURDIR)/conf/$(basename $(@F))-ext.conf
175 BITBAKE_ENV_HASH := $(call hash, \
176 'BITBAKE_ENV_VERSION = "0"' \
177 'CURDIR = "$(CURDIR)"' \
180 bitbake.env: $(DEPDIR)/.bitbake.env.$(BITBAKE_ENV_HASH)
181 @echo '[*] Generating $@'
182 @echo '# Automatically generated file. Do not edit!' > $@
183 @echo 'export PATH=$(CURDIR)/openembedded-core/scripts:$(CURDIR)/bitbake/bin:$${PATH}' >> $@
185 LOCAL_CONF_HASH := $(call hash, \
186 'LOCAL_CONF_VERSION = "0"' \
187 'CURDIR = "$(CURDIR)"' \
188 'TOPDIR = "$(TOPDIR)"' \
189 'MACHINE = "$(MACHINE)"' \
190 'OPENVUPLUS_CONF_VERSION = "1"' \
191 'CURDIR = "$(CURDIR)"' \
192 'BB_NUMBER_THREADS = "$(BB_NUMBER_THREADS)"' \
193 'PARALLEL_MAKE = "$(PARALLEL_MAKE)"' \
194 'DL_DIR = "$(DL_DIR)"' \
195 'SSTATE_DIR = "$(SSTATE_DIR)"' \
196 'TMPDIR = "$(TMPDIR)"' \
199 $(TOPDIR)/conf/local.conf: $(DEPDIR)/.local.conf.$(MACHINE).$(LOCAL_CONF_HASH)
200 @echo '[*] Generating $@'
201 @test -d $(@D) || mkdir -p $(@D)
202 @echo '# Automatically generated file. Do not edit!' > $@
203 @echo 'TOPDIR = "$(TOPDIR)"' >> $@
204 @echo 'MACHINE = "$(MACHINE)"' >> $@
205 @echo 'BB_NUMBER_THREADS = "$(BB_NUMBER_THREADS)"' >> $@
206 @echo 'PARALLEL_MAKE = "$(PARALLEL_MAKE)"' >> $@
207 @echo 'DL_DIR = "$(DL_DIR)"' >> $@
208 @echo 'SSTATE_DIR = "$(SSTATE_DIR)"' >> $@
209 @echo 'TMPDIR = "$(TMPDIR)"' >> $@
210 @echo 'BB_GENERATE_MIRROR_TARBALLS = "0"' >> $@
211 @echo 'BBINCLUDELOGS = "yes"' >> $@
212 @echo 'CONF_VERSION = "1"' >> $@
213 @echo 'DISTRO = "vuplus"' >> $@
214 @echo 'EXTRA_IMAGE_FEATURES = "debug-tweaks"' >> $@
215 @echo 'USER_CLASSES = "buildstats"' >> $@
216 @echo 'include $(DISTRO_INCLUDE_CONF)' >> $@
217 @echo 'include $(MACHINE_INCLUDE_CONF)' >> $@
219 BBLAYERS_CONF_HASH := $(call hash, \
220 'BBLAYERS_CONF_VERSION = "0"' \
221 'CURDIR = "$(CURDIR)"' \
222 'BBLAYERS = "$(BBLAYERS)"' \
225 $(TOPDIR)/conf/bblayers.conf: $(DEPDIR)/.bblayers.conf.$(MACHINE).$(BBLAYERS_CONF_HASH)
226 @echo '[*] Generating $@'
227 @test -d $(@D) || mkdir -p $(@D)
228 @echo '# Automatically generated file. Do not edit!' > $@
229 @echo 'LCONF_VERSION = "4"' >> $@
230 @echo 'BBFILES = ""' >> $@
231 @echo 'BBLAYERS = "$(BBLAYERS)"' >> $@
232 @echo 'include $(DISTRO_INCLUDE_CONF)' >> $@
233 @echo 'include $(MACHINE_INCLUDE_CONF)' >> $@
236 @test -d $(@D) || mkdir -p $(@D)
237 @$(RM) $(basename $@).*