Added support for new MSVC compiler version.
[DynamicAudioNormalizer.git] / Makefile
blob0918e7c9446d57f8803648a6c935a4ef41758532
1 ##############################################################################
2 # Dynamic Audio Normalizer
3 # Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version, but always including the *additional*
9 # restrictions defined in the "License.txt" file.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 # http://www.gnu.org/licenses/gpl-2.0.txt
21 ##############################################################################
23 ECHO=echo -e
24 SHELL=/bin/bash
26 MODE ?= full
27 PANDOC ?= pandoc
29 ##############################################################################
30 # Constants
31 ##############################################################################
33 LIBRARY_NAME := DynamicAudioNormalizerAPI
34 PROGRAM_NAME := DynamicAudioNormalizerCLI
35 LOGVIEW_NAME := DynamicAudioNormalizerGUI
36 JNIWRAP_NAME := DynamicAudioNormalizerJNI
37 PYDWRAP_NAME := DynamicAudioNormalizerPYD
38 PASWRAP_NAME := DynamicAudioNormalizerPAS
39 BUILD_DATE := $(shell date +%Y-%m-%d)
40 BUILD_TIME := $(shell date +%H:%M:%S)
41 BUILD_TAG := $(addprefix /tmp/,$(shell echo $$RANDOM$$RANDOM$$RANDOM))
42 TARGET_PATH := ./bin/$(BUILD_DATE)
43 OUTPUT_FILE := $(abspath ./bin/DynamicAudioNormalizer.$(BUILD_DATE).tbz2)
44 PANDOC_FLAGS := markdown_github+pandoc_title_block+header_attributes+implicit_figures
45 JARS_PATH := tmp/jars
47 # Version info
48 VER_MAJOR = $(shell sed -n 's/.*DYNAUDNORM_NS::VERSION_MAJOR\s*=\s*\([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)
49 VER_MINOR = $(shell sed -n 's/.*DYNAUDNORM_NS::VERSION_MINOR\s*=\s*\([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)
50 VER_PATCH = $(shell sed -n 's/.*DYNAUDNORM_NS::VERSION_PATCH\s*=\s*\([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/src/Version.cpp)
52 # API Version
53 export API_VERSION := $(shell sed -n 's/.*define MDYNAMICAUDIONORMALIZER_CORE \([0-9]*\).*/\1/p' < ./DynamicAudioNormalizerAPI/include/DynamicAudioNormalizer.h)
55 ##############################################################################
56 # Projects
57 ##############################################################################
59 MY_PROJECTS := NONE
61 ifeq ($(MODE),full)
62 MY_PROJECTS := API CLI GUI JNI PYD
63 export ENABLE_JNI := true
64 endif
65 ifeq ($(MODE),no-gui)
66 MY_PROJECTS := API CLI JNI PYD
67 export ENABLE_JNI := true
68 endif
69 ifeq ($(MODE),minimal)
70 MY_PROJECTS := API CLI
71 export ENABLE_JNI := false
72 endif
74 ifeq ($(MY_PROJECTS),NONE)
75 $(error Invalid MODE value: $(MODE))
76 endif
78 ##############################################################################
79 # Rules
80 ##############################################################################
82 BUILD_PROJECTS = $(addprefix DynamicAudioNormalizer,$(MY_PROJECTS))
83 CLEAN_PROJECTS = $(addprefix CleanUp,$(BUILD_PROJECTS))
85 .PHONY: all clean $(BUILD_PROJECTS) $(CLEAN_PROJECTS) DeployBinaries CopyAllBinaries CreateDocuments CreateTagFile
87 all: $(BUILD_PROJECTS) DeployBinaries
88 @$(ECHO) "\n\e[1;32mComplete.\e[0m\n"
90 clean: $(CLEAN_PROJECTS) CleanBinaries
91 @$(ECHO) "\n\e[1;32mComplete.\e[0m\n"
93 #-------------------------------------------------------------
94 # Clean
95 #-------------------------------------------------------------
97 $(CLEAN_PROJECTS):
98 @$(ECHO) "\n\e[1;31m-----------------------------------------------------------------------------\e[0m"
99 @$(ECHO) "\e[1;31mClean: $(patsubst Clean%,%,$@)\e[0m"
100 @$(ECHO) "\e[1;31m-----------------------------------------------------------------------------\n\e[0m"
101 make -C ./$(patsubst CleanUp%,%,$@) clean
103 CleanBinaries:
104 @$(ECHO) "\n\e[1;31m-----------------------------------------------------------------------------\e[0m"
105 @$(ECHO) "\e[1;31mClean\e[0m"
106 @$(ECHO) "\e[1;31m-----------------------------------------------------------------------------\n\e[0m"
107 rm -rfv ./bin
109 #-------------------------------------------------------------
110 # Build
111 #-------------------------------------------------------------
113 $(BUILD_PROJECTS):
114 @$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
115 @$(ECHO) "\e[1;34mBuild: $@\e[0m"
116 @$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
117 make -C ./$@
119 #-------------------------------------------------------------
120 # Deploy
121 #-------------------------------------------------------------
123 DeployBinaries: CopyAllBinaries CreateDocuments CreateTagFile
124 @$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
125 @$(ECHO) "\e[1;34mDeploy\e[0m"
126 @$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
127 rm -f $(OUTPUT_FILE)
128 pushd $(TARGET_PATH) ; tar -vcjf $(OUTPUT_FILE) * ; popd
130 CreateTagFile:
131 @$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
132 @$(ECHO) "\e[1;34mBuild Tag\e[0m"
133 @$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
134 echo "Dynamic Audio Normalizer" > $(BUILD_TAG)
135 echo "Copyright (C) 2014-$(shell date +%Y) LoRd_MuldeR <MuldeR2@GMX.de>. Some rights reserved." >> $(BUILD_TAG)
136 echo "" >> $(BUILD_TAG)
137 echo "Version $$(printf %d.%02d-%d $(VER_MAJOR) $(VER_MINOR) $(VER_PATCH)). Built on $(BUILD_DATE), at $(BUILD_TIME)" >> $(BUILD_TAG)
138 echo "" >> $(BUILD_TAG)
139 g++ --version | head -n1 | sed 's/^/Compiler version: /' >> $(BUILD_TAG)
140 ifeq ($(shell uname), Darwin)
141 uname -v | sed 's/^/Build platform: /' >> $(BUILD_TAG)
142 echo "System description: Darwin" >> $(BUILD_TAG)
143 else
144 uname -srmo | sed 's/^/Build platform: /' >> $(BUILD_TAG)
145 (lsb_release -s -d || ([ -n "$$MSYSTEM" ] && echo "$$MSYSTEM") || echo "Unknown") | sed 's/\"//g' | sed 's/^/System description: /' >> $(BUILD_TAG)
146 endif
147 echo "" >> $(BUILD_TAG)
148 echo "This library is free software; you can redistribute it and/or" >> $(BUILD_TAG)
149 echo "modify it under the terms of the GNU Lesser General Public" >> $(BUILD_TAG)
150 echo "License as published by the Free Software Foundation; either" >> $(BUILD_TAG)
151 echo "version 2.1 of the License, or (at your option) any later version." >> $(BUILD_TAG)
152 echo "" >> $(BUILD_TAG)
153 echo "This library is distributed in the hope that it will be useful," >> $(BUILD_TAG)
154 echo "but WITHOUT ANY WARRANTY; without even the implied warranty of" >> $(BUILD_TAG)
155 echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU" >> $(BUILD_TAG)
156 echo "Lesser General Public License for more details." >> $(BUILD_TAG)
157 mkdir -p $(TARGET_PATH)
158 mv -f $(BUILD_TAG) $(TARGET_PATH)/BUILD_TAG
160 CopyAllBinaries:
161 @$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
162 @$(ECHO) "\e[1;34mCopy Binaries\e[0m"
163 @$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
164 rm -rf $(TARGET_PATH)
165 mkdir -p $(TARGET_PATH)/include
166 mkdir -p $(TARGET_PATH)/samples/java
167 mkdir -p $(TARGET_PATH)/samples/python
168 mkdir -p $(TARGET_PATH)/samples/pascal
169 cp $(PROGRAM_NAME)/bin/$(PROGRAM_NAME).* $(TARGET_PATH)
170 cp $(LIBRARY_NAME)/lib/lib$(LIBRARY_NAME)-$(API_VERSION).* $(TARGET_PATH)
171 cp $(LOGVIEW_NAME)/bin/$(LOGVIEW_NAME).* $(TARGET_PATH) || $(ECHO) "\e[1;33mWARNING: File \"$(LOGVIEW_NAME)\" not found!\e[0m"
172 cp $(JNIWRAP_NAME)/out/$(JNIWRAP_NAME).jar $(TARGET_PATH) || $(ECHO) "\e[1;33mWARNING: File \"$(JNIWRAP_NAME).jar\" not found!\e[0m"
173 cp $(PYDWRAP_NAME)/lib/$(PYDWRAP_NAME).so $(TARGET_PATH) || $(ECHO) "\e[1;33mWARNING: File \"$(PYDWRAP_NAME).so\" not found!\e[0m"
174 cp $(LIBRARY_NAME)/include/*.h $(TARGET_PATH)/include
175 cp $(PYDWRAP_NAME)/include/*.py $(TARGET_PATH)/include
176 cp $(PASWRAP_NAME)/include/*.pas $(TARGET_PATH)/include
177 cp $(JNIWRAP_NAME)/samples/com/muldersoft/dynaudnorm/samples/*.java $(TARGET_PATH)/samples/java
178 cp $(PYDWRAP_NAME)/samples/*.py $(TARGET_PATH)/samples/python
179 cp $(PASWRAP_NAME)/src/*.pas $(TARGET_PATH)/samples/pascal
180 cp $(PASWRAP_NAME)/src/*.dfm $(TARGET_PATH)/samples/pascal
181 cp ./LICENSE-*.html $(TARGET_PATH)
183 CreateDocuments:
184 @$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
185 @$(ECHO) "\e[1;34mCreate Documents\e[0m"
186 @$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
187 wget -N -P $(JARS_PATH) https://repo1.maven.org/maven2/com/yahoo/platform/yui/yuicompressor/2.4.8/yuicompressor-2.4.8.jar
188 wget -N -P $(JARS_PATH) https://repo1.maven.org/maven2/com/googlecode/htmlcompressor/htmlcompressor/1.5.2/htmlcompressor-1.5.2.jar
189 mkdir -p $(TARGET_PATH)/img/dyauno
190 $(PANDOC) --from $(PANDOC_FLAGS) --to html5 --toc -N --standalone -H ./img/dyauno/Style.inc ./README.md | java -jar $(JARS_PATH)/htmlcompressor-1.5.2.jar --compress-css -o $(TARGET_PATH)/README.html
191 test -s $(TARGET_PATH)/README.html || (rm -f $(TARGET_PATH)/README.html; cp ./README.md $(TARGET_PATH)/README.md)
192 cp ./img/dyauno/*.png $(TARGET_PATH)/img/dyauno