<commit_before># file:        Makefile
# author:      <NAME>
# description: Build everything

# AUTORIGHTS

# This makefile builds VLFeat on modern UNIX boxes with the GNU
# compiler and make programs. Mac and Linux are explicitly supported,
# and many other boxes should be easy to add.
#
# This makefile builds three components: VLFeat shared library (DLL),
# the command line programs, and the MATLAB toolbox. It also builds
# the documentation (for the API, the MATLAB toolbox, the command line
# utility, and also VLFeat homepage).
#
# Configuring the build system entails setting the appropriate
# variables, which are summarized next. The makefile attempts to
# auto-detect the right configuration parameters depending on the
# architecture (see later).
#
# == MISCELLANEOUS VARIABLES ==
#
# VER:          Package version (e.g. 1.0)
# DIST:         Package name for the source distr. ('vlfeat-1.0')
# BINDIST:      Package name for the binary distr. ('vlfeat-1.0-bin')
# HOST:         Where to pulbish the package.
# NDEBUG:       Define this flag to remove debugging support (default undefined)
# VERB:         Define this flag to provide extra information (default NO)
#
# == PROGRAMS REQUIRED FOR BUILDING ==
#
# The following programs are required to compile the C library and the
# command line utilities:
#
# CC:           C compiler (e.g. gcc).
# LIBTOOL:      libtool (used only under Mac)
#
# The following programs are required to compile the C code in the
# MATLAB Toolbox. Both are bundled with MATLAB, but may not be
# available directly from the command line path.
#
# MATLAB:       Matlab executable (typically `matlab')
# MEX:          MEX compiler executable (typically `mex')
#
# The following programs are required to make the distribution
# packages:
#
# GIT:          Version system (you also need the full GIT repository).
#
# The following programs are needed only to generate the
# documentation:
#
# PYTHON:       Python interpreter
# DOXYGEN:      Doxygen documentation system
# DVIPNG:       TeX DVI to PNG converter
# DVIPS:        TeX DVI to PS converter
# EPS2PDF:      EPS to PDF converter
# CONVERT:      ImageMagick convert utility
# FIG2DEV:      X-Fig conversion program
#
# == BUILDING ===
#
# You can use CFLAGS and LDFLAGS to pass additional flags to the C
# compiler and linker. These are in turn passed to the various flags
# defined below.
#
# == BUILDING THE SHARED LIBRARY ==
#
# DLL_CLFAGS:   Aflags passed to $(CC) to compile a DLL C source
# DLL_SUFFIX:   suffix of a DLL (.so, .dylib)
#
# == BUILDING THE COMMAND LINE UTILITIES ==
#
# BINDIR:       where to put the exec (and libraries)
# C_CLFAGS:     flags passed to $(CC) to compile a C source
# C_LDFLAGS:    flags passed to $(CC) to link C objects into an exec
#
# == BUILDING THE MEX FILES ==
#
# MATLABPATH:   MATALB root path
# MEX_BINDIR:   where to put mex files
# MEX_SUFFIX:   suffix of a MEX file (.mexglx, .mexmac, ...)
# MEX_FLAGS:    flags passed to $(MEX)
# MEX_CFLAGS:   flags added to the CLFAGS variable of $(MEX)
# MEX_LDFLAGS:  flags added to the LDFLAGS variable of $(MEX)
#
# == BUILDING THE DOCUMENTATION ==
#
# There are no configuration parameters.
#
# == ABOUT DEBUGGING ==
#
# We use the older STABS+ debug format as MATLAB MEX command has buggy
# support for DWARD-2. In particular, compiling a MEX file produces a
# DLL, but removes the intermediate object files, where DWARF-2 stores
# the actual debugging information. Since MEX uses the default
# debugging format (-g option) and this corresponds often to DWARF-2,
# this should be considered a bug.
#
# As a workaround, we pass the -gstabs+ flag to MEX
#
# An alternative workaround is the following hack.
# Fist we compile the MEX file without linking and then we linking in a
# second pass, effectively preserving an intermediate object file
# (but not all of them).  E.g., on Mac OS X
#
# > mex -c -g mymex.c ; mex -g mymex.o ;
#
# does preserve debugging information. In fact is also possible to run
#
# > dsymutil mymex.mexmaci
#
# does produce a mymex.mexmaci.dSYM bundle with (almost complete)
# debugging information.

NAME   := vlfeat
VER    := 0.9.5
HOST   := ganesh.cs.ucla.edu:/var/www/vlfeat.org

# programs required to build VLFeat
CC         ?= cc
MATLABEXE  ?= matlab
MEX        ?= mex
LIBTOOL    ?= libtool

