OpenEmbedded renamed the packages directory to recipes.
[nslu2-linux/master.git] / openembedded.mk
blob57691f41ff74446850f563cedc3547e8d6efca1f
1 #!/bin/make
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)
18 BITBAKE = bitbake -k
20 image: $(FIRMWARE_DEPS)
21 ifdef IMAGE_TARGET
22 . ./setup-env; exec ${BITBAKE} $(IMAGE_TARGET)
23 else
24 . ./setup-env; exec ${BITBAKE} $(DISTRO)-image
25 endif
27 distro: $(FIRMWARE_DEPS)
28 ifdef DISTRO_TARGET
29 . ./setup-env; exec ${BITBAKE} $(DISTRO_TARGET)
30 else
31 . ./setup-env; exec ${BITBAKE} $(DISTRO)-packages
32 endif
34 kernel: $(FIRMWARE_DEPS)
35 ifdef KERNEL_TARGET
36 . ./setup-env; exec ${BITBAKE} $(KERNEL_TARGET)
37 else
38 . ./setup-env; exec ${BITBAKE} virtual/kernel
39 endif
41 index:
42 . ./setup-env; exec ${BITBAKE} package-index
44 prefetch: $(FIRMWARE_DEPS)
45 ifdef DISTRO_TARGET
46 . ./setup-env; exec ${BITBAKE} -cfetch $(DISTRO_TARGET)
47 else
48 . ./setup-env; exec ${BITBAKE} -cfetch $(DISTRO)-packages
49 endif
51 # topdir.conf is re-created automatically if the directory is
52 # moved - this will cause a full bitbake reparse
53 .PHONY: create-topdir
54 create-topdir: conf/topdir.conf
55 . conf/topdir.conf && test "`pwd`" = "$$TOPDIR" || echo "TOPDIR='`pwd`'" > conf/topdir.conf
57 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
62 # here by the mkdir.
63 $(BUILD_DIRS):
64 test -d $@ || if test -d ../$@; then ln -s ../$@ .; else mkdir $@; fi
66 # these directories must already exist - either in TOPDIR (here) or in ..
67 $(REQUIRED_DIRS):
68 test -d $@ || if test -d ../$@; then ln -s ../$@ .; else exit 1; fi
70 .PHONY: setup-machine-%
71 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-%
76 setup-distro-%:
77 ( grep "DISTRO = \"$*\"" conf/auto.conf > /dev/null ) || \
78 sed -i -e 's/^DISTRO[[:space:]]*=[[:space:]]*\".*\"/DISTRO = \"$*\"/' conf/auto.conf
80 .PHONY: setup-image-%
81 setup-image-%:
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-%
86 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
90 .PHONY: clobber
91 clobber:
92 rm -rf tmp
94 .PHONY: source
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
101 .PHONY:
102 distclean: clobber
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).
108 .PHONY:
109 really-clean: distclean
110 rm -rf $(REQUIRED_DIRS) $(DISTRO)-source.tar.gz