forked from lordmulder/DynamicAudioNormalizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
174 lines (148 loc) · 8.08 KB
/
Makefile
File metadata and controls
174 lines (148 loc) · 8.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
##############################################################################
# Dynamic Audio Normalizer
# Copyright (c) 2014-2017 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.
#
# 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 <MuldeR2@GMX.de>" >> $(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"
@$(ECHO) "\e[1;34mCopy Binaries\e[0m"
@$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
rm -rf $(TARGET_PATH)
mkdir -p $(TARGET_PATH)/include
cp $(PROGRAM_NAME)/bin/$(PROGRAM_NAME).* $(TARGET_PATH)
cp $(LIBRARY_NAME)/lib/lib$(LIBRARY_NAME)-$(API_VERSION).* $(TARGET_PATH)
cp $(LOGVIEW_NAME)/bin/$(LOGVIEW_NAME).* $(TARGET_PATH) || $(ECHO) "\e[1;33mWARNING: File \"$(LOGVIEW_NAME)\" not found!\e[0m"
cp $(JNIWRAP_NAME)/out/$(JNIWRAP_NAME).jar $(TARGET_PATH) || $(ECHO) "\e[1;33mWARNING: File \"$(JNIWRAP_NAME).jar\" not found!\e[0m"
cp $(LIBRARY_NAME)/include/*.h $(TARGET_PATH)/include
cp $(PASWRAP_NAME)/include/*.pas $(TARGET_PATH)/include
cp ./LICENSE-*.html $(TARGET_PATH)
CreateDocuments:
@$(ECHO) "\n\e[1;34m-----------------------------------------------------------------------------\e[0m"
@$(ECHO) "\e[1;34mCreate Documents\e[0m"
@$(ECHO) "\e[1;34m-----------------------------------------------------------------------------\n\e[0m"
mkdir -p $(TARGET_PATH)/img/dyauno
$(PANDOC) --from $(PANDOC_FLAGS) --to html5 --toc -N --standalone -H ./img/dyauno/Style.inc ./README.md --output $(TARGET_PATH)/README.html || cp ./README.md $(TARGET_PATH)/README.md
cp ./img/dyauno/*.png $(TARGET_PATH)/img/dyauno