<commit_before># common-tools.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.
#//
#//===----------------------------------------------------------------------===//
#

# --------------------------------------------------------------------------------------------------
# Dev tools and general options (like -fpic, -O2 or -g).
# --------------------------------------------------------------------------------------------------

# c       -- C compiler.
# cxx     -- C++ compiler.
# cpp     -- C preprocessor.
# fort    -- Fortran compiler.
# as      -- Assembler.
# ar      -- Librarian (static library maker).
# ld      -- Linker (dynamic library maker).
# *-out   -- Flag denoting output file. If space between flag and file name required, add explicit
#            space to variable, e. g.: "c-out = -o$(space)".
# *-flags -- Flags to appropriate program, e. g. c-flags -- flags for C compiler, etc.

# --- Common definitions ---

# Add current directory (it contains generated files).
# Note: It is important to specify current dir as "./" (not just "."). Otherwise Intel compiler
# on Windows* OS generates such a dependency: "kmp_runtime.obj: .\kmp_i18n.inc", and make complains
# "No rule to build .\kmp_i18n.inc". Using "./" solves the problem.
cpp-flags += -I ./
# For non-x86 architecture
ifeq "$(filter 32 32e 64 mic,$(arch))" ""
    cpp-flags += $(shell pkg-config --cflags libffi)
endif
# Add all VPATH directories to path for searching include files.
cpp-flags += $(foreach i,$(VPATH),-I $(i))


# Shouldn't this be being set from the command line somehow?
cpp-flags += -D USE_ITT_BUILD

ifeq "$(OPTIMIZATION)" "on"
    cpp-flags += -D NDEBUG
else
    cpp-flags += -D _DEBUG -D BUILD_DEBUG
    ifeq "$(os)" "win"
        # This is forced since VS2010 tool produces inconsistent directives
        # between objects, resulting in a link failure.
        cpp-flags += -D _ITERATOR_DEBUG_LEVEL=0
    endif
endif

# --- Linux* OS, Intel(R) Many Integrated Core Architecture and OS X* definitions ---

ifneq "$(filter lin mac,$(os))" ""
    # --- C/C++ ---
    ifeq "$(c)" ""
        c = icc
    endif
    # C++ compiler is a complement to C compiler.
    ifeq "$(c)" "icc"
        cxx = icpc
    endif
    ifeq "$(c)" "gcc"
        cxx = g++
    endif
    ifeq "$(c)" "clang"
        cxx = clang++
    endif
    # Output file flag.
    c-out   = -o$(space)
    cxx-out = -o$(space)
    # Compile only, no link.
    c-flags   += -c
    cxx-flags += -c
    # Generating dependecy file.
    c-flags-m   += -M -MG
    cxx-flags-m += -M -MG
    # Enable C99 language.
    ifneq "$(CPLUSPLUS)" "on"
        c-flags += -std=gnu99
    endif
    # Generate position-independent code (SDL requirements).
    c-flags   += -fPIC
    cxx-flags += -fPIC
    # Emit debugging information.
    ifeq "$(DEBUG_INFO)" "on"
        c-flags   += -g
        cxx-flags += -g
    endif
    # Instrument program for profiling, gather extra information.
    ifeq "$(COVERAGE)" "on"
        ifeq "$(c)" "icc"
            c-flags   += -prof_genx
        endif
        ifeq "$(cxx)" "icpc"
            cxx-flags += -prof_genx
        endif
    endif
    # Turn optimization on or off.
    ifeq "$(OPTIMIZATION)" "on"
        # -inline-min-size=1 improves performance of PARALLEL EPCC up to 10% on fxi64lin01,
        # doesn't change performance on fxe64lin01.
        # Presence of the -inline-min-size=1 switch should only help
        # to promote performance stability between changes,
        # even if it has no observable impact right now.
	ifneq "$(filter icl icl.exe,$(c))" ""
            c-flags   += -O2 -inline-min-size=1
	else
            c-flags   += -O2
	endif
        ifneq "$(filter icl icl.exe,$(cxx))" ""
            cxx-flags += -O2 -inline-min-size=1
	else
            cxx-flags += -O2
	endif
    else
        c-flags   += -O0
        cxx-flags += -O0
    endif
    # --- Assembler ---
    ifeq "$(c)" "icc"
        as        = icc
    endif
    ifeq "$(c)" "gcc"
        as        = gcc
    endif
    ifeq "$(c)" "clang"
        as        = clang
    endif
    as-out    = -o$(space)
    as-flags += $(cpp-flags)
    # Compile only, no link.
    as-flags += -c
    as-flags += -x assembler-with-cpp
    # --- Fortran ---
    ifeq "$(c)" "icc"
        fort = ifort
    endif
    ifeq "$(c)" "gcc"
        fort = gfortran
    endif
    ifeq "$(c)" "clang"
        fort = gfortran
    endif
    ifeq "$(fort)" ""
        fort = ifort
    endif
    fort-out    = -o$(space)
    fort-flags += -c
