<commit_before>##############################################################################
# Dynamic Audio Normalizer
# Copyright (C) 2015 LoRd_MuldeR <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version, but always including the *additional*
# restrictions defined in the "License.txt" file.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# http://www.gnu.org/licenses/gpl-2.0.txt
##############################################################################

ECHO=echo -e
SHELL=/bin/bash

MODE ?= full
PANDOC ?= pandoc

##############################################################################
# Constants
##############################################################################

LIBRARY_NAME := DynamicAudioNormalizerAPI
PROGRAM_NAME := DynamicAudioNormalizerCLI
LOGVIEW_NAME := DynamicAudioNormalizerGUI
JNIWRAP_NAME := DynamicAudioNormalizerJNI
PASWRAP_NAME := DynamicAudioNormalizerPAS
BUILD_DATE   := $(shell date -Idate)
BUILD_TIME   := $(shell date +%H:%M:%S)
BUILD_TAG    := $(addprefix /tmp/,$(shell echo $$RANDOM$$RANDOM$$RANDOM))
TARGET_PATH  := ./bin/$(BUILD_DATE)
OUTPUT_FILE  := $(abspath ./bin/DynamicAudioNormalizer.$(BUILD_DATE).tbz2)
PANDOC_FLAGS := markdown_github+pandoc_title_block+header_attributes+implicit_figures

