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
24 # Note: You can override all variables by storing them
25 # in an external file called "make.conf".
26 -include conf/make.conf
29 # vusolo, bm750, vuuno, vuultimo, vusolo2
31 # This only sets the default value. All platforms now use a shared build
32 # directory. Run "MACHINE=vuultimo bitbake vuplus-image" to build an image
33 # for the vuultimo, if it is not the default.
36 MULTI_TEMPORARILY ?= YES
38 # Adjust according to the number CPU cores to use for parallel build.
39 # Default: Number of processors in /proc/cpuinfo, if present, or 1.
40 NR_CPU := $(shell [ -f /proc/cpuinfo ] && grep -c '^processor\s*:' /proc/cpuinfo || echo 1)
41 BB_NUMBER_THREADS ?= $(NR_CPU)
42 PARALLEL_MAKE ?= -j $(NR_CPU)
46 BUILD_DIR = $(CURDIR)/build
47 TOPDIR = $(BUILD_DIR)/$(MACHINE)
48 DL_DIR = $(CURDIR)/sources
50 ifeq ($(MULTI_TEMPORARILY), YES)
51 SSTATE_DIR = $(TOPDIR)/sstate-cache
52 TMPDIR = $(TOPDIR)/tmp
53 DEPDIR = $(TOPDIR)/.deps
55 SSTATE_DIR = $(BUILD_DIR)/sstate-cache
56 TMPDIR = $(BUILD_DIR)/tmp
57 DEPDIR = $(BUILD_DIR)/.deps
62 $(CURDIR)/meta-openvuplus \
63 $(CURDIR)/meta-openembedded/meta-oe \
64 $(CURDIR)/meta-openembedded/meta-networking \
65 $(CURDIR)/meta-openembedded/meta-multimedia \
66 $(CURDIR)/meta-openembedded/meta-filesystems \
67 $(CURDIR)/meta-openembedded/meta-python \
68 $(CURDIR)/openembedded-core/meta
71 $(TOPDIR)/bitbake.env \
72 $(TOPDIR)/conf/bblayers.conf \
73 $(TOPDIR)/conf/local.conf
76 $(DEPDIR)/.bitbake.env.$(BITBAKE_ENV_HASH) \
77 $(DEPDIR)/.bblayers.conf.$(MACHINE).$(BBLAYERS_CONF_HASH) \
78 $(DEPDIR)/.local.conf.$(MACHINE).$(LOCAL_CONF_HASH)
81 GIT_REMOTE := $(shell $(GIT) remote)
82 GIT_USER_NAME := $(shell $(GIT) config user.name)
83 GIT_USER_EMAIL := $(shell $(GIT) config user.email)
85 hash = $(shell echo $(1) | $(XSUM) | awk '{print $$1}')
91 [ -d $@ ] || $(MAKE) $(MFLAGS) update
93 init: $(BBLAYERS) $(CONFFILES)
94 @if [ ! -e $(CURDIR)/sources ]; then mkdir -p $(CURDIR)/sources; fi
99 @echo " * Update the SDK"
100 @echo " $$ $(MAKE) update"
102 @echo " * Select a new target machine:"
103 @echo " $$ echo MACHINE=vuultimo >> conf/make.conf"
104 @echo " [Valid values: vusolo, bm750, vuuno, vuultimo, vusolo2]"
106 @echo " * Build a firmware image for the selected target machine:"
107 @echo " $$ $(MAKE) image"
109 @echo " * Build a firmware image for a different target machine:"
110 @echo " $$ $(MAKE) image MACHINE=vuultimo"
111 @echo " [Valid values: vusolo, bm750, vuuno, vuultimo, vusolo2]"
113 @echo " * Download all source files at once:"
114 @echo " $$ $(MAKE) download"
116 @echo " * Set up the environment to build recipes manually:"
117 @echo " $$ cd $(BUILD_DIR)"
118 @echo " $$ source bitbake.env"
119 @echo " $$ bitbake <target>"
120 @echo " [Replace <target> with a recipe name, e.g. vuplus-image or enigma2]"
122 @echo "Your current settings:"
123 @echo " MACHINE = $(MACHINE)"
125 @echo " BB_NUMBER_THREADS = $(BB_NUMBER_THREADS)"
126 @echo " PARALLEL_MAKE = $(PARALLEL_MAKE)"
128 @echo "Trouble finding a recipe? Try ./scripts/drepo grep 'search string'"
129 @echo "or ./scripts/drepo find -name \"*recipe*\"."
133 @echo "[*] Please run '$(MAKE) help' to display further information!"
136 @echo '[*] Deleting generated configuration files'
137 @$(RM) $(CONFFILES) $(CONFDEPS)
140 @echo '[*] Deleting dependencies directory'
142 @echo '[*] Deleting download directory'
144 @echo '[*] Deleting tmp directory'
146 @echo '[*] Deleting sstate directory'
147 @$(RM) -r $(SSTATE_DIR)
148 @echo '[*] Deleting build directory'
149 @$(RM) -r $(BUILD_DIR)
150 @echo '[*] Deleting git submodules'
151 @$(GIT) submodule foreach 'rm -rf .* * 2>/dev/null || true'
154 @echo '[*] Building image for $(MACHINE)'
155 @. $(TOPDIR)/bitbake.env && cd $(TOPDIR) && bitbake vuplus-image
158 @echo '[*] Downloading sources'
159 @. $(TOPDIR)/bitbake.env && cd $(TOPDIR) && bitbake -cfetchall -k vuplus-image
162 @echo '[*] Updating Git repositories...'
163 @HASH=`$(XSUM) $(MAKEFILE_LIST)`; \
164 if [ -n "$(GIT_REMOTE)" ]; then \
165 $(GIT) pull --ff-only || $(GIT) pull --rebase; \
167 if [ "$$HASH" != "`$(XSUM) $(MAKEFILE_LIST)`" ]; then \
168 echo '[*] Makefile changed. Restarting...'; \
169 $(MAKE) $(MFLAGS) --no-print-directory $(MAKECMDGOALS); \
171 $(GIT) submodule sync && \
172 $(GIT) submodule update --init && \
173 echo "[*] The Vuplus SDK is now up-to-date."; \
176 .PHONY: all clean help image init update usage
178 MACHINE_INCLUDE_CONF = $(CURDIR)/conf/$(basename $(@F))-$(MACHINE)-ext.conf
179 DISTRO_INCLUDE_CONF = $(CURDIR)/conf/$(basename $(@F))-ext.conf
181 BITBAKE_ENV_HASH := $(call hash, \
182 'BITBAKE_ENV_VERSION = "0"' \
183 'CURDIR = "$(CURDIR)"' \
186 $(TOPDIR)/bitbake.env: $(DEPDIR)/.bitbake.env.$(BITBAKE_ENV_HASH)
187 @echo '[*] Generating $@'
188 @test -d $(@D) || mkdir -p $(@D)
189 @echo '# Automatically generated file. Do not edit!' > $@
190 @echo 'export PATH=$(CURDIR)/openembedded-core/scripts:$(CURDIR)/bitbake/bin:$${PATH}' >> $@
192 LOCAL_CONF_HASH := $(call hash, \
193 'LOCAL_CONF_VERSION = "0"' \
194 'CURDIR = "$(CURDIR)"' \
195 'TOPDIR = "$(TOPDIR)"' \
196 'MACHINE = "$(MACHINE)"' \
197 'OPENVUPLUS_CONF_VERSION = "1"' \
198 'CURDIR = "$(CURDIR)"' \
199 'BB_NUMBER_THREADS = "$(BB_NUMBER_THREADS)"' \
200 'PARALLEL_MAKE = "$(PARALLEL_MAKE)"' \
201 'DL_DIR = "$(DL_DIR)"' \
202 'SSTATE_DIR = "$(SSTATE_DIR)"' \
203 'TMPDIR = "$(TMPDIR)"' \
206 $(TOPDIR)/conf/local.conf: $(DEPDIR)/.local.conf.$(MACHINE).$(LOCAL_CONF_HASH)
207 @echo '[*] Generating $@'
208 @test -d $(@D) || mkdir -p $(@D)
209 @echo '# Automatically generated file. Do not edit!' > $@
210 @echo 'TOPDIR = "$(TOPDIR)"' >> $@
211 @echo 'MACHINE = "$(MACHINE)"' >> $@
212 @echo 'BB_NUMBER_THREADS = "$(BB_NUMBER_THREADS)"' >> $@
213 @echo 'PARALLEL_MAKE = "$(PARALLEL_MAKE)"' >> $@
214 @echo 'DL_DIR = "$(DL_DIR)"' >> $@
215 @echo 'SSTATE_DIR = "$(SSTATE_DIR)"' >> $@
216 @echo 'TMPDIR = "$(TMPDIR)"' >> $@
217 @echo 'BB_GENERATE_MIRROR_TARBALLS = "0"' >> $@
218 @echo 'BBINCLUDELOGS = "yes"' >> $@
219 @echo 'CONF_VERSION = "1"' >> $@
220 @echo 'DISTRO = "vuplus"' >> $@
221 @echo 'EXTRA_IMAGE_FEATURES = "debug-tweaks"' >> $@
222 @echo 'USER_CLASSES = "buildstats"' >> $@
223 @echo 'include $(DISTRO_INCLUDE_CONF)' >> $@
224 @echo 'include $(MACHINE_INCLUDE_CONF)' >> $@
225 @if [ "$(MULTI_TEMPORARILY)" == "YES" ] ; then \
226 echo "DEPLOY_DIR_IMAGE = \"\$${DEPLOY_DIR}/images\"" >> $@; \
228 @echo 'INHERIT += "rm_work"' >> $@
230 BBLAYERS_CONF_HASH := $(call hash, \
231 'BBLAYERS_CONF_VERSION = "0"' \
232 'CURDIR = "$(CURDIR)"' \
233 'BBLAYERS = "$(BBLAYERS)"' \
236 $(TOPDIR)/conf/bblayers.conf: $(DEPDIR)/.bblayers.conf.$(MACHINE).$(BBLAYERS_CONF_HASH)
237 @echo '[*] Generating $@'
238 @test -d $(@D) || mkdir -p $(@D)
239 @echo '# Automatically generated file. Do not edit!' > $@
240 @echo 'LCONF_VERSION = "4"' >> $@
241 @echo 'BBFILES = ""' >> $@
242 @echo 'BBLAYERS = "$(BBLAYERS)"' >> $@
243 @echo 'include $(DISTRO_INCLUDE_CONF)' >> $@
244 @echo 'include $(MACHINE_INCLUDE_CONF)' >> $@
247 @test -d $(@D) || mkdir -p $(@D)
248 @$(RM) $(basename $@).*