endif

# --- Linux* OS definitions ---

ifeq "$(os)" "lin"
ifneq "$(arch)" "mic"
    # --- C/C++ ---
    # On lin_32, we want to maintain stack alignment to be conpatible with GNU binaries built with
    # compiler.
    ifeq "$(c)" "icc"
        ifeq "$(arch)" "32"
            c-flags   += -falign-stack=maintain-16-byte
            cxx-flags += -falign-stack=maintain-16-byte
        endif
        # Generate code that will run on any Pentium or later processor.
        ifeq "$(arch)" "32"
            c-flags   += -mia32
            cxx-flags += -mia32
        endif
    endif
    ifeq "$(c)" "gcc"
        ifeq "$(arch)" "arm"
            c-flags   += -marm
        endif
    endif
    # --- Librarian ---
    ar        = ar
    ar-out    = $(empty)
    ar-flags += cr
    # --- Linker ---
    # Use ld by default, however, makefile may specify ld=$(c) before including devtools.mk.
    ifeq "$(ld)" ""
        ld = $(c)
    endif
    ld-flags-dll += -shared<commit_msg>Misprint in comment fixed<commit_after># common-tools.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.
#//
#//===----------------------------------------------------------------------===//
#

# --------------------------------------------------------------------------------------------------
# Dev tools and general options (like -fpic, -O2 or -g).
# --------------------------------------------------------------------------------------------------

# c       -- C compiler.
# cxx     -- C++ compiler.
# cpp     -- C preprocessor.
# fort    -- Fortran compiler.
# as      -- Assembler.
# ar      -- Librarian (static library maker).
# ld      -- Linker (dynamic library maker).
# *-out   -- Flag denoting output file. If space between flag and file name required, add explicit
#            space to variable, e. g.: "c-out = -o$(space)".
# *-flags -- Flags to appropriate program, e. g. c-flags -- flags for C compiler, etc.

# --- Common definitions ---

# Add current directory (it contains generated files).
# Note: It is important to specify current dir as "./" (not just "."). Otherwise Intel compiler
# on Windows* OS generates such a dependency: "kmp_runtime.obj: .\kmp_i18n.inc", and make complains
# "No rule to build .\kmp_i18n.inc". Using "./" solves the problem.
cpp-flags += -I ./
# For non-x86 architecture
ifeq "$(filter 32 32e 64 mic,$(arch))" ""
    cpp-flags += $(shell pkg-config --cflags libffi)
endif
# Add all VPATH directories to path for searching include files.
cpp-flags += $(foreach i,$(VPATH),-I $(i))


# Shouldn't this be being set from the command line somehow?
cpp-flags += -D USE_ITT_BUILD

ifeq "$(OPTIMIZATION)" "on"
    cpp-flags += -D NDEBUG
else
    cpp-flags += -D _DEBUG -D BUILD_DEBUG
    ifeq "$(os)" "win"
        # This is forced since VS2010 tool produces inconsistent directives
        # between objects, resulting in a link failure.
        cpp-flags += -D _ITERATOR_DEBUG_LEVEL=0
    endif
endif

# --- Linux* OS, Intel(R) Many Integrated Core Architecture and OS X* definitions ---

