3 # Copyright (c) 2010-2012 Dream Multimedia GmbH, Germany
4 # http://www.dream-multimedia-tv.de/
6 # Andreas Oberritter <obi@opendreambox.org>
8 # Permission is hereby granted, free of charge, to any person obtaining a copy
9 # of this software and associated documentation files (the "Software"), to deal
10 # in the Software without restriction, including without limitation the rights
11 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 # copies of the Software, and to permit persons to whom the Software is
13 # furnished to do so, subject to the following conditions:
15 # The above copyright notice and this permission notice shall be included in
16 # all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 # Note: You can override all variables by storing them
28 # in an external file called "make.conf".
29 -include conf/make.conf
32 # dm500hd, dm800, dm800se, dm7020hd, dm8000
34 # This only sets the default value. All platforms now use a shared build
35 # directory. Run "MACHINE=dm800se bitbake dreambox-image" to build an image
36 # for the dm800se, if it is not the default.
39 # Adjust according to the number CPU cores to use for parallel build.
40 # Default: Number of processors in /proc/cpuinfo, if present, or 1.
41 NR_CPU := $(shell [ -f /proc/cpuinfo ] && grep -c '^processor\s*:' /proc/cpuinfo || echo 1)
42 BB_NUMBER_THREADS ?= $(NR_CPU)
43 PARALLEL_MAKE ?= -j $(NR_CPU)
47 BUILD_DIR = $(CURDIR)/build
48 TOPDIR = $(BUILD_DIR)/$(MACHINE)
49 DL_DIR = $(CURDIR)/sources
50 SSTATE_DIR = $(CURDIR)/sstate-cache
51 TMPDIR = $(CURDIR)/tmp
52 DEPDIR = $(CURDIR)/.deps
55 $(CURDIR)/meta-bsp/$(MACHINE) \
56 $(CURDIR)/meta-bsp/common \
57 $(CURDIR)/meta-opendreambox \
58 $(CURDIR)/meta-openembedded/meta-oe \
59 $(CURDIR)/openembedded-core/meta
63 conf/opendreambox.conf \
64 $(TOPDIR)/conf/bblayers.conf \
65 $(TOPDIR)/conf/local.conf
68 $(DEPDIR)/.bitbake.env.$(BITBAKE_ENV_HASH) \
69 $(DEPDIR)/.opendreambox.conf.$(OPENDREAMBOX_CONF_HASH) \
70 $(DEPDIR)/.bblayers.conf.$(MACHINE).$(BBLAYERS_CONF_HASH) \
71 $(DEPDIR)/.local.conf.$(MACHINE).$(LOCAL_CONF_HASH)
74 GIT_REMOTE := $(shell $(GIT) remote)
75 GIT_USER_NAME := $(shell $(GIT) config user.name)
76 GIT_USER_EMAIL := $(shell $(GIT) config user.email)
78 hash = $(shell echo $(1) | $(XSUM) | awk '{print $$1}')
84 [ -d $@ ] || $(MAKE) $(MFLAGS) update
86 init: $(BBLAYERS) $(CONFFILES)
91 @echo " * Update the SDK"
92 @echo " $$ $(MAKE) update"
94 @echo " * Build the PDF documentation (doc/opendreambox.pdf, requires pdfTeX):"
95 @echo " $$ $(MAKE) doc"
97 @echo " * View the documentation in text format:"
98 @echo " $$ view doc/opendreambox.txt"
100 @echo " * Select a new target machine:"
101 @echo " $$ echo MACHINE=dm800se >> conf/make.conf"
102 @echo " [Valid values: dm500hd, dm800, dm800se, dm7020hd, dm8000]"
104 @echo " * Build a firmware image for the selected target machine:"
105 @echo " $$ $(MAKE) image"
107 @echo " * Build a firmware image for a different target machine:"
108 @echo " $$ $(MAKE) image MACHINE=dm800se"
109 @echo " [Valid values: dm500hd, dm800, dm800se, dm7020hd, dm8000]"
111 @echo " * Download all source files at once:"
112 @echo " $$ $(MAKE) download"
114 @echo " * Set up the environment to build recipes manually:"
115 @echo " $$ source bitbake.env"
116 @echo " $$ cd build/$(MACHINE)"
117 @echo " $$ bitbake <target>"
118 @echo " [Replace <target> with a recipe name, e.g. dreambox-image or enigma2]"
120 @echo "Your current settings:"
121 @echo " MACHINE = $(MACHINE)"
123 @echo " BB_NUMBER_THREADS = $(BB_NUMBER_THREADS)"
124 @echo " PARALLEL_MAKE = $(PARALLEL_MAKE)"
126 @echo "Trouble finding a recipe? Try ./scripts/drepo grep 'search string'"
127 @echo "or ./scripts/drepo find -name \"*recipe*\"."
129 @if [ -z "$(GIT_USER_NAME)" -o -z "$(GIT_USER_EMAIL)" ]; then \
130 echo "Before doing any commits, please configure your name and email"; \
131 echo "address using the following commands:"; \
133 echo " $$ $(GIT) config user.name \"Your Name\""; \
134 echo " $$ $(GIT) config user.email \"mail@example.com\""; \
136 echo "Git has been configured for $(GIT_USER_NAME) <$(GIT_USER_EMAIL)>."; \
137 echo "Please submit patches to <enigma2-devel@lists.elitedvb.net>."; \
141 @echo "[*] Please run '$(MAKE) help' to display further information!"
144 @echo '[*] Deleting generated configuration files'
145 @$(RM) $(CONFFILES) $(CONFDEPS)
146 @$(MAKE) $(MFLAGS) -C doc clean
149 @echo '[*] Deleting dependencies directory'
151 @echo '[*] Deleting download directory'
153 @echo '[*] Deleting tmp directory'
155 @echo '[*] Deleting sstate directory'
156 @$(RM) -r $(SSTATE_DIR)
157 @echo '[*] Deleting build directory'
158 @$(RM) -r $(BUILD_DIR)
159 @echo '[*] Deleting git submodules'
160 @$(GIT) submodule foreach 'rm -rf .* * 2>/dev/null || true'
163 @$(MAKE) $(MFLAGS) -C doc
166 @echo '[*] Building image for $(MACHINE)'
167 @. $(CURDIR)/bitbake.env && cd $(TOPDIR) && bitbake dreambox-image
170 @echo '[*] Downloading sources'
171 @. $(CURDIR)/bitbake.env && cd $(TOPDIR) && bitbake -cfetchall -k dreambox-image
174 @echo '[*] Updating Git repositories...'
175 @HASH=`$(XSUM) $(MAKEFILE_LIST)`; \
176 if [ -n "$(GIT_REMOTE)" ]; then \
177 $(GIT) pull --ff-only || $(GIT) pull --rebase; \
179 if [ "$$HASH" != "`$(XSUM) $(MAKEFILE_LIST)`" ]; then \
180 echo '[*] Makefile changed. Restarting...'; \
181 $(MAKE) $(MFLAGS) --no-print-directory $(MAKECMDGOALS); \
183 $(GIT) submodule sync && \
184 $(GIT) submodule update --init && \
185 echo "[*] The Dreambox SDK is now up-to-date."; \
188 .PHONY: all clean doc help image init update usage
190 MACHINE_INCLUDE_CONF = $(CURDIR)/conf/$(basename $(@F))-$(MACHINE)-ext.conf
191 DISTRO_INCLUDE_CONF = $(CURDIR)/conf/$(basename $(@F))-ext.conf
193 BITBAKE_ENV_HASH := $(call hash, \
194 'BITBAKE_ENV_VERSION = "0"' \
195 'CURDIR = "$(CURDIR)"' \
198 bitbake.env: $(DEPDIR)/.bitbake.env.$(BITBAKE_ENV_HASH)
199 @echo '[*] Generating $@'
200 @echo '# Automatically generated file. Do not edit!' > $@
201 @echo 'export PATH=$(CURDIR)/openembedded-core/scripts:$(CURDIR)/bitbake/bin:$${PATH}' >> $@
203 OPENDREAMBOX_CONF_HASH := $(call hash, \
204 'OPENDREAMBOX_CONF_VERSION = "1"' \
205 'CURDIR = "$(CURDIR)"' \
206 'BB_NUMBER_THREADS = "$(BB_NUMBER_THREADS)"' \
207 'PARALLEL_MAKE = "$(PARALLEL_MAKE)"' \
208 'DL_DIR = "$(DL_DIR)"' \
209 'SSTATE_DIR = "$(SSTATE_DIR)"' \
210 'TMPDIR = "$(TMPDIR)"' \
213 conf/opendreambox.conf: $(DEPDIR)/.opendreambox.conf.$(OPENDREAMBOX_CONF_HASH)
214 @echo '[*] Generating $@'
215 @test -d $(@D) || mkdir -p $(@D)
216 @echo '# Automatically generated file. Do not edit!' > $@
217 @echo 'BB_NUMBER_THREADS = "$(BB_NUMBER_THREADS)"' >> $@
218 @echo 'PARALLEL_MAKE = "$(PARALLEL_MAKE)"' >> $@
219 @echo 'DL_DIR = "$(DL_DIR)"' >> $@
220 @echo 'SSTATE_DIR = "$(SSTATE_DIR)"' >> $@
221 @echo 'TMPDIR = "$(TMPDIR)"' >> $@
222 @echo 'BB_GENERATE_MIRROR_TARBALLS = "0"' >> $@
223 @echo 'BBINCLUDELOGS = "yes"' >> $@
224 @echo 'CONF_VERSION = "1"' >> $@
225 @echo 'DISTRO = "opendreambox"' >> $@
226 @echo 'EXTRA_IMAGE_FEATURES = "debug-tweaks"' >> $@
227 @echo 'USER_CLASSES = "buildstats"' >> $@
229 LOCAL_CONF_HASH := $(call hash, \
230 'LOCAL_CONF_VERSION = "0"' \
231 'CURDIR = "$(CURDIR)"' \
232 'TOPDIR = "$(TOPDIR)"' \
233 'MACHINE = "$(MACHINE)"' \
236 $(TOPDIR)/conf/local.conf: $(DEPDIR)/.local.conf.$(MACHINE).$(LOCAL_CONF_HASH)
237 @echo '[*] Generating $@'
238 @test -d $(@D) || mkdir -p $(@D)
239 @echo '# Automatically generated file. Do not edit!' > $@
240 @echo 'TOPDIR = "$(TOPDIR)"' >> $@
241 @echo 'MACHINE = "$(MACHINE)"' >> $@
242 @echo 'require $(CURDIR)/conf/opendreambox.conf' >> $@
243 @echo 'include $(DISTRO_INCLUDE_CONF)' >> $@
244 @echo 'include $(MACHINE_INCLUDE_CONF)' >> $@
246 BBLAYERS_CONF_HASH := $(call hash, \
247 'BBLAYERS_CONF_VERSION = "0"' \
248 'CURDIR = "$(CURDIR)"' \
249 'BBLAYERS = "$(BBLAYERS)"' \
252 $(TOPDIR)/conf/bblayers.conf: $(DEPDIR)/.bblayers.conf.$(MACHINE).$(BBLAYERS_CONF_HASH)
253 @echo '[*] Generating $@'
254 @test -d $(@D) || mkdir -p $(@D)
255 @echo '# Automatically generated file. Do not edit!' > $@
256 @echo 'LCONF_VERSION = "4"' >> $@
257 @echo 'BBFILES = ""' >> $@
258 @echo 'BBLAYERS = "$(BBLAYERS)"' >> $@
259 @echo 'include $(DISTRO_INCLUDE_CONF)' >> $@
260 @echo 'include $(MACHINE_INCLUDE_CONF)' >> $@
263 @test -d $(@D) || mkdir -p $(@D)
264 @$(RM) $(basename $@).*