diff options
author | Ian Wienand <ianw@gelato.unsw.edu.au> | 2004-09-06 01:54:23 +0200 |
---|---|---|
committer | Tom Rini <trini@kernel.crashing.org> | 2004-09-06 01:54:23 +0200 |
commit | ef41e994a32b70de5b88bc3543cf2b931bd2a162 (patch) | |
tree | 62cc9a8e3880c793421b2b55e5ebd82596a65de6 /Makefile | |
parent | f7e7e745a3c505bdb3f93ea25b0a208238e7d05e (diff) | |
download | history-ef41e994a32b70de5b88bc3543cf2b931bd2a162.tar.gz |
kbuild: Support LOCALVERSION
Add LOCALVERSION so we can append strings that show up in uname
without having to fiddle with the Makefile and EXTRAVERSION, etc.
* localversion* files are read first
* config variable is appended last
* LOCALVERSION from the command line overrides all of this
* check is forced on build, since we can't really know when
the config or environment options change.
Signed-off-by: Ian Wienand <ianw@gelato.unsw.edu.au>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/Makefile b/Makefile index 6bdccdc8e2d4da..d80624b25f5740 100644 --- a/Makefile +++ b/Makefile @@ -141,7 +141,25 @@ VPATH := $(srctree) export srctree objtree VPATH TOPDIR -KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) +nullstring := +space := $(nullstring) # end of line + +# Take the contents of any files called localversion* and the config +# variable CONFIG_LOCALVERSION and append them to KERNELRELEASE. Be +# careful not to include files twice if building in the source +# directory. LOCALVERSION from the command line override all of this + +ifeq ($(objtree),$(srctree)) +localversion-files := $(wildcard $(srctree)/localversion*) +else +localversion-files := $(wildcard $(objtree)/localversion* $(srctree)/localversion*) +endif + +LOCALVERSION = $(subst $(space),, \ + $(shell cat /dev/null $(localversion-files)) \ + $(subst ",,$(CONFIG_LOCALVERSION))) + +KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)$(LOCALVERSION) # SUBARCH tells the usermode build what the underlying arch is. That is set # first, and if a usermode build is happening, the "ARCH=um" on the command @@ -329,8 +347,8 @@ CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common AFLAGS := -D__ASSEMBLY__ -export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ - CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ +export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION LOCALVERSION KERNELRELEASE \ + ARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS @@ -747,8 +765,8 @@ include/config/MARKER: include/linux/autoconf.h # Generate some files # --------------------------------------------------------------------------- -# version.h changes when $(KERNELRELEASE) etc change, as defined in -# this Makefile +# KERNELRELEASE can change from a few different places, meaning version.h +# needs to be updated, so this check is forced on all builds uts_len := 64 @@ -763,7 +781,7 @@ define filechk_version.h ) endef -include/linux/version.h: Makefile +include/linux/version.h: FORCE $(call filechk,version.h) # --------------------------------------------------------------------------- |