Bladeren bron

Fix a few error messages and other strangeness on `make update` in a clean tree

Matthias Schiffer 10 jaren geleden
bovenliggende
commit
67d7c989dc
3 gewijzigde bestanden met toevoegingen van 64 en 3 verwijderingen
  1. 1 1
      include/gluon.mk
  2. 2 2
      include/toplevel.mk
  3. 61 0
      include/verbose.mk

+ 1 - 1
include/gluon.mk

@@ -26,7 +26,7 @@ $(GLUON_SITEDIR)/site.mk:
 GLUON_VERSION := $(shell cd $(GLUONDIR) && git describe --always 2>/dev/null || echo unknown)
 export GLUON_VERSION
 
-GLUON_CONFIG_VERSION := $(shell cd $(GLUON_SITEDIR) && git describe --always --dirty=.$$(stat -c %Y $(GLUON_SITEDIR)/site.conf) 2>/dev/null || stat -c %Y site.conf)
+GLUON_CONFIG_VERSION := $(shell test -d $(GLUON_SITEDIR) && (cd $(GLUON_SITEDIR) && git describe --always --dirty=.$$(stat -c %Y $(GLUON_SITEDIR)/site.conf) 2>/dev/null || stat -c %Y site.conf))
 export GLUON_CONFIG_VERSION
 
 GLUON_SITE_CODE := $(shell $(GLUONDIR)/scripts/site.sh site_code)

+ 2 - 2
include/toplevel.mk

@@ -10,9 +10,9 @@
 RELEASE:=Attitude Adjustment
 PREP_MK= OPENWRT_BUILD= QUIET=0
 
--include $(TOPDIR)/include/verbose.mk
+include $(GLUONDIR)/include/verbose.mk
 
-REVISION:=$(shell cd $(TOPDIR) && ./scripts/getver.sh 2>/dev/null)
+REVISION:=$(shell [ -d $(TOPDIR) ] && cd $(TOPDIR) && ./scripts/getver.sh 2>/dev/null)
 
 HOSTCC ?= gcc
 OPENWRTVERSION:=$(RELEASE)$(if $(REVISION), ($(REVISION)))

+ 61 - 0
include/verbose.mk

@@ -0,0 +1,61 @@
+# 
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+ifndef OPENWRT_VERBOSE
+  OPENWRT_VERBOSE:=
+endif
+ifeq ("$(origin V)", "command line")
+  OPENWRT_VERBOSE:=$(V)
+endif
+
+ifeq ($(OPENWRT_VERBOSE),1)
+  OPENWRT_VERBOSE:=w
+endif
+ifeq ($(OPENWRT_VERBOSE),99)
+  OPENWRT_VERBOSE:=s
+endif
+
+ifeq ($(NO_TRACE_MAKE),)
+NO_TRACE_MAKE := $(MAKE) V=s$(OPENWRT_VERBOSE)
+export NO_TRACE_MAKE
+endif
+
+ifeq ($(IS_TTY),1)
+  ifneq ($(strip $(NO_COLOR)),1)
+    _Y:=\\033[33m
+    _N:=\\033[m
+  endif
+endif
+
+ifeq ($(findstring s,$(OPENWRT_VERBOSE)),)
+  define MESSAGE
+	printf "$(_Y)%s$(_N)\n" "$(1)" >&8
+  endef
+
+  ifeq ($(QUIET),1)
+    ifneq ($(CURDIR),$(TOPDIR))
+      _DIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR})
+    else
+      _DIR:=
+    endif
+    _NULL:=$(if $(MAKECMDGOALS),$(shell \
+		$(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \
+    ))
+    SUBMAKE=$(MAKE)
+  else
+    SILENT:=>/dev/null $(if $(findstring w,$(OPENWRT_VERBOSE)),,2>&1)
+    export QUIET:=1
+    SUBMAKE=cmd() { $(SILENT) $(MAKE) -s $$* < /dev/null || { echo "make $$*: build failed. Please re-run make with V=s to see what's going on"; false; } } 8>&1 9>&2; cmd
+  endif
+
+  .SILENT: $(MAKECMDGOALS)
+else
+  SUBMAKE=$(MAKE) -w
+  define MESSAGE
+    printf "%s\n" "$(1)"
+  endef
+endif