Ignore:
Timestamp:
Jan 20, 2007, 7:36:40 PM (19 years ago)
Author:
bird
Message:

Macros for all messages. KBUILD_MSG_STYLE. KBUILD_VERBOSE={1,2,*}. PRINTF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/header.kmk

    r762 r776  
    411411endif
    412412
     413PRINTF_EXT  := $(PATH_KBUILD_BIN)/kmk_printf$(HOSTSUFF_EXE)
     414ifeq ($(filter printf,$(KMK_BUILTIN)),printf)
     415PRINTF      := kmk_builtin_printf
     416else
     417PRINTF      := $(PRINTF_EXT)
     418endif
     419
    413420RM_EXT      := $(PATH_KBUILD_BIN)/kmk_rm$(HOSTSUFF_EXE)
    414421ifeq ($(filter rm,$(KMK_BUILTIN)),rm)
     
    712719endif
    713720
     721#
     722# Check for --pretty-command-printing before including the Config.kmk
     723# so that anyone overriding the message macros can take the implied
     724# verbosity level change into account.
     725#
     726ifndef KBUILD_VERBOSE
     727 ifndef KBUILD_QUIET
     728  ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
     729   export KBUILD_VERBOSE := 1
     730  endif
     731 endif
     732endif
     733
     734
    714735# Include the config.kmk we found file (or the default one).
    715736include $(_CFGFILE)
     
    717738
    718739#
     740# Currently two message styles are supported: default and dense.
     741#
     742KBUILD_MSG_STYLE ?= default
     743ifeq ($(KBUILD_MSG_STYLE),default)
     744 #
     745 # The 'default' style.
     746 #
     747
     748 ## Fetch starting.
     749 # @param 1     Target name.
     750 MSG_FETCH    ?= $(call MSG_L1,Fetching $1...)
     751 ## Re-fetch starting.
     752 # @param 1     Target name.
     753 MSG_REFETCH  ?= $(call MSG_L1,Re-fetching $1...)
     754 ## Downloading a fetch component.
     755 # @param 1     Target name.
     756 # @param 2     The source URL.
     757 # @param 3     The destination file name.
     758 MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3)
     759 ## Checking a fetch component.
     760 # @param 1     Target name.
     761 # @param 2     The source URL.
     762 # @param 3     The destination file name.
     763 MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2))
     764 ## Unpacking a fetch component.
     765 # @param 1     Target name.
     766 # @param 2     The archive file name.
     767 # @param 3     The target directory.
     768 MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3)
     769 ## Fetch completed.
     770 # @param 1     Target name.
     771 MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1)
     772 ## Unfetch a fetch target.
     773 # @param 1     Target name.
     774 MSG_UNFETCH  ?= $(call MSG_L1,Unfetching $1...)
     775 ## Compiling a source file.
     776 # @param 1     Target name.
     777 # @param 2     The source filename.
     778 # @param 3     The primary link output file name.
     779 # @param 4     The source type (CXX,C,AS,RC,++).
     780 MSG_COMPILE  ?= $(call MSG_L1,Compiling $1 - $2,=> $3)
     781 ## Linking a bldprog/dll/program/sysmod target.
     782 # @param 1     Target name.
     783 # @param 2     The primary link output file name.
     784 # @param 3     The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
     785 MSG_LINK     ?= $(call MSG_L1,Linking $1,=> $2)
     786 ## Creating a directory (build).
     787 # @param 1     Directory name.
     788 MSG_MKDIR    ?= $(call MSG_L2,Creating directory $1)
     789 ## Cleaning.
     790 MSG_CLEAN    ?= $(call MSG_L1,Cleaning...)
     791 ## Nothing.
     792 MSG_NOTHING  ?= $(call MSG_L1,Did nothing in $(CURDIR))
     793 ## Pass
     794 # @param 1     The pass name.
     795 MSG_PASS     ?= $(call MSG_L1,Pass - $1)
     796 ## Installing a bldprog/lib/dll/program/sysmod target.
     797 # @param 1     Target name.
     798 # @param 2     The source filename.
     799 # @param 3     The destination file name.
     800 MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3)
     801 ## Installing a file (install target).
     802 # @param 1     The source filename.
     803 # @param 2     The destination filename.
     804 MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1))
     805 ## Installing a symlink.
     806 # @param 1     Symlink
     807 # @param 2     Link target
     808 MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2)
     809 ## Installing a directory.
     810 # @param 1     Directory name.
     811 MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1)
     812
     813else ifeq ($(KBUILD_MSG_STYLE),dense)
     814 #
     815 # The 'dense' style
     816 #
     817 ifndef KBUILD_VERBOSE
     818  MSG_L1 ?= @$(ECHO) "  $(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1))))"
     819 else
     820  MSG_L1 ?= @$(ECHO) "  $(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1 $2))))"
     821  MSG_L2 ?= @$(ECHO) "  $(subst $(PATH_ROOT)/,{R}/,$(subst $(PATH_OUT)/,{O}/,$(subst $(CURDIR)/,{C}/,$(subst $(PATH_TARGET)/,{T}/,$1))))"
     822 endif
     823 MAKEFLAGS := --no-print-directory $(MAKEFLAGS)
     824
     825 ## Fetch starting.
     826 # @param 1     Target name.
     827 MSG_FETCH    ?= $(call MSG_L1,FTCH $1...)
     828 ## Re-fetch starting.
     829 # @param 1     Target name.
     830 MSG_REFETCH  ?= $(call MSG_L1,RFTCH $1...)
     831 ## Downloading a fetch component.
     832 # @param 1     Target name.
     833 # @param 2     The source URL.
     834 # @param 3     The destination file name.
     835 MSG_FETCH_DL ?= $(call MSG_L1,GET  $1 - $2,=> $3)
     836 ## Checking a fetch component.
     837 # @param 1     Target name.
     838 # @param 2     The source URL.
     839 # @param 3     The destination file name.
     840 MSG_FETCH_CHK?= $(call MSG_L1,CHK  $1 - $3, ($2))
     841 ## Unpacking a fetch component.
     842 # @param 1     Target name.
     843 # @param 2     The archive file name.
     844 # @param 3     The target directory.
     845 MSG_FETCH_UP ?= $(call MSG_L1,UNPK $1 - $2,=> $3)
     846 ## Fetch completed.
     847 # @param 1     Target name.
     848 MSG_FETCH_OK ?= $(call MSG_L1,DONE $1)
     849 ## Unfetch a fetch target.
     850 # @param 1     Target name.
     851 MSG_UNFETCH  ?= $(call MSG_L1,RM   $1...)
     852 ## Compiling a source file.
     853 # @param 1     Target name.
     854 # @param 2     The source filename.
     855 # @param 3     The primary link output file name.
     856 # @param 4     The source type (CXX,C,AS,RC,++).
     857 MSG_COMPILE  ?= $(call MSG_L1,CC   $1 - $2,=> $3)
     858 ## Linking a bldprog/dll/program/sysmod target.
     859 # @param 1     Target name.
     860 # @param 2     The primary link output file name.
     861 # @param 3     The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++).
     862 MSG_LINK     ?= $(call MSG_L1,$(if $(eq $3,LINK_LIBRARY),AR,LD)   $1,=> $2)
     863 ## Creating a directory (build).
     864 # @param 1     Directory name.
     865 MSG_MKDIR    ?= $(call MSG_L2,DIR  $1)
     866 ## Cleaning.
     867 MSG_CLEAN    ?= $(call MSG_L1,CLEAN)
     868 ## Nothing.
     869 MSG_NOTHING  ?= $(call MSG_L1,NOTHING $(CURDIR))
     870 ## Installing a bldprog/lib/dll/program/sysmod target.
     871 # @param 1     Target name.
     872 # @param 2     The source filename.
     873 # @param 3     The destination file name.
     874 MSG_INST_TRG ?= $(call MSG_L1,INST $1,=> $2)
     875 ## Installing a file (install target).
     876 # @param 1     The source filename.
     877 # @param 2     The destination filename.
     878 MSG_INST_FILE?= $(call MSG_L1,IFIL $2,(<= $1))
     879 ## Installing a symlink.
     880 # @param 1     Symlink
     881 # @param 2     Link target
     882 MSG_INST_SYM ?= $(call MSG_L1,ISYM $1,=> $2)
     883 ## Installing a directory.
     884 # @param 1     Directory name.
     885 MSG_INST_DIR ?= $(call MSG_L1,IDIR $1)
     886
     887else
     888 $(error kBuild: Unknown message style: KBUILD_MSG_STYLE=$(KBUILD_MSG_STYLE))
     889endif
     890
     891
     892#
    719893# Message macros.
    720894#
     
    723897#
    724898ifdef KBUILD_QUIET
    725  # minimal output.
     899 # No output
    726900 QUIET := @
    727901 QUIET2:= @
    728902 MSG_L1 =
    729903 MSG_L2 =
    730  MSG_L3 =
    731904else
    732905 ifndef KBUILD_VERBOSE
    733   ifneq ($(filter --pretty-command-printing,$(MAKEFLAGS)),)
    734    export KBUILD_VERBOSE := 1
    735   endif
    736  endif
    737  ifndef KBUILD_VERBOSE
    738   QUIET := @
    739   QUIET2:= @
    740   MSG_L1 = @$(ECHO) "kBuild: $1"
    741   MSG_L2 =
    742   MSG_L3 =
     906  # Default output level.
     907  QUIET  := @
     908  QUIET2 := @
     909  MSG_L1 ?= @$(ECHO) "kBuild: $1"
     910  MSG_L2  =
     911 else ifeq ($(KBUILD_VERBOSE),1)
     912  # A bit more output
     913  QUIET  := @
     914  QUIET2 := @
     915  MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
     916  MSG_L2  =
     917 else ifeq ($(KBUILD_VERBOSE),2)
     918  # Lot more output
     919  QUIET  :=
     920  QUIET2 := @
     921  MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
     922  MSG_L2 ?= @$(ECHO) "kBuild: $1"
    743923 else
    744924  # maximal output.
    745   QUIET :=
    746   MSG_L1 = @$(ECHO) "kBuild: $1 $2"
    747   MSG_L2 = @$(ECHO) "kBuild: $1"
    748   ifneq ($(KBUILD_VERBOSE),all)
    749    QUIET2:= @
    750   else
    751    QUIET2:=
    752   endif
    753  endif
    754 endif
     925  QUIET  :=
     926  QUIET2 :=
     927  MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
     928  MSG_L2 ?= @$(ECHO) "kBuild: $1"
     929 endif
     930endif
     931
     932
    755933
    756934# end-of-file-content
     
    758936endif # __header_kmk__
    759937
    760 
Note: See TracChangeset for help on using the changeset viewer.