diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-11-19 12:15:07 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-11-19 12:19:30 +1100 |
commit | 0b18bd2ae2db1e6fd15e859b00b23bb39886f528 (patch) | |
tree | b6e2c141d55c2d274b152fadea92871a3f08e803 /Makefile.main | |
parent | 0265f805be05f224fbcf3913fb4c604fa04da7e0 (diff) | |
download | skiboot-0b18bd2ae2db1e6fd15e859b00b23bb39886f528.zip skiboot-0b18bd2ae2db1e6fd15e859b00b23bb39886f528.tar.gz skiboot-0b18bd2ae2db1e6fd15e859b00b23bb39886f528.tar.bz2 |
Implement skiboot versioning
We grab a version from git tags (or SKIBOOT_VERSION environment variable),
optionally tack on EXTRA_VERSION (if from git) as well as add things to the
git version number if we're ahead of the most recent tag or the tree is dirty.
Also fix-up makefiles so that we don't have to rebuild version.c every time
you run make.
fsp attn area needed updating as we can have >40 character version strings.
We also export the version string via device tree rather than just the gitid.
For buildroot builds, setting SKIBOOT_VERSION environment variable to the
tag you grab will do the correct thing.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'Makefile.main')
-rw-r--r-- | Makefile.main | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Makefile.main b/Makefile.main index 4df3cfd..b584eb8 100644 --- a/Makefile.main +++ b/Makefile.main @@ -108,13 +108,15 @@ OBJS := $(ASM) $(CORE) $(HW) $(PLATFORMS) $(LIBFDT) $(LIBFLASH) ifeq ($(PORE),1) OBJS += $(LIBPORE) endif -OBJS += $(LIBC) $(CCAN) $(DEVSRC_OBJ) gitid.o +OBJS += $(LIBC) $(CCAN) $(DEVSRC_OBJ) +OBJS_NO_VER = $(OBJS) +ALL_OBJS = $(OBJS) version.o $(TARGET).lid: $(TARGET).elf $(call Q,OBJCOPY, $(OBJCOPY) -O binary -S $^ $@, $@) -$(TARGET).elf: $(OBJS) $(TARGET).lds $(KERNEL) - $(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(OBJS) -o $@, $@) +$(TARGET).elf: $(ALL_OBJS) $(TARGET).lds $(KERNEL) + $(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS) -o $@, $@) $(TARGET).map: $(TARGET).elf $(call Q,NM, $(NM) -n $< | grep -v '\( [aNUw] \)\|\(__crc_\)\|\( \$[adt]\)' > $@, $@) @@ -128,10 +130,16 @@ $(SUBDIRS): # Set V=1 if you want to see everything. include $(SRC)/Makefile.rules -GIT_SHA ?= $(shell cd $(SRC); GIT_DIR=$(SRC)/.git git describe --always --dirty 2> /dev/null) +VERSION ?= $(shell cd $(SRC); GIT_DIR=$(SRC)/.git $(SRC)/make_version.sh) -gitid.c: - @echo "const char gitid[] = \"$(GIT_SHA)\";" > $@ +.PHONY: VERSION-always +.version: VERSION-always + @echo $(VERSION) > $@.tmp + @cmp -s $@ $@.tmp || cp $@.tmp $@ + @rm -f $@.tmp + +version.c: make_version.sh $(OBJS_NO_VER) .version + @echo "const char version[] = \"$(VERSION)\";" > $@ .PHONY: coverage include $(shell find $(SRC)/* -name Makefile.check) @@ -149,7 +157,7 @@ tags: TAGS: find . -name '*.[chS]' | xargs etags -.PHONY: tags TAGS check gitid.c +.PHONY: tags TAGS check cscope: find . -name '*.[chS]' | xargs cscope @@ -157,7 +165,7 @@ cscope: clean: $(RM) *.[odsa] $(SUBDIRS:%=%/*.[odsa]) $(RM) $(TARGET).elf $(TARGET).lid $(TARGET).map $(TARGET).lds - $(RM) include/asm-offsets.h gitid.c + $(RM) include/asm-offsets.h version.c distclean: clean $(RM) *~ $(SUBDIRS:%=%/*~) include/*~ |