1 ##############################################################################
2 # Dynamic Audio Normalizer - Audio Processing Library
3 # Copyright (c) 2014-2019 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved.
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 # http://www.gnu.org/licenses/lgpl-2.1.txt
20 ##############################################################################
25 JAVA_HOME ?
= $(shell update-java-alternatives
-l
2>/dev
/null | grep
-oE
'[^[:space:]]+$$' || echo
"/usr/lib/jvm/default")
27 ##############################################################################
29 ##############################################################################
31 LIBRARY_NAME
:= libDynamicAudioNormalizerAPI
34 $(error API_VERSION variable is not set
!)
37 ##############################################################################
39 ##############################################################################
41 ifneq ($(MAKECMDGOALS
),clean)
42 ifneq ($(ENABLE_JNI
),false
)
43 JDK_CHECK
:= $(shell [ -f
$(JAVA_HOME
)/include/jni.h
] && echo true || echo false
)
44 ifneq ($(JDK_CHECK
),true
)
45 $(error File
"include/jni.h" not found in JAVA_HOME path
!)
50 ##############################################################################
52 ##############################################################################
57 ifeq ($(DEBUG_BUILD
), 1)
59 CXXFLAGS
= -g
-O0
-D_DEBUG
62 CXXFLAGS
= -O3
-Wall
-ffast-math
-mfpmath
=sse
-msse
-fomit-frame-pointer
-fno-tree-vectorize
-DNDEBUG
-march
=$(MARCH
)
65 ifneq ($(findstring MINGW
,$(shell uname
-s
)),MINGW
)
69 CXXFLAGS
+= -std
=gnu
++11
70 CXXFLAGS
+= -fvisibility
=hidden
71 CXXFLAGS
+= -DMDYNAMICAUDIONORMALIZER_EXPORTS
74 CXXFLAGS
+= -I.
/include
75 CXXFLAGS
+= -I..
/DynamicAudioNormalizerShared
/include
76 CXXFLAGS
+= -I..
/DynamicAudioNormalizerJNI
/include
78 ifneq ($(ENABLE_JNI
),false
)
79 CXXFLAGS
+= -I
$(JAVA_HOME
)/include
80 ifeq ($(findstring MINGW
,$(shell uname
-s
)),MINGW
)
81 CXXFLAGS
+= -I
$(JAVA_HOME
)/include/win32
82 else ifeq ($(shell uname
), Darwin
)
83 CXXFLAGS
+= -I
$(JAVA_HOME
)/include/darwin
85 CXXFLAGS
+= -I
$(JAVA_HOME
)/include/linux
88 CXXFLAGS
+= -DNO_JAVA_SUPPORT
91 ##############################################################################
93 ##############################################################################
95 ifeq ($(findstring MINGW
,$(shell uname
-s
)),MINGW
)
97 LDXFLAGS
+= -Wl
,--out-implib
,$@.a
99 else ifeq ($(shell uname
), Darwin
)
101 SHAREDFLAG
= -dynamiclib
107 SOURCES_CPP
= $(wildcard src
/*.
cpp)
108 SOURCES_OBJ
= $(patsubst %.
cpp,%.o
,$(SOURCES_CPP
))
110 LIBRARY_OUT
= lib
/$(LIBRARY_NAME
)-$(API_VERSION
)
111 LIBRARY_BIN
= $(LIBRARY_OUT
).
$(SO_EXT
)
112 LIBRARY_DBG
= $(LIBRARY_OUT
)-DBG.
$(SO_EXT
)
114 ##############################################################################
116 ##############################################################################
120 all: $(LIBRARY_DBG
) $(LIBRARY_BIN
)
122 #-------------------------------------------------------------
124 #-------------------------------------------------------------
126 $(LIBRARY_BIN
): $(SOURCES_OBJ
)
127 @
$(ECHO
) "\e[1;36m[STR] $@\e[0m"
129 g
++ $(SHAREDFLAG
) -g0
-o
$@
$+ $(LDXFLAGS
)
130 ifeq ($(shell uname
), Darwin
)
131 install_name_tool
-id
"@loader_path/$(notdir $@)" $@
134 strip --strip-unneeded
$@
137 $(LIBRARY_DBG
): $(SOURCES_OBJ
)
138 @
$(ECHO
) "\e[1;36m[LNK] $@\e[0m"
140 g
++ $(SHAREDFLAG
) -o
$@
$+ $(LDXFLAGS
)
141 ifeq ($(shell uname
), Darwin
)
142 install_name_tool
-id
"@loader_path/$(notdir $@)" $@
145 #-------------------------------------------------------------
147 #-------------------------------------------------------------
150 @
$(ECHO
) "\e[1;36m[CXX] $<\e[0m"
152 g
++ $(CXXFLAGS
) -c
$< -o
$@
154 #-------------------------------------------------------------
156 #-------------------------------------------------------------
159 rm -fv
$(SOURCES_OBJ
)