From 35fcbf220192a3fb89bd70978829a2c96354a413 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sun, 15 Jan 2023 21:10:44 +0100 Subject: [PATCH] build: x64 stuff for makefiles --- Makefile | 19 ++++++++++++++++++- cli/Makefile | 2 +- ext_libs/Makefile | 6 +++--- winamp/Makefile | 2 +- xmplay/Makefile | 2 +- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 3415142d..b6fe7118 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,8 @@ else endif DEF_CFLAGS += -DVGMSTREAM_VERSION_AUTO -DVGM_LOG_OUTPUT +VGM_X64=0 + ############################################################################### ### external defs # currently aimed to WIN32 builds but vgmstream-cli should work for others (or use autotools instead) @@ -28,7 +30,13 @@ ifeq ($(TARGET_OS),Windows_NT) STRIP = strip WINDRES = windres DLLTOOL = dlltool - #DLLTOOL = dlltool -m i386:x86-64 --as-flags --64 + + DLL_DIR = . + export DLL_DIR + ifneq ($(VGM_X64),0) + DLLTOOL = dlltool -m i386:x86-64 --as-flags --64 + DLL_DIR = dll-x64 + endif # same thing, the above should be available #CC = i686-w64-mingw32-gcc @@ -86,6 +94,15 @@ LIBS_CFLAGS= LIBS_LDFLAGS= LIBS_TARGET_EXT_LIBS= +### bit stuff +# TODO: some targets don't work with X64 (Winamp, etc), detect +#ifneq ($(VGM_X86),0) +# DEF_CFLAGS += -m32 +#endif +ifneq ($(VGM_X64),0) + DEF_CFLAGS += -m64 +endif + # config libs VGM_G7221 = 1 ifneq ($(VGM_G7221),0) diff --git a/cli/Makefile b/cli/Makefile index 64633dd4..14c841e1 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -18,7 +18,7 @@ ifeq ($(TARGET_OS),Windows_NT) # -DUSE_ALLOCA CFLAGS += -DWIN32 -I../ext_includes -I../ext_libs/Getopt - LDFLAGS += -L../ext_libs + LDFLAGS += -L../ext_libs/$(DLL_DIR) LIBAO_INC = -I$(LIBAO_IPATH) LIBAO_LIB = -L$(LIBAO_LPATH) -lao diff --git a/ext_libs/Makefile b/ext_libs/Makefile index b6c54507..cba360a6 100644 --- a/ext_libs/Makefile +++ b/ext_libs/Makefile @@ -12,10 +12,10 @@ # -D is optional, but needed if DLL was renamed (like libcelts) # patterns match ($@ = target, $< = dependency, for others substitute) -%.dll.a : %.def - $(DLLTOOL) -D $(patsubst %.def,%.dll,$<) -d $< -l $@ +%.dll.a: + $(DLLTOOL) -D $(DLL_DIR)/$(patsubst %.dll.a,%.dll,$@) -d $(DLL_DIR)/$(patsubst %.dll.a,%.def,$@) -l $(DLL_DIR)/$@ clean: - $(RMF) *.dll.a + $(RMF) $(DLL_DIR)/*.dll.a .PHONY: clean diff --git a/winamp/Makefile b/winamp/Makefile index 5d7e4504..bcabff4b 100644 --- a/winamp/Makefile +++ b/winamp/Makefile @@ -23,7 +23,7 @@ OUTPUT_WINAMP = in_vgmstream.dll ifeq ($(TARGET_OS),Windows_NT) CFLAGS += -DWIN32 -m32 -DUSE_ALLOCA -I../ext_includes - LDFLAGS += -L../ext_libs + LDFLAGS += -L../ext_libs/$(DLL_DIR) endif CFLAGS += $(LIBS_CFLAGS) diff --git a/xmplay/Makefile b/xmplay/Makefile index 3362b70f..a8f57866 100644 --- a/xmplay/Makefile +++ b/xmplay/Makefile @@ -21,7 +21,7 @@ ifeq ($(TARGET_OS),Windows_NT) endif CFLAGS += $(DEF_CFLAGS) -I../ext_includes $(EXTRA_CFLAGS) -LDFLAGS += -L../src -L../ext_libs -lvgmstream -lm $(EXTRA_LDFLAGS) +LDFLAGS += -L../src -L../ext_libs/$(DLL_DIR) -lvgmstream -lm $(EXTRA_LDFLAGS) TARGET_EXT_LIBS = CFLAGS += $(LIBS_CFLAGS)