[libvorbis] update to 1.3.4
[vuplus_openvuplus_3.0] / Makefile
1 #!/usr/bin/make -f
2 #
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:
9 #
10 # The above copyright notice and this permission notice shall be included in
11 # all copies or substantial portions of the Software.
12 #
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
19 # THE SOFTWARE.
20 #
21
22 # Note: You can override all variables by storing them
23 # in an external file called "make.conf".
24 -include conf/make.conf
25
26 # Target platform:
27 # vusolo, bm750, vuuno, vuultimo, vusolo2
28 #
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.
32 MACHINE ?= vuultimo
33
34 MULTI_TEMPORARILY ?= YES
35
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)
41
42 XSUM ?= md5sum
43
44 BUILD_DIR = $(CURDIR)/build
45 TOPDIR = $(BUILD_DIR)/$(MACHINE)
46 DL_DIR = $(CURDIR)/resource/sources
47
48 ifeq ($(MULTI_TEMPORARILY), YES)
49 SSTATE_DIR = $(TOPDIR)/sstate-cache
50 TMPDIR = $(TOPDIR)/tmp
51 DEPDIR = $(TOPDIR)/.deps
52 else
53 SSTATE_DIR = $(BUILD_DIR)/sstate-cache
54 TMPDIR = $(BUILD_DIR)/tmp
55 DEPDIR = $(BUILD_DIR)/.deps
56 endif
57
58 BBLAYERS ?= \
59         $(CURDIR)/meta-bsp/$(MACHINE) \
60         $(CURDIR)/meta-bsp/common \
61         $(CURDIR)/meta-openvuplus \
62         $(CURDIR)/meta-openembedded/meta-oe \
63         $(CURDIR)/meta-openembedded/meta-networking \
64         $(CURDIR)/meta-openembedded/meta-multimedia \
65         $(CURDIR)/meta-openembedded/meta-filesystems \
66         $(CURDIR)/openembedded-core/meta
67
68 CONFFILES = \
69         $(TOPDIR)/bitbake.env \
70         $(TOPDIR)/conf/bblayers.conf \
71         $(TOPDIR)/conf/local.conf
72
73 CONFDEPS = \
74         $(DEPDIR)/.bitbake.env.$(BITBAKE_ENV_HASH) \
75         $(DEPDIR)/.bblayers.conf.$(MACHINE).$(BBLAYERS_CONF_HASH) \
76         $(DEPDIR)/.local.conf.$(MACHINE).$(LOCAL_CONF_HASH)
77
78 GIT ?= git
79 GIT_REMOTE := $(shell $(GIT) remote)
80 GIT_USER_NAME := $(shell $(GIT) config user.name)
81 GIT_USER_EMAIL := $(shell $(GIT) config user.email)
82
83 hash = $(shell echo $(1) | $(XSUM) | awk '{print $$1}')
84
85 .DEFAULT_GOAL := all
86 all: init usage
87
88 $(BBLAYERS):
89         [ -d $@ ] || $(MAKE) $(MFLAGS) update
90
91 init: $(BBLAYERS) $(CONFFILES)
92
93 help:
94         @echo "Your options:"
95         @echo
96         @echo "  * Update the SDK"
97         @echo "      $$ $(MAKE) update"
98         @echo
99         @echo "  * Select a new target machine:"
100         @echo "      $$ echo MACHINE=vuultimo >> conf/make.conf"
101         @echo "    [Valid values: vusolo, bm750, vuuno, vuultimo, vusolo2]"
102         @echo
103         @echo "  * Build a firmware image for the selected target machine:"
104         @echo "      $$ $(MAKE) image"
105         @echo
106         @echo "  * Build a firmware image for a different target machine:"
107         @echo "      $$ $(MAKE) image MACHINE=vuultimo"
108         @echo "    [Valid values: vusolo, bm750, vuuno, vuultimo, vusolo2]"
109         @echo
110         @echo "  * Download all source files at once:"
111         @echo "      $$ $(MAKE) download"
112         @echo
113         @echo "  * Set up the environment to build recipes manually:"
114         @echo "      $$ cd $(BUILD_DIR)"
115         @echo "      $$ source bitbake.env"
116         @echo "      $$ bitbake <target>"
117         @echo "    [Replace <target> with a recipe name, e.g. vuplus-image or enigma2]"
118         @echo
119         @echo "Your current settings:"
120         @echo "  MACHINE = $(MACHINE)"
121         @echo
122         @echo "  BB_NUMBER_THREADS = $(BB_NUMBER_THREADS)"
123         @echo "  PARALLEL_MAKE = $(PARALLEL_MAKE)"
124         @echo
125         @echo "Trouble finding a recipe? Try ./scripts/drepo grep 'search string'"
126         @echo "or ./scripts/drepo find -name \"*recipe*\"."
127         @echo
128
129 usage:
130         @echo "[*] Please run '$(MAKE) help' to display further information!"
131
132 clean:
133         @echo '[*] Deleting generated configuration files'
134         @$(RM) $(CONFFILES) $(CONFDEPS)
135
136 distclean: clean
137         @echo '[*] Deleting dependencies directory'
138         @$(RM) -r $(DEPDIR)
139         @echo '[*] Deleting download directory'
140         @$(RM) -r $(DL_DIR)
141         @echo '[*] Deleting tmp directory'
142         @$(RM) -r $(TMPDIR)
143         @echo '[*] Deleting sstate directory'
144         @$(RM) -r $(SSTATE_DIR)
145         @echo '[*] Deleting build directory'
146         @$(RM) -r $(BUILD_DIR)
147         @echo '[*] Deleting git submodules'
148         @$(GIT) submodule foreach 'rm -rf .* * 2>/dev/null || true'
149
150 image: init
151         @echo '[*] Building image for $(MACHINE)'
152         @. $(TOPDIR)/bitbake.env && cd $(TOPDIR) && bitbake vuplus-image
153
154 download: init
155         @echo '[*] Downloading sources'
156         @. $(TOPDIR)/bitbake.env && cd $(TOPDIR) && bitbake -cfetchall -k vuplus-image
157
158 update:
159         @echo '[*] Updating Git repositories...'
160         @HASH=`$(XSUM) $(MAKEFILE_LIST)`; \
161         if [ -n "$(GIT_REMOTE)" ]; then \
162                 $(GIT) pull --ff-only || $(GIT) pull --rebase; \
163         fi; \
164         if [ "$$HASH" != "`$(XSUM) $(MAKEFILE_LIST)`" ]; then \
165                 echo '[*] Makefile changed. Restarting...'; \
166                 $(MAKE) $(MFLAGS) --no-print-directory $(MAKECMDGOALS); \
167         else \
168                 $(GIT) submodule sync && \
169                 $(GIT) submodule update --init && \
170                 echo "[*] The Vuplus SDK is now up-to-date."; \
171         fi
172
173 .PHONY: all clean help image init update usage
174
175 MACHINE_INCLUDE_CONF = $(CURDIR)/conf/$(basename $(@F))-$(MACHINE)-ext.conf
176 DISTRO_INCLUDE_CONF = $(CURDIR)/conf/$(basename $(@F))-ext.conf
177
178 BITBAKE_ENV_HASH := $(call hash, \
179         'BITBAKE_ENV_VERSION = "0"' \
180         'CURDIR = "$(CURDIR)"' \
181         )
182
183 $(TOPDIR)/bitbake.env: $(DEPDIR)/.bitbake.env.$(BITBAKE_ENV_HASH)
184         @echo '[*] Generating $@'
185         @test -d $(@D) || mkdir -p $(@D)
186         @echo '# Automatically generated file. Do not edit!' > $@
187         @echo 'export PATH=$(CURDIR)/openembedded-core/scripts:$(CURDIR)/bitbake/bin:$${PATH}' >> $@
188
189 LOCAL_CONF_HASH := $(call hash, \
190         'LOCAL_CONF_VERSION = "0"' \
191         'CURDIR = "$(CURDIR)"' \
192         'TOPDIR = "$(TOPDIR)"' \
193         'MACHINE = "$(MACHINE)"' \
194         'OPENVUPLUS_CONF_VERSION = "1"' \
195         'CURDIR = "$(CURDIR)"' \
196         'BB_NUMBER_THREADS = "$(BB_NUMBER_THREADS)"' \
197         'PARALLEL_MAKE = "$(PARALLEL_MAKE)"' \
198         'DL_DIR = "$(DL_DIR)"' \
199         'SSTATE_DIR = "$(SSTATE_DIR)"' \
200         'TMPDIR = "$(TMPDIR)"' \
201         )
202
203 $(TOPDIR)/conf/local.conf: $(DEPDIR)/.local.conf.$(MACHINE).$(LOCAL_CONF_HASH)
204         @echo '[*] Generating $@'
205         @test -d $(@D) || mkdir -p $(@D)
206         @echo '# Automatically generated file. Do not edit!' > $@
207         @echo 'TOPDIR = "$(TOPDIR)"' >> $@
208         @echo 'MACHINE = "$(MACHINE)"' >> $@
209         @echo 'BB_NUMBER_THREADS = "$(BB_NUMBER_THREADS)"' >> $@
210         @echo 'PARALLEL_MAKE = "$(PARALLEL_MAKE)"' >> $@
211         @echo 'DL_DIR = "$(DL_DIR)"' >> $@
212         @echo 'SSTATE_DIR = "$(SSTATE_DIR)"' >> $@
213         @echo 'TMPDIR = "$(TMPDIR)"' >> $@
214         @echo 'BB_GENERATE_MIRROR_TARBALLS = "0"' >> $@
215         @echo 'BBINCLUDELOGS = "yes"' >> $@
216         @echo 'CONF_VERSION = "1"' >> $@
217         @echo 'DISTRO = "vuplus"' >> $@
218         @echo 'EXTRA_IMAGE_FEATURES = "debug-tweaks"' >> $@
219         @echo 'USER_CLASSES = "buildstats"' >> $@
220         @echo 'include $(DISTRO_INCLUDE_CONF)' >> $@
221         @echo 'include $(MACHINE_INCLUDE_CONF)' >> $@
222         @echo 'INHERIT += "rm_work"' >> $@
223
224 BBLAYERS_CONF_HASH := $(call hash, \
225         'BBLAYERS_CONF_VERSION = "0"' \
226         'CURDIR = "$(CURDIR)"' \
227         'BBLAYERS = "$(BBLAYERS)"' \
228         )
229
230 $(TOPDIR)/conf/bblayers.conf: $(DEPDIR)/.bblayers.conf.$(MACHINE).$(BBLAYERS_CONF_HASH)
231         @echo '[*] Generating $@'
232         @test -d $(@D) || mkdir -p $(@D)
233         @echo '# Automatically generated file. Do not edit!' > $@
234         @echo 'LCONF_VERSION = "4"' >> $@
235         @echo 'BBFILES = ""' >> $@
236         @echo 'BBLAYERS = "$(BBLAYERS)"' >> $@
237         @echo 'include $(DISTRO_INCLUDE_CONF)' >> $@
238         @echo 'include $(MACHINE_INCLUDE_CONF)' >> $@
239
240 $(CONFDEPS):
241         @test -d $(@D) || mkdir -p $(@D)
242         @$(RM) $(basename $@).*
243         @touch $@