From 8f552c5cd1b75d8211c1ef1fbc7ff1e9b0c7790d Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 15 Jan 2023 20:11:00 +0100 Subject: [PATCH] build: use .dll.a instead of .a for link libs - more consistent with mingw's usage (not standard static libs) --- Makefile | 20 ++++++++++---------- ext_libs/Makefile | 40 +++++++--------------------------------- 2 files changed, 17 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index 29ad1c3c..3415142d 100644 --- a/Makefile +++ b/Makefile @@ -102,49 +102,49 @@ ifeq ($(TARGET_OS),Windows_NT) ifneq ($(VGM_VORBIS),0) LIBS_CFLAGS += -DVGM_USE_VORBIS LIBS_LDFLAGS += -lvorbis - LIBS_TARGET_EXT_LIBS += libvorbis.a + LIBS_TARGET_EXT_LIBS += libvorbis.dll.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 + LIBS_TARGET_EXT_LIBS += libmpg123-0.dll.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 + LIBS_TARGET_EXT_LIBS += libg719_decode.dll.a endif VGM_FFMPEG = 1 ifneq ($(VGM_FFMPEG),0) LIBS_CFLAGS += -DVGM_USE_FFMPEG -I../ext_includes/ffmpeg - LIBS_LDFLAGS += -lavcodec -lavformat -lavutil -lswresample - LIBS_TARGET_EXT_LIBS += libavcodec.a libavformat.a libavutil.a libswresample.a + LIBS_LDFLAGS += -lavcodec-vgmstream-59 -lavformat-vgmstream-59 -lavutil-vgmstream-57 -lswresample-vgmstream-4 + LIBS_TARGET_EXT_LIBS += avcodec-vgmstream-59.dll.a avformat-vgmstream-59.dll.a avutil-vgmstream-57.dll.a swresample-vgmstream-4.dll.a endif VGM_ATRAC9 = 1 ifneq ($(VGM_ATRAC9),0) LIBS_CFLAGS += -DVGM_USE_ATRAC9 LIBS_LDFLAGS += -latrac9 - LIBS_TARGET_EXT_LIBS += libatrac9.a + LIBS_TARGET_EXT_LIBS += libatrac9.dll.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 + LIBS_TARGET_EXT_LIBS += libcelt-0061.dll.a libcelt-0110.dll.a endif VGM_SPEEX = 1 ifneq ($(VGM_SPEEX),0) LIBS_CFLAGS += -DVGM_USE_SPEEX LIBS_LDFLAGS += -lspeex-1 - LIBS_TARGET_EXT_LIBS += libspeex-1.a + LIBS_TARGET_EXT_LIBS += libspeex-1.dll.a endif else @@ -255,9 +255,9 @@ bin-ex: vgmstream-cli winamp xmplay vgmstream123 mkdir -p bin zip -FS -j "bin/$(BIN_FILE)" $(ZIP_FILES) $(ZIP_FILES_AO) -vgmstream_cli: vgmstream-cli +vgmstream-cli: vgmstream_cli -vgmstream-cli: version +vgmstream_cli: version $(MAKE) -C cli vgmstream_cli vgmstream123: version diff --git a/ext_libs/Makefile b/ext_libs/Makefile index b488db09..b6c54507 100644 --- a/ext_libs/Makefile +++ b/ext_libs/Makefile @@ -7,41 +7,15 @@ #$(error option must be built with TARGET_OS = Windows_NT) #endif +# generate linker libs for Mingw's GCC (usually named *.dll.a on Windows), using: +# dlltool [-D (lib).dll] -d (lib).def -l (lib).dll.a +# -D is optional, but needed if DLL was renamed (like libcelts) -libvorbis.a: libvorbis.def - $(DLLTOOL) -d libvorbis.def -l libvorbis.a - -libmpg123-0.a: libmpg123-0.def - $(DLLTOOL) -d libmpg123-0.def -l libmpg123-0.a - -libg719_decode.a: libg719_decode.def - $(DLLTOOL) -d libg719_decode.def -l libg719_decode.a - -libavcodec.a: avcodec-vgmstream-59.dll avcodec-vgmstream-59.def - $(DLLTOOL) -D avcodec-vgmstream-59.dll -d avcodec-vgmstream-59.def -l libavcodec.a - -libavformat.a: avformat-vgmstream-59.dll avformat-vgmstream-59.def - $(DLLTOOL) -D avformat-vgmstream-59.dll -d avformat-vgmstream-59.def -l libavformat.a - -libavutil.a: avutil-vgmstream-57.dll avutil-vgmstream-57.def - $(DLLTOOL) -D avutil-vgmstream-57.dll -d avutil-vgmstream-57.def -l libavutil.a - -libswresample.a: swresample-vgmstream-4.dll swresample-vgmstream-4.def - $(DLLTOOL) -D swresample-vgmstream-4.dll -d swresample-vgmstream-4.def -l libswresample.a - -libatrac9.a: libatrac9.dll libatrac9.def - $(DLLTOOL) -D libatrac9.dll -d libatrac9.def -l libatrac9.a - -libcelt-0061.a: libcelt-0061.dll libcelt-0061.def - $(DLLTOOL) -D libcelt-0061.dll -d libcelt-0061.def -l libcelt-0061.a - -libcelt-0110.a: libcelt-0110.dll libcelt-0110.def - $(DLLTOOL) -D libcelt-0110.dll -d libcelt-0110.def -l libcelt-0110.a - -libspeex-1.a: libspeex-1.dll libspeex-1.def - $(DLLTOOL) -D libspeex-1.dll -d libspeex-1.def -l libspeex-1.a +# patterns match ($@ = target, $< = dependency, for others substitute) +%.dll.a : %.def + $(DLLTOOL) -D $(patsubst %.def,%.dll,$<) -d $< -l $@ clean: - $(RMF) libvorbis.a libmpg123-0.a libg719_decode.a libavcodec.a libavformat.a libavutil.a libswresample.a libatrac9.a libcelt-0061.a libcelt-0110.a libspeex-1.a + $(RMF) *.dll.a .PHONY: clean