All pastes #68251 Raw Edit

Someone

public text v1 · immutable
#68251 ·published 2006-06-21 08:47 UTC
rendered paste body
ifdef V
  ifeq ("$(origin V)", "command line")
    KBUILD_VERBOSE = $(V)
  endif
endif

ifndef KBUILD_VERBOSE
  KBUILD_VERBOSE = 0
endif


ifeq ($(MAKELEVEL),0)
TRACE:=3>&1 4>&2
endif

ifeq ($(MAKELEVEL),$(KBUILD_VERBOSE))
TRACE+=3>/dev/null
endif

TRACE+=&>/dev/null

define make 
@{  \
  echo "make $(1)" >&3; \
  TRACE_PATH="make[$(MAKELEVEL)]: $(1)\\n$(TRACE_PATH)"; \
  ERROR="$$($(MAKE) TRACE_PATH="$$TRACE_PATH" --no-print-dir $(1) 2>&1)" || \
        echo -e "== BUILD FAILED ==\\n$$ERROR\\n$$TRACE_PATH" >&4; \
} $(TRACE)
endef


#simple test
ifeq ($(MAKELEVEL),9)
all:
        echo "test"
        sfsdfdsfgsdgsfgdfgd
else
all:
        $(call make,all)
endif