# programs required to build VLFeat documentation
CONVERT    ?= convert
DOXYGEN    ?= doxygen
DVIPNG     ?= dvipng
DVIPS      ?= dvips
EPSTOPDF   ?= epstopdf
FIG2DEV    ?= fig2dev
LATEX      ?= latex
PYTHON     ?= python
GROFF      ?= groff
TIDY       ?= tidy

# programs required to build VLFeat distribution
GIT        ?= git

.PHONY : all
all : dll all-bin

# --------------------------------------------------------------------
#                                                       Error Messages
# --------------------------------------------------------------------

err_no_arch  =
err_no_arch +=$(shell echo "** Unknown host architecture '$(UNAME)'. This identifier"   1>&2)
err_no_arch +=$(shell echo "** was obtained by running 'uname -sm'. Edit the Makefile " 1>&2)
err_no_arch +=$(shell echo "** to add the appropriate configuration."                   1>&2)
err_no_arch +=config

err_internal  =$(shell echo Internal error)
err_internal +=internal

# --------------------------------------------------------------------
#                                     Auto-detect Architecture, MATLAB
# --------------------------------------------------------------------

Darwin_PPC_ARCH             := mac
Darwin_Power_Macintosh_ARCH := mac
Darwin_i386_ARCH            := mci
Linux_i386_ARCH             := glx
Linux_i686_ARCH             := glx
Linux_unknown_ARCH          := glx
Linux_x86_64_ARCH           := g64

UNAME := $(shell uname -sm)
ARCH  := $($(shell echo "$(UNAME)" | tr \  _)_ARCH)

# sanity check
ifeq ($(ARCH),)
die:=$(error $(err_no_arch))
endif

MATLABPATH := $(strip $(shell $(MEX) -v 2>&1 |                       \
                sed -n 's/.*MATLAB *= *\(.*\)/\1/gp'))

# --------------------------------------------------------------------
#                                                            Functions
# --------------------------------------------------------------------

# $(call if-like,FILTER,WHY,WHAT)
define if-like
$(if $(filter $(1),$(2)),$(3))
endef

# $(call dump-var,VAR) pretty-prints the content of a variable VAR
define dump-var
@echo $(1) =
@echo $($(1)) | sed 's/\([^ ][^ ]* [^ ][^ ]*\) */\1#/g' | \
tr '#' '\n' | column -t | sed 's/\(.*\)/  \1/g'
endef

# $(call print-command, CMD, TGT) prints a message
define print-command
@printf "%10s %s\n" "$(strip $(1))" "$(strip $(2))"
endef

# $(call C, CMD) runs $(CMD) silently
define C
@$(call print-command, $(1), "$(@)")
@quiet ()                                                            \
{                                                                    \
    local cmd out err ;					             \
    cmd="$($(1))";                                                   \
    out=$$($${cmd} "$${@}" 2>&1);                                    \
    err=$${?};                                                       \
    if test $${err} -gt 0 ; then                                     \
        echo "******* Offending Command:";                           \
        echo "$${cmd}" "$${@}";                                      \
        echo "******* Error Code: $${err}";                          \
	echo "******* Command Output:";                              \
        echo "$${out}";                                              \
    fi;                                                              \
    echo "$${out}" | grep arning ;                                   \
    return $${err};                                                  \
} ; quiet
endef

# If verbose print everything
ifdef VERB
C = $($(1))
endif

# --------------------------------------------------------------------
#                                            Common UNIX Configuration
# --------------------------------------------------------------------

ifndef NDEBUG
DEBUG := yes
endif

C_CFLAGS     = $(CFLAGS)
C_CFLAGS    += -I$(CURDIR) -pedantic -std=c99 -O3
C_CFLAGS    += -Wall -Wno-unused-function -Wno-long-long
C_CFLAGS    += $(if $(DEBUG), -O0 -g -std=c89)

C_LDFLAGS    = $(LDFLAGS)
C_LDFLAGS   += -L$(BINDIR) -l$(DLL_NAME)

DLL_NAME     = vl
DLL_CFLAGS   = $(C_CFLAGS) -fvisibility=hidden -fPIC -DVL_BUILD_DLL

MEX_FLAGS    = $(if $(DEBUG), -g)
MEX_CFLAGS   = $(C_CFLAGS) -Itoolbox
MEX_LDFLAGS  = -L$(BINDIR) -l$(DLL_NAME)

ifdef MATLABPATH
all: all-mex
endif

# --------------------------------------------------------------------
#                                  Architecture-specific Configuration
# --------------------------------------------------------------------

