Changeset 776 for trunk/kBuild


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

Location:
trunk/kBuild
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/footer.kmk

    r770 r776  
    624624.PRECIOUS: $(out)
    625625$(out) $($(target)_$(srcname)_FETCH_OUTPUT_): | $($(target)_$(srcname)_FETCH_DEPORD_)
    626         $$(call MSG_L1,Downloading $(source)...)
     626        $$(call MSG_FETCH_DL,$(target),$(source),$(out))
    627627        @## @todo do fancy stuff like download continuation.
    628628        $$(QUIET)$$(RM) -f $(out) $(out).md5
     
    635635# Intermediate goal for making sure the md5 and size matches. it will (re) fetch the archive if necessary.
    636636$(out).checked_$(md5)_$(size): $($(target)_$(srcname)_FETCH_DEPEND_) | $($(target)_$(srcname)_FETCH_DEPORD_)
    637         $$(call MSG_L1,Checking $(out),($(source))...)
     637        $$(call MSG_FETCH_CHK,$(target),$(source),$(out))
    638638        $$(QUIET)$$(RM) -f $$@ $(out).md5
    639639        @# creates the .md5 we pass to md5sum.
     
    658658$(out) $($(target)_$(srcname)_UNPACK_OUTPUT_): $($(target)_$(srcname)_UNPACK_DEPEND_) \
    659659                | $($(target)_$(srcname)_UNPACK_DEPORD_) $(archive).checked_$(md5)_$(size)
    660         $$(call MSG_L1,Unpacking $(archive),into $(inst)...)
     660        $$(call MSG_FETCH_UP,$(target),$(archive),$(inst))
    661661        $$(QUIET)$$(RM) -f $(out)
    662662        @# if the source archive doesn't exist fetch it (can have been deleted to save space).
     
    854854
    855855$(out).lst: $(_TARGET_$(target)_UNPACKED) | $(call DIRDEP,$(inst))
    856         $$(call MSG_L1,Successfully fetched $(target))
     856        $$(call MSG_FETCH_OK,$(target))
    857857        $$(QUIET)$$(RM) -f $$@ $$@.tmp
    858858        $$(QUIET2)$$(APPEND) $$@.tmp "$(notdir $(out))"
     
    861861
    862862$(out)_unfetched:
    863         $$(call MSG_L1,Unfetching $(target)...)
     863        $$(call MSG_UNFETCH,$(target))
    864864        $$(QUIET)$$(RM) -f $$(addprefix $(inst),$$(shell $$(CAT_EXT) $(out).lst 2> /dev/null | $$(SED) -e '/\/$$$$/d'))
    865865        $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@) \
     
    870870$(out): $(comp-vars _TARGET_$(target)_DIGEST_PREV,_TARGET_$(target)_DIGEST,FORCE) | $(call DIRDEP,$(inst))
    871871        $$(QUIET)$$(RM) -f $$@
    872         $$(call MSG_L1,$$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(wildcard $(out).lst),Re-fetching,Fetching),Removing) $(target)...)
     872        $$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(wildcard $(out).lst)\
     873                ,$$(call MSG_REFETCH,$(target)),$$(call MSG_FETCH,$(target))),$$(call MSG_UNFETCH,$(target)))
    873874        $$(QUIET)$$(if $$(wildcard $(out).lst      ),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out)_unfetched)
    874875        $$(QUIET)$$(if  $$(_TARGET_$(target)_DIGEST),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out).lst,$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@))
     
    978979                | \
    979980                $($(target)_$(source)_DEPORD_)
    980         $$(call MSG_L1,Compiling $(target) - $(source),=> $$@)
     981        $$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
    981982        $$(QUIET)$$(RM) -f $(dep) $(obj) $($(target)_$(source)_OUTPUT_)
    982983        $(custom_pre)
     
    10241025                | \
    10251026                $($(target)_DEPORD_)
    1026         $$(call MSG_L1,Linking $$@)
     1027        $$(call MSG_LINK,$(target),$$@,$(tool_do))
    10271028        $$(QUIET)$$(RM) -f $(dep) $(out) $($(target)_OUTPUT_)
    10281029        $(custom_pre)
     
    10531054define def_link_install_rule
    10541055$(INSTARGET_$(target)) : $(out) | $(call DIRDEP,$(dir $(INSTARGET_$(target))))
    1055         $$(call MSG_L1,Installing $(target) => $$@)
     1056        $$(call MSG_INST_TRG,$(target),$(out),$$@)
    10561057        $$(QUIET)$$(INSTALL) $$(if $(mode),-m $(mode)) $(out) $$@
    10571058
     
    12631264
    12641265# Process libraries
     1266tool_do := LINK_LIBRARY
    12651267mode := 0644
    12661268$(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_lib)))
     
    16301632# the install rule
    16311633$(insdst) : $(srcsrc) | $(call DIRDEP,$(dir $(insdst)))
    1632         $$(call MSG_L1,Installing $(insdst),(<= $(srcsrc)))
     1634        $$(call MSG_INST_FILE,$(srcsrc),$(insdst))
    16331635        $$(QUIET)$$(if $$(filter $(INSTALL),$(inscmd)),,$$(RM) -f $$@)
    16341636        $$(QUIET)$(inscmd)
     
    17521754# the install rule
    17531755$(insdst) : | $(call DIRDEP,$(dir $(insdst)))
    1754         $$(call MSG_L1,Installing symlink $(insdst),pointing to $(symdst))
     1756        $$(call MSG_INST_SYM,$(insdst),$(symdst))
    17551757        $$(QUIET)$$(RM) -f $$@
    17561758        $$(QUIET)$$(LN_SYMLINK) $(symdst) $(insdst)
     
    18021804# the install rule
    18031805$(insdst):
    1804         $$(call MSG_L1,Installing directory $(insdst))
     1806        $$(call MSG_INST_DIR,$(insdst))
    18051807        $$(QUIET)$$(INSTALL) -d \
    18061808                $(if $(uid),-o $(uid))\
     
    19171919define def_mkdir_rule
    19181920$(directory):
    1919         $$(call MSG_L2,Creating directory $$@)
     1921        $$(call MSG_MKDIR,$$@)
    19201922        $$(QUIET)$$(MKDIR) -p $$@
    19211923endef
     
    19281930#
    19291931do-nothing:
    1930         $(call MSG_L1,Did nothing in $(CURDIR))
     1932        $(call MSG_NOTHING)
    19311933
    19321934
     
    19351937#
    19361938do-clean:
    1937         $(call MSG_L1,Cleaning...)
     1939        $(call MSG_CLEAN)
    19381940        $(QUIET)$(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DEPFILES_INCLUDED) $(_CLEAN_FILES) $(OTHER_CLEAN)
    19391941
     
    20432045.PHONY: pass_$(pass)_order
    20442046pass_$(pass)_order: $(pass_prev)
    2045         $$(call MSG_L1,Pass - $$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
     2047        $$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
    20462048        + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)
    20472049else
     
    20492051.PHONY:       pass_$(pass)_order pass_$(pass)_banner
    20502052pass_$(pass)_banner:
    2051         $$(call MSG_L1,Pass - $$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
     2053        $$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
    20522054pass_$(pass)_order: \
    20532055                $(pass_prev) \
  • 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.