<commit_before># file: matlab.mak
# description: Build MATALB toolbox
# author: <NAME>

# Copyright (C) 2013-14 <NAME>.
# Copyright (C) 2007-12 <NAME> and <NAME>.
# All rights reserved.
#
# This file is part of the VLFeat library and is made available under
# the terms of the BSD license (see the COPYING file).

# MATLAB support is enabled if $(MEX) is executable and if MATLAB root
# can be deduced from the output of `$(MEX) -v`. Therefore setting MEX to
# the empty string disables MATLAB support.

MEX ?= mex
MATLAB_PATH ?= $(subst /bin/mex,,$(realpath $(shell which '$(MEX)')))
MATLAB_EXE ?= "$(MATLAB_PATH)/bin/matlab"
MATLAB_VER ?= 0 # will be determined automatically

# transform in immediate for efficiency
MATLAB_PATH := $(MATLAB_PATH)

# if expand to empty string, set to empty string for use with ifdef
ifeq ($(MATLAB_PATH),)
MATLAB_PATH=
endif

ifdef MATLAB_PATH
all: mex-all matlab-all
clean: mex-clean matlab-clean
archclean: mex-archclean matlab-archclean
distclean: mex-distclean matlab-distclean
endif

info: mex-info matlab-info

# With 2014a the new mex uses a revamped configuration system. It also
# breaks in subtle way how variables need to be escaped when passed to the
# mex command.

# --------------------------------------------------------------------
#                                                Obtain MATLAB version
# --------------------------------------------------------------------

ifeq ($(ARCH),maci)
MEX_SUFFIX := mexmaci
endif

ifeq ($(ARCH),maci64)
MEX_SUFFIX := mexmaci64
endif

ifeq ($(ARCH),glnx86)
MEX_SUFFIX := mexglx
endif

ifeq ($(ARCH),glnxa64)
MEX_SUFFIX := mexa64
endif

MEX_BINDIR := toolbox/mex/$(MEX_SUFFIX)

# generate the mex-dir target
$(eval $(call gendir, mex, $(MEX_BINDIR)))

# Cache an integer representing MATLAB's version
$(MEX_BINDIR)/matlabver.mak: $(mex-dir)
	rm -f "$(MEX_BINDIR)/matlabver.mak"
	$(MATLAB_EXE) -nodesktop -nosplash -nojvm \
	-r \
"f=fopen('$(MEX_BINDIR)/matlabver.mak','w');"\
"fprintf(f,'MATLAB_VER=%d\n',[1e4 1e2 1]*sscanf(version,'%d.%d.%d'));fclose(f);exit();"

ifdef MATLAB_PATH
ifeq ($(filter $(no_dep_targets), $(MAKECMDGOALS)),)
-include $(MEX_BINDIR)/matlabver.mak
endif
endif

ifeq ($(call gt,$(MATLAB_VER),80300),)
# new style
$(info Detected MATLAB 2014a or greater: adjusting escape method for MEX)
escape =$(1)
else
ifeq ($(call gt,$(MATLAB_VER),1),)
# old style
$(info Detected MATLAB 2013b or earlier: adjusting escape method for MEX)
escape =$(subst $$,\\$$,$(1))
else
$(info The MALTAB version will be detected in the next phase of Make)
endif
endif

# --------------------------------------------------------------------
#                                                  Prepare MEX options
# --------------------------------------------------------------------
#
# MATLAB provides the MEX command to compile and link MEX files. MEX is
# in fact a wrapper of the host compiler. By itself, it understand a
# set of standard compiler flags, but not, in general, flags which are
# specific to the underlying complier.
#<commit_msg>[bugfix] make/matlab.mak: fixes a bug causing the compilation to fail under Linux and MATLAB R2010<commit_after># file: matlab.mak
# description: Build MATALB toolbox
# author: <NAME>

# Copyright (C) 2013-14 <NAME>.
# Copyright (C) 2007-12 <NAME> and <NAME>.
# All rights reserved.
#
# This file is part of the VLFeat library and is made available under
# the terms of the BSD license (see the COPYING file).

# MATLAB support is enabled if $(MEX) is executable and if MATLAB root
# can be deduced from the output of `$(MEX) -v`. Therefore setting MEX to
# the empty string disables MATLAB support.

MEX ?= mex
MATLAB_PATH ?= $(subst /bin/mex,,$(realpath $(shell which '$(MEX)')))
MATLAB_EXE ?= "$(MATLAB_PATH)/bin/matlab"
MATLAB_VER ?= 0 # will be determined automatically

# transform in immediate for efficiency
MATLAB_PATH := $(MATLAB_PATH)

# if expand to empty string, set to empty string for use with ifdef
ifeq ($(MATLAB_PATH),)
MATLAB_PATH=
endif

ifdef MATLAB_PATH
all: mex-all matlab-all
clean: mex-clean matlab-clean
archclean: mex-archclean matlab-archclean
distclean: mex-distclean matlab-distclean
endif

info: mex-info matlab-info

# With 2014a the new mex uses a revamped configuration system. It also
# breaks in subtle way how variables need to be escaped when passed to the
# mex command.

# --------------------------------------------------------------------
#                                                Obtain MATLAB version
# --------------------------------------------------------------------

ifeq ($(ARCH),maci)
MEX_SUFFIX := mexmaci
endif

ifeq ($(ARCH),maci64)
MEX_SUFFIX := mexmaci64
endif

ifeq ($(ARCH),glnx86)
MEX_SUFFIX := mexglx
endif

ifeq ($(ARCH),glnxa64)
MEX_SUFFIX := mexa64
endif

MEX_BINDIR := toolbox/mex/$(MEX_SUFFIX)

# generate the mex-dir target
$(eval $(call gendir, mex, $(MEX_BINDIR)))

# Cache an integer representing MATLAB's version
$(MEX_BINDIR)/matlabver.mak: $(mex-dir)
	rm -f "$(MEX_BINDIR)/matlabver.mak"
	$(MATLAB_EXE) -nodesktop -nosplash -nojvm \
	-r \
"f=fopen('$(MEX_BINDIR)/matlabver.mak','w');"\
"fprintf(f,'MATLAB_VER=%d',[1e4 1e2 1]*sscanf(version,'%d.%d.%d'));fclose(f);exit();"

ifdef MATLAB_PATH
ifeq ($(filter $(no_dep_targets), $(MAKECMDGOALS)),)
-include $(MEX_BINDIR)/matlabver.mak
endif
endif

ifeq ($(call gt,$(MATLAB_VER),80300),)
# new style
$(info Detected MATLAB 2014a or greater: adjusting escape method for MEX)
escape =$(1)
else
ifeq ($(call gt,$(MATLAB_VER),1),)
# old style
$(info Detected MATLAB 2013b or earlier: adjusting escape method for MEX)
escape =$(subst $$,\\$$,$(1))
else
$(info The MALTAB version will be detected in the next phase of Make)
endif
endif

# --------------------------------------------------------------------
#                                                  Prepare MEX options
# --------------------------------------------------------------------
#
# MATLAB provides the MEX command to compile and link MEX files. MEX is
# in fact a wrapper of the host compiler. By itself, it understand a
# set of standard compiler flags, but not, in general, flags which are
# specific to the underlying complier.
#
{'fraction_non_alphanumeric': 0.1991889699918897, 'fraction_numerical': 0.016220600162206, 'mean_word_length': 2.727932285368803, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7342276', 'n_tokens_mistral': 2076, 'n_tokens_neox': 1944, 'n_words': 666}