# Mac OS X on PPC processor
ifeq ($(ARCH),mac)
BINDIR          := bin/mac
DLL_SUFFIX      := dylib
MEX_SUFFIX      := mexmac
C_CFLAGS        += -D__BIG_ENDIAN__ -Wno-variadic-macros
C_CFLAGS        += $(if $(DEBUG), -gstabs+)
C_LDFLAGS       += -lm
DLL_CFLAGS      += -fvisibility=hidden
MEX_FLAGS       += -lm CC='gcc' CXX='g++' LD='gcc'
MEX_CFLAGS      +=
MEX_LDFLAGS     +=
endif

# Mac OS X on Intel processor
ifeq ($(ARCH),mci)
BINDIR          := bin/maci
DLL_SUFFIX      := dylib
MEX_SUFFIX      := mexmaci
C_CFLAGS        += -D__LITTLE_ENDIAN__ -Wno-variadic-macros
C_CFLAGS        += -DVL_SUPPORT_SSE2
C_CFLAGS        += $(call if-like,%_sse2,$*,-msse2)
CFLAGS          += $(if $(DEBUG), -gstabs+)
LDFLAGS         += -lm
MEX_FLAGS       += -lm
MEX_CFLAGS      +=
MEX_LDFLAGS     +=
endif

# Linux-32
ifeq ($(ARCH),glx)
BINDIR          := bin/glx
MEX_SUFFIX      := mexglx
DLL_SUFFIX      := so
C_CFLAGS        += -D__LITTLE_ENDIAN__ -std=c99
C_CFLAGS        += -DVL_SUPPORT_SSE2
C_CFLAGS        += -march=i686
C_CFLAGS        += $(call if-like,%_sse2,$*,-msse2)
LDFLAGS         += -lm -Wl,--rpath,\$$ORIGIN/
MEX_FLAGS       += -lm
MEX_CFLAGS      +=
MEX_LDFLAGS     += -Wl,--rpath,\\\$$ORIGIN/
endif

# Linux-64
ifeq ($(ARCH),g64)<commit_msg>Makefile: force 32-bit architecture on mac for Snow Leopard compatibility<commit_after># file:        Makefile
# author:      <NAME>
# description: Build everything

# AUTORIGHTS

# This makefile builds VLFeat on modern UNIX boxes with the GNU
# compiler and make programs. Mac and Linux are explicitly supported,
# and many other boxes should be easy to add.
#
# This makefile builds three components: VLFeat shared library (DLL),
# the command line programs, and the MATLAB toolbox. It also builds
# the documentation (for the API, the MATLAB toolbox, the command line
# utility, and also VLFeat homepage).
#
# Configuring the build system entails setting the appropriate
# variables, which are summarized next. The makefile attempts to
# auto-detect the right configuration parameters depending on the
# architecture (see later).
#
# == MISCELLANEOUS VARIABLES ==
#
# VER:          Package version (e.g. 1.0)
# DIST:         Package name for the source distr. ('vlfeat-1.0')
# BINDIST:      Package name for the binary distr. ('vlfeat-1.0-bin')
# HOST:         Where to pulbish the package.
# NDEBUG:       Define this flag to remove debugging support (default undefined)
# VERB:         Define this flag to provide extra information (default NO)
#
# == PROGRAMS REQUIRED FOR BUILDING ==
#
# The following programs are required to compile the C library and the
# command line utilities:
#
# CC:           C compiler (e.g. gcc).
# LIBTOOL:      libtool (used only under Mac)
#
# The following programs are required to compile the C code in the
# MATLAB Toolbox. Both are bundled with MATLAB, but may not be
# available directly from the command line path.
#
# MATLAB:       Matlab executable (typically `matlab')
# MEX:          MEX compiler executable (typically `mex')
#
# The following programs are required to make the distribution
# packages:
#
# GIT:          Version system (you also need the full GIT repository).
#
# The following programs are needed only to generate the
# documentation:
#
# PYTHON:       Python interpreter
# DOXYGEN:      Doxygen documentation system
# DVIPNG:       TeX DVI to PNG converter
# DVIPS:        TeX DVI to PS converter
# EPS2PDF:      EPS to PDF converter
# CONVERT:      ImageMagick convert utility
# FIG2DEV:      X-Fig conversion program
#
# == BUILDING ===
#
# You can use CFLAGS and LDFLAGS to pass additional flags to the C
# compiler and linker. These are in turn passed to the various flags
# defined below.
#
# == BUILDING THE SHARED LIBRARY ==
#
# DLL_CLFAGS:   Aflags passed to $(CC) to compile a DLL C source
# DLL_SUFFIX:   suffix of a DLL (.so, .dylib)
#
# == BUILDING THE COMMAND LINE UTILITIES ==
#
# BINDIR:       where to put the exec (and libraries)
# C_CLFAGS:     flags passed to $(CC) to compile a C source
# C_LDFLAGS:    flags passed to $(CC) to link C objects into an exec
#
# == BUILDING THE MEX FILES ==
#
# MATLABPATH:   MATALB root path
# MEX_BINDIR:   where to put mex files
# MEX_SUFFIX:   suffix of a MEX file (.mexglx, .mexmac, ...)
# MEX_FLAGS:    flags passed to $(MEX)
# MEX_CFLAGS:   flags added to the CLFAGS variable of $(MEX)
# MEX_LDFLAGS:  flags added to the LDFLAGS variable of $(MEX)
#
# == BUILDING THE DOCUMENTATION ==
#
# There are no configuration parameters.
#
# == ABOUT DEBUGGING ==
#
# We use the older STABS+ debug format as MATLAB MEX command has buggy
# support for DWARD-2. In particular, compiling a MEX file produces a
# DLL, but removes the intermediate object files, where DWARF-2 stores
# the actual debugging information. Since MEX uses the default
# debugging format (-g option) and this corresponds often to DWARF-2,
# this should be considered a bug.
#
# As a workaround, we pass the -gstabs+ flag to MEX
#
# An alternative workaround is the following hack.
# Fist we compile the MEX file without linking and then we linking in a
# second pass, effectively preserving an intermediate object file
# (but not all of them).  E.g., on Mac OS X
#
# > mex -c -g mymex.c ; mex -g mymex.o ;
#
# does preserve debugging information. In fact is also possible to run
#
# > dsymutil mymex.mexmaci
#
# does produce a mymex.mexmaci.dSYM bundle with (almost complete)
# debugging information.

