2 # Makefile for OpenEmbedded builds
3 # Licensed under the GPL v2 or later
5 # conf/auto.conf must exist in the same directory as the Makefile (i.e.
6 # the directory where Makefile is used - it may be a symbolic link to
7 # this file). conf/auto.conf defines:
9 # DISTRO - the OpenEmbedded 'distro' to build
10 # MACHINE - the OpenEmbedded build target machine
12 # All of these values are (should be, must be) quoted in double quotes
13 include conf
/auto.conf
15 BUILD_DIRS
= downloads
16 REQUIRED_DIRS
= bitbake openembedded
17 FIRMWARE_DEPS
= create-topdir
$(BUILD_DIRS
) $(REQUIRED_DIRS
)
20 image
: $(FIRMWARE_DEPS
)
22 . .
/setup-env
; exec
${BITBAKE} $(IMAGE_TARGET
)
24 . .
/setup-env
; exec
${BITBAKE} $(DISTRO
)-image
27 distro
: $(FIRMWARE_DEPS
)
29 . .
/setup-env
; exec
${BITBAKE} -k
$(DISTRO_TARGET
)
31 . .
/setup-env
; exec
${BITBAKE} -k
$(DISTRO
)-packages
34 kernel
: $(FIRMWARE_DEPS
)
36 . .
/setup-env
; exec
${BITBAKE} $(KERNEL_TARGET
)
38 . .
/setup-env
; exec
${BITBAKE} virtual
/kernel
42 . .
/setup-env
; exec
${BITBAKE} package-index
44 prefetch
: $(FIRMWARE_DEPS
)
46 . .
/setup-env
; exec
${BITBAKE} -k
-cfetch
$(DISTRO_TARGET
)
48 . .
/setup-env
; exec
${BITBAKE} -k
-cfetch
$(DISTRO
)-packages
51 # topdir.conf is re-created automatically if the directory is
52 # moved - this will cause a full bitbake reparse
54 create-topdir
: conf
/topdir.conf
55 . conf
/topdir.conf
&& test "`pwd`" = "$$TOPDIR" || echo
"TOPDIR='`pwd`'" > conf
/topdir.conf
58 echo
"TOPDIR='`pwd`'" >$@
60 # rules for directories - if a symlink exists and the target does not
61 # exist something will go wrong in the build, therefore cause a failure
64 test -d
$@ || if
test -d ..
/$@
; then ln
-s ..
/$@ .
; else mkdir
$@
; fi
66 # these directories must already exist - either in TOPDIR (here) or in ..
68 test -d
$@ || if
test -d ..
/$@
; then ln
-s ..
/$@ .
; else exit
1; fi
70 .PHONY
: setup-machine-
%
72 ( grep
"MACHINE = \"$*\"" conf
/auto.conf
> /dev
/null
) || \
73 sed
-i
-e
's/^MACHINE[[:space:]]*=[[:space:]]*\".*\"/MACHINE = \"$*\"/' conf
/auto.conf
75 .PHONY
: setup-distro-
%
77 ( grep
"DISTRO = \"$*\"" conf
/auto.conf
> /dev
/null
) || \
78 sed
-i
-e
's/^DISTRO[[:space:]]*=[[:space:]]*\".*\"/DISTRO = \"$*\"/' conf
/auto.conf
82 ( grep
"IMAGE_TARGET = \"$*\"" conf
/auto.conf
> /dev
/null
) || \
83 sed
-i
-e
's/^IMAGE_TARGET[[:space:]]*=[[:space:]]*\".*\"/IMAGE_TARGET = \"$*\"/' conf
/auto.conf
85 .PHONY
: setup-packages-
%
87 ( grep
"DISTRO_TARGET = \"$*\"" conf
/auto.conf
> /dev
/null
) || \
88 sed
-i
-e
's/^DISTRO_TARGET[[:space:]]*=[[:space:]]*\".*\"/DISTRO_TARGET = \"$*\"/' conf
/auto.conf
95 source
: $(REQUIRED_DIRS
)
96 tar zcf
$(DISTRO
).
tar.gz
--exclude
=MT
--exclude
=.svn Makefile setup-env \
97 conf
/site.conf conf
/auto.conf conf
/local.conf.sample
$(REQUIRED_DIRS
:=/.
)
99 # This target probably isn't important any longer, because the -source
100 # target above does the right thing
103 rm -rf conf
/topdir.conf conf
/local.conf
$(BUILD_DIRS
)
105 # This target is mainly for testing - it is intended to put the disto directory
106 # back to its original state, it will destroy a source-tarball system (because
107 # it removes directories from the tarball).
109 really-clean
: distclean
110 rm -rf
$(REQUIRED_DIRS
) $(DISTRO
)-source.
tar.gz