diff options
author | Ron Yorston <rmy@pobox.com> | 2024-02-16 11:50:39 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-02-16 11:50:39 +0000 |
commit | a4bb355732f2902b936368b644fa08518ecce55a (patch) | |
tree | f53295432c8ca1b81126f49cf1c7952512f5b38b | |
parent | 2401501759c4ff5dcc7c022a9c2194b504bdf0d6 (diff) | |
download | busybox-w32-a4bb355732f2902b936368b644fa08518ecce55a.tar.gz busybox-w32-a4bb355732f2902b936368b644fa08518ecce55a.tar.bz2 busybox-w32-a4bb355732f2902b936368b644fa08518ecce55a.zip |
build system: improvements to EXTRAVERSION detection
The previous commit to detect EXTRAVERSION more accurately was
lacking in some respects:
- Only attempt to detect EXTRAVERSION if it's currently set to the
default value '.git'.
- Use immediate-expansion macro assignments to avoid time-consuming
repeated evaluations.
- Remove a useless use of cat.
- Correctly allow for the output being sent to a separate directory.
-rw-r--r-- | Makefile | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -376,24 +376,25 @@ CONFIG_PLATFORM_MINGW32 := $(subst ",,$(CONFIG_PLATFORM_MINGW32)) | |||
376 | #") | 376 | #") |
377 | endif | 377 | endif |
378 | 378 | ||
379 | # Try various methods to get a more specific EXTRAVERSION | 379 | # Try various methods to get a more specific EXTRAVERSION, but only |
380 | ifeq ($(CONFIG_PLATFORM_MINGW32),y) | 380 | # for MINGW32 platform and if EXTRAVERSION is default '.git' |
381 | ifeq ($(CONFIG_PLATFORM_MINGW32)$(EXTRAVERSION),y.git) | ||
381 | # Ask git | 382 | # Ask git |
382 | extraversion = $(shell git describe --match FRP 2>/dev/null) | 383 | extraversion := $(shell cd $(srctree) && git describe --match FRP 2>/dev/null) |
383 | ifeq ($(strip $(extraversion)),) | 384 | ifeq ($(strip $(extraversion)),) |
384 | # That didn't work, look for a .frp_describe file | 385 | # That didn't work, look for a .frp_describe file |
385 | extraversion = $(shell cat .frp_describe 2>/dev/null | grep '^FRP-') | 386 | extraversion := $(shell grep '^FRP-' $(srctree)/.frp_describe 2>/dev/null) |
386 | ifeq ($(strip $(extraversion)),) | 387 | ifeq ($(strip $(extraversion)),) |
387 | # That didn't work either, look at current directory name | 388 | # That didn't work either, look at name of source directory |
388 | e1 = $(shell basename `pwd` | grep '^busybox-w32-FRP-') | 389 | e1 := $(shell basename $(srctree) | grep '^busybox-w32-FRP-') |
389 | ifneq ($(strip $(e1)),) | 390 | ifneq ($(strip $(e1)),) |
390 | extraversion = $(subst busybox-w32-,,$(e1)) | 391 | extraversion := $(subst busybox-w32-,,$(e1)) |
391 | endif | 392 | endif |
392 | endif | 393 | endif |
393 | endif | 394 | endif |
394 | 395 | ||
395 | ifneq ($(strip $(extraversion)),) | 396 | ifneq ($(strip $(extraversion)),) |
396 | EXTRAVERSION = .$(subst FRP,git,$(extraversion)) | 397 | EXTRAVERSION := .$(subst FRP,git,$(extraversion)) |
397 | endif | 398 | endif |
398 | endif | 399 | endif |
399 | 400 | ||