NAME   := vlfeat
VER    := 0.9.5
HOST   := ganesh.cs.ucla.edu:/var/www/vlfeat.org

# programs required to build VLFeat
CC         ?= cc
MATLABEXE  ?= matlab
MEX        ?= mex
LIBTOOL    ?= libtool

# programs required to build VLFeat documentation
CONVERT    ?= convert
DOXYGEN    ?= doxygen
DVIPNG     ?= dvipng
DVIPS      ?= dvips
EPSTOPDF   ?= epstopdf
FIG2DEV    ?= fig2dev
LATEX      ?= latex
PYTHON     ?= python
GROFF      ?= groff
TIDY       ?= tidy

# programs required to build VLFeat distribution
GIT        ?= git

.PHONY : all
all : dll all-bin

# --------------------------------------------------------------------
#                                                       Error Messages
# --------------------------------------------------------------------

err_no_arch  =
err_no_arch +=$(shell echo "** Unknown host architecture '$(UNAME)'. This identifier"   1>&2)
err_no_arch +=$(shell echo "** was obtained by running 'uname -sm'. Edit the Makefile " 1>&2)
err_no_arch +=$(shell echo "** to add the appropriate configuration."                   1>&2)
err_no_arch +=config

err_internal  =$(shell echo Internal error)
err_internal +=internal

# --------------------------------------------------------------------
#                                     Auto-detect Architecture, MATLAB
# --------------------------------------------------------------------

Darwin_PPC_ARCH             := mac
Darwin_Power_Macintosh_ARCH := mac
Darwin_i386_ARCH            := mci
Linux_i386_ARCH             := glx
Linux_i686_ARCH             := glx
Linux_unknown_ARCH          := glx
Linux_x86_64_ARCH           := g64

UNAME := $(shell uname -sm)
ARCH  := $($(shell echo "$(UNAME)" | tr \  _)_ARCH)

# sanity check
ifeq ($(ARCH),)
die:=$(error $(err_no_arch))
endif

MATLABPATH := $(strip $(shell $(MEX) -v 2>&1 |                       \
                sed -n 's/.*MATLAB *= *\(.*\)/\1/gp'))

# --------------------------------------------------------------------
#                                                            Functions
# --------------------------------------------------------------------

# $(call if-like,FILTER,WHY,WHAT)
define if-like
$(if $(filter $(1),$(2)),$(3))
endef

# $(call dump-var,VAR) pretty-prints the content of a variable VAR
define dump-var
@echo $(1) =
@echo $($(1)) | sed 's/\([^ ][^ ]* [^ ][^ ]*\) */\1#/g' | \
tr '#' '\n' | column -t | sed 's/\(.*\)/  \1/g'
endef

