<commit_before># common-defs.mk #

#
#//===----------------------------------------------------------------------===//
#//
#//                     The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#

# --------------------------------------------------------------------------------------------------
# This file contains really common definitions used by multiple makefiles. Modify it carefully!
# --------------------------------------------------------------------------------------------------

# --------------------------------------------------------------------------------------------------
# Some tricky variables.
# --------------------------------------------------------------------------------------------------
empty :=
space := $(empty) $(empty)
comma := ,
ifeq "$(date)" ""
    $(error Caller should specify "date" variable.)
endif

# --------------------------------------------------------------------------------------------------
# Helper finctions.
# --------------------------------------------------------------------------------------------------

# Synopsis:
#     $(call say,text-to-print-to-the-screen)
# Description:
#     The function prints its argument to the screen. In case of older makes it is analog of
#     $(warning), starting from make 3.81 is is analog of $(info).
#
say = $(warning $(1))
ifneq "$(filter 3.81,$(MAKE_VERSION))" ""
    say = $(info $(1))
endif

# Synopsis:
#     architecture = $(call legal_arch,32)
# Description:
#     The function return printable name of specified architecture, IA-32 architecture or Intel(R) 64.
#
legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(if $(filter ppc64,$(1)),PPC64,$(if $(filter aarch64,$(1)),AArch64,$(error Bad architecture specified: $(1)))))))

# Synopsis:
#     var_name = $(call check_variable,var,list)
# Description:
#     The function verifies the value of var varibale. If it is empty, the first word from the list
#     is assigned to var as default value. Otherwise the var value must match one of words in the
#     list, or error is issued.
# Example:
#     LINK_TYPE = $(call check_variable,LINK_TYPE,static dynamic)
#
check_variable = $(call _check_variable_words,$(1))$(call _check_variable_value,$(1),$(2))

# Synopsis:
#     $(call _check_variable_words,var)
# Description:
#     Checks that variable var is empty or single word. In case of multiple words an error is
#     issued. It is helper function for check_variable.
#
_check_variable_words = $(if $(filter 0 1,$(words $($(1)))),,\
    $(error Illegal value of $(1): "$($(1))"))

# Synopsis:
#     $(call _check_variable_value,var)
# Description:<commit_msg>fixed the missed bracket introduced by checkin rev 225792<commit_after># common-defs.mk #

#
#//===----------------------------------------------------------------------===//
#//
#//                     The LLVM Compiler Infrastructure
#//
#// This file is dual licensed under the MIT and the University of Illinois Open
#// Source Licenses. See LICENSE.txt for details.
#//
#//===----------------------------------------------------------------------===//
#

# --------------------------------------------------------------------------------------------------
# This file contains really common definitions used by multiple makefiles. Modify it carefully!
# --------------------------------------------------------------------------------------------------

# --------------------------------------------------------------------------------------------------
# Some tricky variables.
# --------------------------------------------------------------------------------------------------
empty :=
space := $(empty) $(empty)
comma := ,
ifeq "$(date)" ""
    $(error Caller should specify "date" variable.)
endif

# --------------------------------------------------------------------------------------------------
# Helper finctions.
# --------------------------------------------------------------------------------------------------

# Synopsis:
#     $(call say,text-to-print-to-the-screen)
# Description:
#     The function prints its argument to the screen. In case of older makes it is analog of
#     $(warning), starting from make 3.81 is is analog of $(info).
#
say = $(warning $(1))
ifneq "$(filter 3.81,$(MAKE_VERSION))" ""
    say = $(info $(1))
endif

# Synopsis:
#     architecture = $(call legal_arch,32)
# Description:
#     The function return printable name of specified architecture, IA-32 architecture or Intel(R) 64.
#
legal_arch = $(if $(filter 32,$(1)),IA-32,$(if $(filter 32e,$(1)),Intel(R) 64,$(if $(filter l1,$(1)),L1OM,$(if $(filter arm,$(1)),ARM,$(if $(filter ppc64,$(1)),PPC64,$(if $(filter aarch64,$(1)),AArch64,$(error Bad architecture specified: $(1))))))))

# Synopsis:
#     var_name = $(call check_variable,var,list)
# Description:
#     The function verifies the value of var varibale. If it is empty, the first word from the list
#     is assigned to var as default value. Otherwise the var value must match one of words in the
#     list, or error is issued.
# Example:
#     LINK_TYPE = $(call check_variable,LINK_TYPE,static dynamic)
#
check_variable = $(call _check_variable_words,$(1))$(call _check_variable_value,$(1),$(2))

# Synopsis:
#     $(call _check_variable_words,var)
# Description:
#     Checks that variable var is empty or single word. In case of multiple words an error is
#     issued. It is helper function for check_variable.
#
_check_variable_words = $(if $(filter 0 1,$(words $($(1)))),,\
    $(error Illegal value of $(1): "$($(1))"))

# Synopsis:
#     $(call _check_variable_value,var)
# Description:
{'fraction_non_alphanumeric': 0.3670239918325676, 'fraction_numerical': 0.017015484090522375, 'mean_word_length': 1.4896230410842863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1342720', 'n_tokens_mistral': 1477, 'n_tokens_neox': 1414, 'n_words': 477}