2018-01-07 20:13:20 +01:00
|
|
|
###############################
|
|
|
|
# vgmstream makefile
|
|
|
|
###############################
|
2008-03-11 06:40:29 +01:00
|
|
|
|
2021-08-07 20:41:50 +02:00
|
|
|
ifeq ($(VGMSTREAM_VERSION),)
|
|
|
|
# for current dir (expanded later)
|
2021-08-15 19:15:56 +02:00
|
|
|
VGMSTREAM_VERSION=`sh ./version-get.sh`
|
2021-08-07 20:41:50 +02:00
|
|
|
else
|
2021-08-15 19:15:56 +02:00
|
|
|
VGMSTREAM_VERSION=$(VGMSTREAM_VERSION)
|
2021-08-07 20:41:50 +02:00
|
|
|
endif
|
2021-08-15 19:15:56 +02:00
|
|
|
DEF_CFLAGS += -DVGMSTREAM_VERSION_AUTO
|
2021-08-07 20:41:50 +02:00
|
|
|
|
2021-01-23 15:50:59 +01:00
|
|
|
###############################################################################
|
|
|
|
### external defs
|
2018-01-07 20:13:20 +01:00
|
|
|
# currently aimed to WIN32 builds but vgmstream_cli should work for others (or use autotools instead)
|
2018-08-20 20:08:24 +02:00
|
|
|
export TARGET_OS = $(OS)
|
2020-04-12 20:38:21 +02:00
|
|
|
|
|
|
|
#for Win builds with vgmstream123
|
|
|
|
LIBAO_DLL_PATH = ../libao/bin
|
2018-01-07 20:13:20 +01:00
|
|
|
|
|
|
|
### tools
|
|
|
|
RMF = rm -f
|
|
|
|
|
2018-08-20 20:08:24 +02:00
|
|
|
ifeq ($(TARGET_OS),Windows_NT)
|
2018-01-07 20:13:20 +01:00
|
|
|
SHELL = sh
|
|
|
|
CC = gcc
|
|
|
|
AR = ar
|
|
|
|
STRIP = strip
|
|
|
|
WINDRES = windres
|
|
|
|
DLLTOOL = dlltool
|
|
|
|
|
|
|
|
# same thing, the above should be available
|
|
|
|
#CC = i686-w64-mingw32-gcc
|
|
|
|
#AR = i686-w64-mingw32-ar
|
|
|
|
#STRIP = i686-w64-mingw32-strip
|
|
|
|
#WINDRES = i686-w64-mingw32-windres
|
|
|
|
#DLLTOOL = i686-w64-mingw32-dlltool
|
|
|
|
|
|
|
|
else
|
|
|
|
SHELL = /bin/sh
|
|
|
|
CC = gcc
|
|
|
|
AR = ar
|
|
|
|
STRIP = strip
|
|
|
|
WINDRES =
|
|
|
|
DLLTOOL =
|
|
|
|
|
|
|
|
# (old crosscompile, not used anymore?)
|
|
|
|
#CC = i586-mingw32msvc-gcc
|
|
|
|
#AR = i586-mingw32msvc-ar
|
|
|
|
#STRIP = i586-mingw32msvc-strip
|
|
|
|
#WINDRES = i586-mingw32msvc-windres
|
|
|
|
#DLLTOOL = i586-mingw32msvc-dlltool
|
|
|
|
|
|
|
|
endif
|
|
|
|
export RMF SHELL CC AR STRIP WINDRES DLLTOOL
|
|
|
|
|
|
|
|
|
2021-01-23 15:50:59 +01:00
|
|
|
###############################################################################
|
|
|
|
### build defs
|
|
|
|
|
2021-08-07 20:41:50 +02:00
|
|
|
DEF_CFLAGS += -ffast-math -O3 -Wall -Werror=format-security -Wlogical-op -Wdeclaration-after-statement -Wvla -Wimplicit-function-declaration -Wignored-qualifiers
|
2021-07-29 23:42:34 +02:00
|
|
|
|
|
|
|
VGM_DEBUG_FLAGS = 0
|
|
|
|
ifeq ($(VGM_DEBUG_FLAGS),1)
|
|
|
|
#DEF_CFLAGS += -O0
|
|
|
|
DEF_CFLAGS += -g -DVGM_DEBUG_OUTPUT
|
|
|
|
DEF_CFLAGS += -Wall
|
|
|
|
DEF_CFLAGS += -Wextra
|
|
|
|
DEF_CFLAGS += -Wno-sign-compare
|
|
|
|
#DEF_CFLAGS += -pedantic -Wconversion -std=gnu90
|
|
|
|
#DEF_CFLAGS += -Wfloat-equal
|
|
|
|
DEF_CFLAGS += -Wdisabled-optimization -Wunsafe-loop-optimizations -Wswitch-default
|
|
|
|
DEF_CFLAGS += -Wcast-qual -Wpointer-arith
|
|
|
|
DEF_CFLAGS += -Wcast-align=strict -Wduplicated-cond -Wjump-misses-init -Wnull-dereference
|
|
|
|
DEF_CFLAGS += -Wold-style-definition -Wstrict-prototypes
|
|
|
|
DEF_CFLAGS += -Wmultistatement-macros -Wstringop-truncation
|
|
|
|
DEF_CFLAGS += -Wredundant-decls -Wmissing-include-dirs -Wmissing-declarations
|
|
|
|
#DEF_CFLAGS += -Wshadow
|
|
|
|
#DEF_CFLAGS += -Wstack-protector -fstack-protector
|
|
|
|
endif
|
2021-01-23 15:50:59 +01:00
|
|
|
|
|
|
|
LIBS_CFLAGS=
|
|
|
|
LIBS_LDFLAGS=
|
|
|
|
LIBS_TARGET_EXT_LIBS=
|
|
|
|
|
|
|
|
# config libs
|
2021-08-10 23:54:04 +02:00
|
|
|
VGM_G7221 = 1
|
|
|
|
ifneq ($(VGM_G7221),0)
|
2021-01-23 15:50:59 +01:00
|
|
|
LIBS_CFLAGS += -DVGM_USE_G7221
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
### external libs
|
2021-08-10 23:54:04 +02:00
|
|
|
# (call "make VGM_xxx = 0/1" to override 0/1 defaults, as Make does)
|
2021-01-23 15:50:59 +01:00
|
|
|
ifeq ($(TARGET_OS),Windows_NT)
|
2021-08-15 19:15:56 +02:00
|
|
|
|
2021-08-10 23:54:04 +02:00
|
|
|
# enabled by default on Windows
|
|
|
|
VGM_VORBIS = 1
|
|
|
|
ifneq ($(VGM_VORBIS),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_VORBIS
|
|
|
|
LIBS_LDFLAGS += -lvorbis
|
|
|
|
LIBS_TARGET_EXT_LIBS += libvorbis.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_MPEG = 1
|
|
|
|
ifneq ($(VGM_MPEG),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_MPEG
|
|
|
|
LIBS_LDFLAGS += -lmpg123-0
|
|
|
|
LIBS_TARGET_EXT_LIBS += libmpg123-0.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_G719 = 1
|
|
|
|
ifneq ($(VGM_G719),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_G719
|
|
|
|
LIBS_LDFLAGS += -lg719_decode
|
|
|
|
LIBS_TARGET_EXT_LIBS += libg719_decode.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_MAT3P = 0
|
|
|
|
ifneq ($(VGM_MAT3P),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_MAIATRAC3PLUS
|
|
|
|
LIBS_LDFLAGS += -lat3plusdecoder
|
|
|
|
LIBS_TARGET_EXT_LIBS += libat3plusdecoder.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_FFMPEG = 1
|
|
|
|
ifneq ($(VGM_FFMPEG),0)
|
2021-08-14 17:22:47 +02:00
|
|
|
LIBS_CFLAGS += -DVGM_USE_FFMPEG -I../ext_includes/ffmpeg
|
2021-08-10 23:54:04 +02:00
|
|
|
LIBS_LDFLAGS += -lavcodec -lavformat -lavutil -lswresample
|
|
|
|
LIBS_TARGET_EXT_LIBS += libavcodec.a libavformat.a libavutil.a libswresample.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_ATRAC9 = 1
|
|
|
|
ifneq ($(VGM_ATRAC9),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_ATRAC9
|
|
|
|
LIBS_LDFLAGS += -latrac9
|
|
|
|
LIBS_TARGET_EXT_LIBS += libatrac9.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_CELT = 1
|
|
|
|
ifneq ($(VGM_CELT),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_CELT
|
|
|
|
LIBS_LDFLAGS += -lcelt-0061 -lcelt-0110
|
|
|
|
LIBS_TARGET_EXT_LIBS += libcelt-0061.a libcelt-0110.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_SPEEX = 1
|
|
|
|
ifneq ($(VGM_SPEEX),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_SPEEX
|
|
|
|
LIBS_LDFLAGS += -L../ext_libs/libspeex -lspeex
|
|
|
|
LIBS_TARGET_EXT_LIBS += libspeex/libspeex.a
|
|
|
|
endif
|
2021-01-23 15:50:59 +01:00
|
|
|
|
2021-08-10 23:54:04 +02:00
|
|
|
else
|
2021-01-23 15:50:59 +01:00
|
|
|
|
2021-08-10 23:54:04 +02:00
|
|
|
# must install system libs and enable manually on Linux
|
|
|
|
VGM_VORBIS = 0
|
|
|
|
ifneq ($(VGM_VORBIS),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_VORBIS
|
|
|
|
LIBS_LDFLAGS += -lvorbis -lvorbisfile
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_MPEG = 0
|
|
|
|
ifneq ($(VGM_MPEG),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_MPEG
|
|
|
|
LIBS_LDFLAGS += -lmpg123
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_G719 = 0
|
|
|
|
ifneq ($(VGM_G719),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_G719
|
|
|
|
LIBS_LDFLAGS += -lg719_decode
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_MAT3P = 0
|
|
|
|
ifneq ($(VGM_MAT3P),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_MAIATRAC3PLUS
|
|
|
|
LIBS_LDFLAGS += -lat3plusdecoder
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_FFMPEG = 0
|
|
|
|
ifneq ($(VGM_FFMPEG),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_FFMPEG
|
|
|
|
LIBS_LDFLAGS += -lavcodec -lavformat -lavutil -lswresample
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_ATRAC9 = 0
|
|
|
|
ifneq ($(VGM_ATRAC9),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_ATRAC9
|
|
|
|
ifeq ($(VGM_ATRAC9),1)
|
|
|
|
LIBS_LDFLAGS += -latrac9
|
|
|
|
endif
|
|
|
|
ifeq ($(VGM_ATRAC9),2)
|
|
|
|
LIBS_LDFLAGS += -l:libatrac9.a
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_CELT = 0
|
|
|
|
ifneq ($(VGM_CELT),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_CELT
|
|
|
|
ifeq ($(VGM_CELT),1)
|
|
|
|
LIBS_LDFLAGS += -lcelt-0061 -lcelt-0110
|
|
|
|
endif
|
|
|
|
ifeq ($(VGM_CELT),2)
|
|
|
|
LIBS_LDFLAGS += -l:libcelt-0061.a -l:libcelt-0110.a
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
VGM_SPEEX = 0
|
|
|
|
ifneq ($(VGM_SPEEX),0)
|
|
|
|
LIBS_CFLAGS += -DVGM_USE_SPEEX
|
|
|
|
LIBS_LDFLAGS += -lspeex
|
|
|
|
endif
|
2021-01-23 15:50:59 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
export DEF_CFLAGS LIBS_CFLAGS LIBS_LDFLAGS LIBS_TARGET_EXT_LIBS
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
### internal defs
|
2021-08-15 19:15:56 +02:00
|
|
|
ifeq ($(TARGET_OS),Windows_NT)
|
|
|
|
ZIP_FILES = COPYING
|
|
|
|
ZIP_FILES += README.md
|
|
|
|
ZIP_FILES += cli/test.exe
|
|
|
|
ZIP_FILES += winamp/in_vgmstream.dll
|
|
|
|
ZIP_FILES += xmplay/xmp-vgmstream.dll
|
|
|
|
ZIP_FILES += ext_libs/*.dll
|
|
|
|
ZIP_FILES += ext_libs/libspeex/*.dll
|
|
|
|
ZIP_FILES_AO = cli/vgmstream123.exe
|
|
|
|
ZIP_FILES_AO += $(LIBAO_DLL_PATH)/*.dll
|
|
|
|
else
|
|
|
|
ZIP_FILES = COPYING
|
|
|
|
ZIP_FILES += README.md
|
|
|
|
ZIP_FILES += cli/vgmstream-cli
|
|
|
|
ZIP_FILES_AO = cli/vgmstream123
|
|
|
|
endif
|
2021-01-23 15:50:59 +01:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
### targets
|
2018-01-07 20:13:20 +01:00
|
|
|
buildrelease: clean bin
|
|
|
|
|
2020-04-12 20:38:21 +02:00
|
|
|
buildrelease-ex: clean bin-ex
|
|
|
|
|
2018-01-07 20:13:20 +01:00
|
|
|
buildfullrelease: clean sourceball bin
|
2008-03-11 06:40:29 +01:00
|
|
|
|
2008-03-14 14:28:46 +01:00
|
|
|
sourceball:
|
2021-08-15 19:15:56 +02:00
|
|
|
rm -rf vgmstream-$(VGMSTREAM_VERSION)
|
|
|
|
git checkout-index -f -a --prefix=vgmstream-$(VGMSTREAM_VERSION)/
|
|
|
|
# git archive --format zip --output vgmstream-$(VGMSTREAM_VERSION).zip master
|
|
|
|
echo "#!/bin/sh" > vgmstream-$(VGMSTREAM_VERSION)/version-get.sh
|
|
|
|
echo "echo \"$(VGMSTREAM_VERSION)\"" >> vgmstream-$(VGMSTREAM_VERSION)/version-get.sh
|
|
|
|
tar cvzf "vgmstream-$(VGMSTREAM_VERSION)-src.tar.gz" vgmstream-$(VGMSTREAM_VERSION)/*
|
|
|
|
rm -rf vgmstream-$(VGMSTREAM_VERSION)
|
|
|
|
|
|
|
|
bin: vgmstream_cli winamp xmplay
|
|
|
|
mkdir -p bin
|
|
|
|
zip -FS -j "bin/vgmstream-$(VGMSTREAM_VERSION).zip" $(ZIP_FILES)
|
2008-03-11 06:40:29 +01:00
|
|
|
|
2020-04-12 20:38:21 +02:00
|
|
|
#separate since vgmstream123 is kinda untested
|
2021-08-15 19:15:56 +02:00
|
|
|
bin-ex: vgmstream_cli winamp xmplay vgmstream123
|
|
|
|
mkdir -p bin
|
|
|
|
zip -FS -j "bin/vgmstream-$(VGMSTREAM_VERSION).zip" $(ZIP_FILES) $(ZIP_FILES_AO)
|
2020-04-12 20:38:21 +02:00
|
|
|
|
2021-08-15 19:15:56 +02:00
|
|
|
vgmstream_cli: version
|
2018-01-19 00:39:04 +01:00
|
|
|
$(MAKE) -C cli vgmstream_cli
|
2008-03-11 06:40:29 +01:00
|
|
|
|
2021-08-15 19:15:56 +02:00
|
|
|
vgmstream123: version
|
2018-01-19 00:39:04 +01:00
|
|
|
$(MAKE) -C cli vgmstream123
|
2008-03-11 06:40:29 +01:00
|
|
|
|
2021-08-15 19:15:56 +02:00
|
|
|
winamp: version
|
2018-01-07 20:13:20 +01:00
|
|
|
$(MAKE) -C winamp in_vgmstream
|
|
|
|
|
2021-08-15 19:15:56 +02:00
|
|
|
xmplay: version
|
2018-01-07 20:13:20 +01:00
|
|
|
$(MAKE) -C xmplay xmp_vgmstream
|
2017-01-03 14:27:06 +01:00
|
|
|
|
2021-08-15 19:15:56 +02:00
|
|
|
version:
|
|
|
|
sh version-make.sh
|
|
|
|
|
2008-03-11 06:40:29 +01:00
|
|
|
clean:
|
2018-01-07 20:13:20 +01:00
|
|
|
$(RMF) vgmstream-*.zip
|
2017-01-03 14:27:06 +01:00
|
|
|
$(MAKE) -C src clean
|
2018-01-19 00:39:04 +01:00
|
|
|
$(MAKE) -C cli clean
|
2008-03-11 06:40:29 +01:00
|
|
|
$(MAKE) -C winamp clean
|
2017-05-01 17:22:36 +02:00
|
|
|
$(MAKE) -C xmplay clean
|
2018-01-07 20:13:20 +01:00
|
|
|
$(MAKE) -C ext_libs clean
|
|
|
|
|
2021-08-15 19:15:56 +02:00
|
|
|
.PHONY: clean buildfullrelease buildrelease sourceball bin vgmstream_cli winamp
|