ifneq "$(filter lin mac,$(os))" ""
    # --- C/C++ ---
    ifeq "$(c)" ""
        c = icc
    endif
    # C++ compiler is a complement to C compiler.
    ifeq "$(c)" "icc"
        cxx = icpc
    endif
    ifeq "$(c)" "gcc"
        cxx = g++
    endif
    ifeq "$(c)" "clang"
        cxx = clang++
    endif
    # Output file flag.
    c-out   = -o$(space)
    cxx-out = -o$(space)
    # Compile only, no link.
    c-flags   += -c
    cxx-flags += -c
    # Generating dependecy file.
    c-flags-m   += -M -MG
    cxx-flags-m += -M -MG
    # Enable C99 language.
    ifneq "$(CPLUSPLUS)" "on"
        c-flags += -std=gnu99
    endif
    # Generate position-independent code (SDL requirements).
    c-flags   += -fPIC
    cxx-flags += -fPIC
    # Emit debugging information.
    ifeq "$(DEBUG_INFO)" "on"
        c-flags   += -g
        cxx-flags += -g
    endif
    # Instrument program for profiling, gather extra information.
    ifeq "$(COVERAGE)" "on"
        ifeq "$(c)" "icc"
            c-flags   += -prof_genx
        endif
        ifeq "$(cxx)" "icpc"
            cxx-flags += -prof_genx
        endif
    endif
    # Turn optimization on or off.
    ifeq "$(OPTIMIZATION)" "on"
        # -inline-min-size=1 improves performance of PARALLEL EPCC up to 10% on fxi64lin01,
        # doesn't change performance on fxe64lin01.
        # Presence of the -inline-min-size=1 switch should only help
        # to promote performance stability between changes,
        # even if it has no observable impact right now.
	ifneq "$(filter icl icl.exe,$(c))" ""
            c-flags   += -O2 -inline-min-size=1
	else
            c-flags   += -O2
	endif
        ifneq "$(filter icl icl.exe,$(cxx))" ""
            cxx-flags += -O2 -inline-min-size=1
	else
            cxx-flags += -O2
	endif
    else
        c-flags   += -O0
        cxx-flags += -O0
    endif
    # --- Assembler ---
    ifeq "$(c)" "icc"
        as        = icc
    endif
    ifeq "$(c)" "gcc"
        as        = gcc
    endif
    ifeq "$(c)" "clang"
        as        = clang
    endif
    as-out    = -o$(space)
    as-flags += $(cpp-flags)
    # Compile only, no link.
    as-flags += -c
    as-flags += -x assembler-with-cpp
    # --- Fortran ---
    ifeq "$(c)" "icc"
        fort = ifort
    endif
    ifeq "$(c)" "gcc"
        fort = gfortran
    endif
    ifeq "$(c)" "clang"
        fort = gfortran
    endif
    ifeq "$(fort)" ""
        fort = ifort
    endif
    fort-out    = -o$(space)
    fort-flags += -c
endif

# --- Linux* OS definitions ---

ifeq "$(os)" "lin"
ifneq "$(arch)" "mic"
    # --- C/C++ ---
    # On lin_32, we want to maintain stack alignment to be compatible with GNU binaries built with
    # compiler.
    ifeq "$(c)" "icc"
        ifeq "$(arch)" "32"
            c-flags   += -falign-stack=maintain-16-byte
            cxx-flags += -falign-stack=maintain-16-byte
        endif
        # Generate code that will run on any Pentium or later processor.
        ifeq "$(arch)" "32"
            c-flags   += -mia32
            cxx-flags += -mia32
        endif
    endif
    ifeq "$(c)" "gcc"
        ifeq "$(arch)" "arm"
            c-flags   += -marm
        endif
    endif
    # --- Librarian ---
    ar        = ar
    ar-out    = $(empty)
    ar-flags += cr
    # --- Linker ---
    # Use ld by default, however, makefile may specify ld=$(c) before including devtools.mk.
    ifeq "$(ld)" ""
        ld = $(c)
    endif
    ld-flags-dll += -shared
{'fraction_non_alphanumeric': 0.19660364145658263, 'fraction_numerical': 0.00980392156862745, 'mean_word_length': 1.5697255960413856, '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': '4102684', 'n_tokens_mistral': 3788, 'n_tokens_neox': 3533, 'n_words': 1148}