# $(call print-command, CMD, TGT) prints a message
define print-command
@printf "%10s %s\n" "$(strip $(1))" "$(strip $(2))"
endef

# $(call C, CMD) runs $(CMD) silently
define C
@$(call print-command, $(1), "$(@)")
@quiet ()                                                            \
{                                                                    \
    local cmd out err ;					             \
    cmd="$($(1))";                                                   \
    out=$$($${cmd} "$${@}" 2>&1);                                    \
    err=$${?};                                                       \
    if test $${err} -gt 0 ; then                                     \
        echo "******* Offending Command:";                           \
        echo "$${cmd}" "$${@}";                                      \
        echo "******* Error Code: $${err}";                          \
	echo "******* Command Output:";                              \
        echo "$${out}";                                              \
    fi;                                                              \
    echo "$${out}" | grep arning ;                                   \
    return $${err};                                                  \
} ; quiet
endef

# If verbose print everything
ifdef VERB
C = $($(1))
endif

# --------------------------------------------------------------------
#                                            Common UNIX Configuration
# --------------------------------------------------------------------

ifndef NDEBUG
DEBUG := yes
endif

C_CFLAGS     = $(CFLAGS)
C_CFLAGS    += -I$(CURDIR) -pedantic -std=c99 -O3
C_CFLAGS    += -Wall -Wno-unused-function -Wno-long-long
C_CFLAGS    += $(if $(DEBUG), -O0 -g -std=c89)

C_LDFLAGS    = $(LDFLAGS)
C_LDFLAGS   += -L$(BINDIR) -l$(DLL_NAME)

DLL_NAME     = vl
DLL_CFLAGS   = $(C_CFLAGS) -fvisibility=hidden -fPIC -DVL_BUILD_DLL

MEX_FLAGS    = $(if $(DEBUG), -g)
MEX_CFLAGS   = $(C_CFLAGS) -Itoolbox
MEX_LDFLAGS  = -L$(BINDIR) -l$(DLL_NAME)

ifdef MATLABPATH
all: all-mex
endif

# --------------------------------------------------------------------
#                                  Architecture-specific Configuration
# --------------------------------------------------------------------

# Mac OS X on PPC processor
ifeq ($(ARCH),mac)
BINDIR          := bin/mac
DLL_SUFFIX      := dylib
MEX_SUFFIX      := mexmac
C_CFLAGS        += -D__BIG_ENDIAN__ -Wno-variadic-macros
C_CFLAGS        += $(if $(DEBUG), -gstabs+)
C_LDFLAGS       += -lm
DLL_CFLAGS      += -fvisibility=hidden
MEX_FLAGS       += -lm CC='gcc' CXX='g++' LD='gcc'
MEX_CFLAGS      +=
MEX_LDFLAGS     +=
endif

# Mac OS X on Intel processor
ifeq ($(ARCH),mci)
BINDIR          := bin/maci
DLL_SUFFIX      := dylib
MEX_SUFFIX      := mexmaci
C_CFLAGS        += -D__LITTLE_ENDIAN__ -Wno-variadic-macros
C_CFLAGS        += -DVL_SUPPORT_SSE2 -m32
C_CFLAGS        += $(call if-like,%_sse2,$*,-msse2)
CFLAGS          += $(if $(DEBUG), -gstabs+)
LDFLAGS         += -lm
MEX_FLAGS       += -lm
MEX_CFLAGS      +=
MEX_LDFLAGS     +=
endif

# Linux-32
ifeq ($(ARCH),glx)
BINDIR          := bin/glx
MEX_SUFFIX      := mexglx
DLL_SUFFIX      := so
C_CFLAGS        += -D__LITTLE_ENDIAN__ -std=c99
C_CFLAGS        += -DVL_SUPPORT_SSE2
C_CFLAGS        += -march=i686
C_CFLAGS        += $(call if-like,%_sse2,$*,-msse2)
LDFLAGS         += -lm -Wl,--rpath,\$$ORIGIN/
MEX_FLAGS       += -lm
MEX_CFLAGS      +=
MEX_LDFLAGS     += -Wl,--rpath,\\\$$ORIGIN/
endif

# Linux-64
ifeq ($(ARCH),g64)
{'fraction_non_alphanumeric': 0.17780755297503845, 'fraction_numerical': 0.008138553917919707, 'mean_word_length': 1.7302533532041728, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 52, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5019522', 'n_tokens_mistral': 6295, 'n_tokens_neox': 5954, 'n_words': 1949}