tools/Makefile.unix: Rethink creation of new .version file with GIT information. Cannot use 'sed -i' in its current form because that does not work on macOS, FreeBSD, or NetBSD.
This commit is contained in:
parent
c5066f9f4c
commit
d07666c85b
@ -36,9 +36,17 @@
|
||||
|
||||
TOPDIR := ${shell pwd | sed -e 's/ /\\ /g'}
|
||||
-include $(TOPDIR)/.config
|
||||
-include $(TOPDIR)/.version
|
||||
include $(TOPDIR)/tools/Config.mk
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
# In case .version file does not exist
|
||||
|
||||
CONFIG_VERSION_STRING ?= "0.0"
|
||||
CONFIG_VERSION_MAJOR ?= 0
|
||||
CONFIG_VERSION_MINOR ?= 0
|
||||
CONFIG_VERSION_BUILD ?= "0"
|
||||
|
||||
# Control build verbosity
|
||||
#
|
||||
# V=1,2: Enable echo of commands
|
||||
@ -197,6 +205,9 @@ BIN = $(NUTTXNAME)$(EXEEXT)
|
||||
|
||||
all: $(BIN)
|
||||
.PHONY: dirlinks context clean_context check_context config oldconfig menuconfig nconfig qconfig gconfig export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean version_info
|
||||
ifeq ($(GIT_DIR),y)
|
||||
.PHONY: $(TOPDIR)/.version
|
||||
endif
|
||||
|
||||
# Target used to copy include/nuttx/lib/math.h. If CONFIG_ARCH_MATH_H is
|
||||
# defined, then there is an architecture specific math.h header file
|
||||
@ -273,24 +284,18 @@ endif
|
||||
tools/mkversion$(HOSTEXEEXT):
|
||||
$(Q) $(MAKE) -C tools -f Makefile.host TOPDIR="$(TOPDIR)" mkversion$(HOSTEXEEXT)
|
||||
|
||||
# create .version if it doesn't already exist. Note: it may have been
|
||||
# created manually and may contain other info
|
||||
# [Re-]create .version if it doesn't already exist.
|
||||
|
||||
$(TOPDIR)/.version:
|
||||
$(Q) echo "No .version file found, creating one"
|
||||
$(Q) tools/version.sh -v 0.0 -b 0 .version
|
||||
$(Q) echo "Create .version"
|
||||
$(Q) tools/version.sh -v $(CONFIG_VERSION_MAJOR).$(CONFIG_VERSION_MINOR) -b $(CONFIG_VERSION_BUILD) .version
|
||||
ifeq ($(GIT_DIR),y)
|
||||
$(Q) tools/gen_gitrev.sh -t $(TOPDIR) >> .version
|
||||
endif
|
||||
$(Q) chmod 755 .version
|
||||
|
||||
# version_info will add git-specific info to the .version file
|
||||
# which must already exist. First strip out any existing CONFIG_GIT_ info
|
||||
|
||||
version_info: $(TOPDIR)/.version
|
||||
ifeq ($(GIT_DIR),y)
|
||||
$(Q) sed -i '/CONFIG_GIT_/d' $<
|
||||
$(Q) tools/gen_gitrev.sh -t $(TOPDIR) >> $<
|
||||
endif
|
||||
|
||||
include/nuttx/version.h: version_info tools/mkversion$(HOSTEXEEXT)
|
||||
include/nuttx/version.h: $(TOPDIR)/.version tools/mkversion$(HOSTEXEEXT)
|
||||
$(Q) echo "Create version.h"
|
||||
$(Q) tools/mkversion $(TOPDIR) > $@
|
||||
|
||||
# Targets used to build include/nuttx/config.h. Creation of config.h is
|
||||
|
Loading…
Reference in New Issue
Block a user