Moved master directory back to common to allow for a smooth upgrade
[nslu2-linux/master.git] / openembedded.mk
blobdf238facb6d09419439b2d30b30a44bc00771512
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 sed -i -e 's/^MACHINE[[:space:]]*=[[:space:]]*\".*\"/MACHINE = \"$*\"/' conf/auto.conf
74 .PHONY: setup-distro-%
75 setup-distro-%:
76 sed -i -e 's/^DISTRO[[:space:]]*=[[:space:]]*\".*\"/DISTRO = \"$*\"/' conf/auto.conf
78 .PHONY: setup-image-%
79 setup-image-%:
80 sed -i -e 's/^IMAGE_TARGET[[:space:]]*=[[:space:]]*\".*\"/IMAGE_TARGET = \"$*\"/' conf/auto.conf
82 .PHONY: setup-packages-%
83 setup-packages-%:
84 sed -i -e 's/^DISTRO_TARGET[[:space:]]*=[[:space:]]*\".*\"/DISTRO_TARGET = \"$*\"/' conf/auto.conf
86 .PHONY: clobber
87 clobber:
88 rm -rf tmp
90 .PHONY: source
91 source: $(REQUIRED_DIRS)
92 tar zcf $(DISTRO).tar.gz --exclude=MT --exclude=.svn Makefile setup-env \
93 conf/site.conf conf/auto.conf conf/local.conf.sample $(REQUIRED_DIRS:=/.)
95 # This target probably isn't important any longer, because the -source
96 # target above does the right thing
97 .PHONY:
98 distclean: clobber
99 rm -rf conf/topdir.conf conf/local.conf $(BUILD_DIRS)
101 # This target is mainly for testing - it is intended to put the disto directory
102 # back to its original state, it will destroy a source-tarball system (because
103 # it removes directories from the tarball).
104 .PHONY:
105 really-clean: distclean
106 rm -rf $(REQUIRED_DIRS) $(DISTRO)-source.tar.gz