package: add helper functions to get package name and directory magically
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 29 Sep 2011 19:57:41 +0000 (21:57 +0200)
committerPeter Korsgaard <jacmet@sunsite.dk>
Thu, 29 Sep 2011 21:06:28 +0000 (23:06 +0200)
commite055aea216cff4d12cf55eab2e35ca1459edaa91
tree246ff646e8835598d508dd85a89078683caf9121
parent793a2ea5174e5352ec18ca32f7914c7071bf3108
package: add helper functions to get package name and directory magically

This commit adds the functions "pkgname" and "pkgdir", which can then
be used to automatically find the name of the package and the
directory of the package which does the call to
GENTARGETS/AUTOTARGETS/CMAKETARGETS. These functions use the
$(MAKEFILE_LIST) variable, which make automatically makes available,
and which contains the list of included Makefiles, with the current
Makefile being last. Thanks to this variable and a little bit of
string manipulation, we can easily find out automatically the package
name and the directory it is part of.

These functions are used in later commits to simplify the GENTARGETS,
AUTOTARGETS and CMAKETARGETS calls.

[Peter: Rename to pkgmakefile->pkgdir, pkgdir->pkgparentdir as that's what it is]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
package/Makefile.package.in