# Version info
VER_MAJOR = $(shell sed -n 's/.*DYNAUDNORM_VERSION_MAJOR = \([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)
VER_MINOR = $(shell sed -n 's/.*DYNAUDNORM_VERSION_MINOR = \([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)
VER_PATCH = $(shell sed -n 's/.*DYNAUDNORM_VERSION_PATCH = \([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)

# API Version
export API_VERSION := $(shell sed -n 's/.*define MDYNAMICAUDIONORMALIZER_CORE \([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/include/DynamicAudioNormalizer.h)

##############################################################################
# Projects
##############################################################################

MY_PROJECTS := NONE

ifeq ($(MODE),full)
  MY_PROJECTS := API CLI GUI JNI
  export ENABLE_JNI := true
endif
ifeq ($(MODE),no-gui)
  MY_PROJECTS := API CLI JNI
  export ENABLE_JNI := true
endif
ifeq ($(MODE),minimal)
  MY_PROJECTS := API CLI
  export ENABLE_JNI := false
endif

ifeq ($(MY_PROJECTS),NONE)
  $(error Invalid MODE value: $(MODE))
endif

##############################################################################
# Rules
##############################################################################

BUILD_PROJECTS = $(addprefix DynamicAudioNormalizer,$(MY_PROJECTS))
CLEAN_PROJECTS = $(addprefix CleanUp,$(BUILD_PROJECTS))

.PHONY: all clean $(BUILD_PROJECTS) $(CLEAN_PROJECTS) DeployBinaries CopyAllBinaries CreateDocuments CreateTagFile

all: $(BUILD_PROJECTS) DeployBinaries
	@$(ECHO) "\n\e[1;32mComplete.\e[0m\n"

clean: $(CLEAN_PROJECTS) CleanBinaries
	@$(ECHO) "\n\e[1;32mComplete.\e[0m\n"

#-------------------------------------------------------------
# Clean
#-------------------------------------------------------------

$(CLEAN_PROJECTS):
	@$(ECHO) "\n\e[1;31m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;31mClean: $(patsubst Clean%,%,$@)\e[0m"
	@$(ECHO) "\e[1;31m-----------------------------------------------------------------------------\n\e[0m"
	make -C ./$(patsubst CleanUp%,%,$@) clean

CleanBinaries:
	@$(ECHO) "\n\e[1;31m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;31mClean\e[0m"
	@$(ECHO) "\e[1;31m-----------------------------------------------------------------------------\n\e[0m"
	rm -rfv ./bin

#-------------------------------------------------------------
# Build
#-------------------------------------------------------------

$(BUILD_PROJECTS):
	@$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;34mBuild: $@\e[0m"
	@$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
	make -C ./$@

#-------------------------------------------------------------
# Deploy
#-------------------------------------------------------------

DeployBinaries: CopyAllBinaries CreateDocuments CreateTagFile
	@$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;34mDeploy\e[0m"
	@$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
	rm -f $(OUTPUT_FILE)
	pushd $(TARGET_PATH) ; tar -vcjf $(OUTPUT_FILE) * ; popd

CreateTagFile:
	@$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;34mBuild Tag\e[0m"
	@$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
	echo "Dynamic Audio Normalizer" > $(BUILD_TAG)
	echo "Copyright (C) 2015 LoRd_MuldeR <<EMAIL>>" >> $(BUILD_TAG)
	echo "" >> $(BUILD_TAG)
	echo "Version $$(printf %d.%02d-%d $(VER_MAJOR) $(VER_MINOR) $(VER_PATCH)). Built on $(BUILD_DATE), at $(BUILD_TIME)" >> $(BUILD_TAG)
	echo "" >> $(BUILD_TAG)
	g++ --version | head -n1 | sed 's/^/Compiler version:   /' >> $(BUILD_TAG)
	uname -srmo | sed 's/^/Build platform:     /' >> $(BUILD_TAG)
	(lsb_release -s -d || echo "Unknown") | sed 's/\"//g' | sed 's/^/System description: /' >> $(BUILD_TAG)
	echo "" >> $(BUILD_TAG)
	echo "This library is free software; you can redistribute it and/or" >> $(BUILD_TAG)
	echo "modify it under the terms of the GNU Lesser General Public" >> $(BUILD_TAG)
	echo "License as published by the Free Software Foundation; either" >> $(BUILD_TAG)
	echo "version 2.1 of the License, or (at your option) any later version." >> $(BUILD_TAG)
	echo "" >> $(BUILD_TAG)
	echo "This library is distributed in the hope that it will be useful," >> $(BUILD_TAG)
	echo "but WITHOUT ANY WARRANTY; without even the implied warranty of" >> $(BUILD_TAG)
	echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU" >> $(BUILD_TAG)
	echo "Lesser General Public License for more details." >> $(BUILD_TAG)
	mkdir -p $(TARGET_PATH)
	mv -f $(BUILD_TAG) $(TARGET_PATH)/BUILD_TAG

CopyAllBinaries:
	@$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"<commit_msg>Fixed "System description:" on MSYS/MinGW.<commit_after>##############################################################################
# Dynamic Audio Normalizer
# Copyright (C) 2015 LoRd_MuldeR <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version, but always including the *additional*
# restrictions defined in the "License.txt" file.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# http://www.gnu.org/licenses/gpl-2.0.txt
##############################################################################

ECHO=echo -e
SHELL=/bin/bash

MODE ?= full
PANDOC ?= pandoc

##############################################################################
# Constants
##############################################################################

LIBRARY_NAME := DynamicAudioNormalizerAPI
PROGRAM_NAME := DynamicAudioNormalizerCLI
LOGVIEW_NAME := DynamicAudioNormalizerGUI
JNIWRAP_NAME := DynamicAudioNormalizerJNI
PASWRAP_NAME := DynamicAudioNormalizerPAS
BUILD_DATE   := $(shell date -Idate)
BUILD_TIME   := $(shell date +%H:%M:%S)
BUILD_TAG    := $(addprefix /tmp/,$(shell echo $$RANDOM$$RANDOM$$RANDOM))
TARGET_PATH  := ./bin/$(BUILD_DATE)
OUTPUT_FILE  := $(abspath ./bin/DynamicAudioNormalizer.$(BUILD_DATE).tbz2)
PANDOC_FLAGS := markdown_github+pandoc_title_block+header_attributes+implicit_figures

# Version info
VER_MAJOR = $(shell sed -n 's/.*DYNAUDNORM_VERSION_MAJOR = \([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)
VER_MINOR = $(shell sed -n 's/.*DYNAUDNORM_VERSION_MINOR = \([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)
VER_PATCH = $(shell sed -n 's/.*DYNAUDNORM_VERSION_PATCH = \([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)

# API Version
export API_VERSION := $(shell sed -n 's/.*define MDYNAMICAUDIONORMALIZER_CORE \([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/include/DynamicAudioNormalizer.h)

##############################################################################
# Projects
##############################################################################

MY_PROJECTS := NONE

ifeq ($(MODE),full)
  MY_PROJECTS := API CLI GUI JNI
  export ENABLE_JNI := true
endif
ifeq ($(MODE),no-gui)
  MY_PROJECTS := API CLI JNI
  export ENABLE_JNI := true
endif
ifeq ($(MODE),minimal)
  MY_PROJECTS := API CLI
  export ENABLE_JNI := false
endif

ifeq ($(MY_PROJECTS),NONE)
  $(error Invalid MODE value: $(MODE))
endif

##############################################################################
# Rules
##############################################################################

BUILD_PROJECTS = $(addprefix DynamicAudioNormalizer,$(MY_PROJECTS))
CLEAN_PROJECTS = $(addprefix CleanUp,$(BUILD_PROJECTS))

.PHONY: all clean $(BUILD_PROJECTS) $(CLEAN_PROJECTS) DeployBinaries CopyAllBinaries CreateDocuments CreateTagFile

all: $(BUILD_PROJECTS) DeployBinaries
	@$(ECHO) "\n\e[1;32mComplete.\e[0m\n"

clean: $(CLEAN_PROJECTS) CleanBinaries
	@$(ECHO) "\n\e[1;32mComplete.\e[0m\n"

#-------------------------------------------------------------
# Clean
#-------------------------------------------------------------

$(CLEAN_PROJECTS):
	@$(ECHO) "\n\e[1;31m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;31mClean: $(patsubst Clean%,%,$@)\e[0m"
	@$(ECHO) "\e[1;31m-----------------------------------------------------------------------------\n\e[0m"
	make -C ./$(patsubst CleanUp%,%,$@) clean

CleanBinaries:
	@$(ECHO) "\n\e[1;31m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;31mClean\e[0m"
	@$(ECHO) "\e[1;31m-----------------------------------------------------------------------------\n\e[0m"
	rm -rfv ./bin

#-------------------------------------------------------------
# Build
#-------------------------------------------------------------

$(BUILD_PROJECTS):
	@$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;34mBuild: $@\e[0m"
	@$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
	make -C ./$@

#-------------------------------------------------------------
# Deploy
#-------------------------------------------------------------

DeployBinaries: CopyAllBinaries CreateDocuments CreateTagFile
	@$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;34mDeploy\e[0m"
	@$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
	rm -f $(OUTPUT_FILE)
	pushd $(TARGET_PATH) ; tar -vcjf $(OUTPUT_FILE) * ; popd

CreateTagFile:
	@$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
	@$(ECHO) "\e[1;34mBuild Tag\e[0m"
	@$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
	echo "Dynamic Audio Normalizer" > $(BUILD_TAG)
	echo "Copyright (C) 2015 LoRd_MuldeR <<EMAIL>>" >> $(BUILD_TAG)
	echo "" >> $(BUILD_TAG)
	echo "Version $$(printf %d.%02d-%d $(VER_MAJOR) $(VER_MINOR) $(VER_PATCH)). Built on $(BUILD_DATE), at $(BUILD_TIME)" >> $(BUILD_TAG)
	echo "" >> $(BUILD_TAG)
	g++ --version | head -n1 | sed 's/^/Compiler version:   /' >> $(BUILD_TAG)
	uname -srmo | sed 's/^/Build platform:     /' >> $(BUILD_TAG)
	(lsb_release -s -d || ([ -n "$$MSYSTEM" ] && echo "$$MSYSTEM") || echo "Unknown") | sed 's/\"//g' | sed 's/^/System description: /' >> $(BUILD_TAG)
	echo "" >> $(BUILD_TAG)
	echo "This library is free software; you can redistribute it and/or" >> $(BUILD_TAG)
	echo "modify it under the terms of the GNU Lesser General Public" >> $(BUILD_TAG)
	echo "License as published by the Free Software Foundation; either" >> $(BUILD_TAG)
	echo "version 2.1 of the License, or (at your option) any later version." >> $(BUILD_TAG)
	echo "" >> $(BUILD_TAG)
	echo "This library is distributed in the hope that it will be useful," >> $(BUILD_TAG)
	echo "but WITHOUT ANY WARRANTY; without even the implied warranty of" >> $(BUILD_TAG)
	echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU" >> $(BUILD_TAG)
	echo "Lesser General Public License for more details." >> $(BUILD_TAG)
	mkdir -p $(TARGET_PATH)
	mv -f $(BUILD_TAG) $(TARGET_PATH)/BUILD_TAG

CopyAllBinaries:
	@$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
{'fraction_non_alphanumeric': 0.38734667527437056, 'fraction_numerical': 0.016067713937307222, 'mean_word_length': 2.2959810874704494, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1228371', 'n_tokens_mistral': 4264, 'n_tokens_neox': 4027, 'n_words': 1011}